Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/META-INF/MANIFEST.MF48
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/plugin.xml56
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/property_files/jpt_common_core.properties3
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/schema/resourceLocators.exsd8
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/IResourcePart.java34
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptCommonCorePlugin.java40
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModel.java16
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/ResourceReference.java32
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptCommonCoreMessages.java3
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/LibraryProviderPropertyTester.java47
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/ResourceReferenceAdapterFactory.java (renamed from common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/ResourceAdapterFactory.java)28
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/LibraryProviderPropertyTester.java41
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/AbstractJptFileCreationDataModelProvider.java6
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ModuleResourceLocator.java82
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/PluginResourceLocator.java98
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ProjectAdapterFactory.java50
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleJavaResourceLocator.java260
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleProjectResourceLocator.java68
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/WebModuleResourceLocator.java46
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java14
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceCompilationUnit.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceMember.java3
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java19
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java12
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceTypeCompilationUnit.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/CallbackJobSynchronizer.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JobSynchronizer.java9
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/PlatformTools.java15
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/SimpleSchedulingRule.java8
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/AbstractSingleUseQueueingJobCommandExecutor.java105
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/CommandJobCommandAdapter.java47
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/JobCommandCommandAdapter.java44
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/JobCommandJob.java44
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/NotifyingRepeatingJobCommandWrapper.java95
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/RepeatingJobCommandWrapper.java195
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/SimpleJobCommandExecutor.java209
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/SingleUseQueueingExtendedJobCommandExecutor.java103
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/SingleUseQueueingJobCommandExecutor.java39
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractJDTType.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTAnnotatedElement.java11
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTEnum.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTEnumConstant.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTFieldAttribute.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTMember.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTMethodAttribute.java7
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTPackage.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTType.java9
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/ProjectResourceLocator.java58
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/ResourceLocator.java37
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceCompilationUnit.java7
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceType.java14
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/CombinedCommandExecutor.java107
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/CombinedExtendedCommandExecutor.java164
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/ExtendedJobCommandExecutor.java225
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/InterruptibleJobCommand.java81
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/JobCommand.java (renamed from common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JobCommand.java)39
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/JobCommandExecutor.java129
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/NotifyingRepeatingJobCommand.java105
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/RepeatingJobCommand.java85
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemExtendedLabelProvider.java235
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemLabelProvider.java224
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemStructuredStateProviderManager.java280
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemTreeContentProvider.java187
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractSelectionProvider.java82
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractTreeItemContentProvider.java204
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ContentProvider.java40
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/DelegatingTreeContentAndLabelProvider.java58
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/EmptySelection.java43
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ItemStructuredStateProviderManager.java45
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ItemTreeStateProviderManager.java101
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/LabelProviderAdapter.java30
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NavigatorContentProvider.java135
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NavigatorLabelProvider.java117
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NullLabelProvider.java60
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NullTreeContentProvider.java60
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SelectionChangedAdapter.java30
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SimpleItemTreeStateProviderFactoryProvider.java48
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SimpleMessageTreeContent.java100
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemExtendedLabelProvider.java54
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemLabelProvider.java59
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemTreeContentProvider.java79
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StructuredContentProvider.java32
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/TreeContentProvider.java44
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTCollectionChangeListenerWrapper.java160
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTListChangeListenerWrapper.java236
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTPropertyChangeListenerWrapper.java54
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTStateChangeListenerWrapper.java61
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTTreeChangeListenerWrapper.java151
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/properties/JptProjectPropertiesPage.java362
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/DisposeAdapter.java29
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java147
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AbstractUiCommandExecutor.java60
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AsynchronousUiCommandExecutor.java35
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/PageAdapter.java35
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/PartAdapter.java41
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/PartAdapter2.java50
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/PropertyAdapter.java29
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/SynchronousUiCommandExecutor.java35
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/WindowAdapter.java38
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/BooleanStateController.java81
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/MultiControlBooleanStateController.java65
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SimpleBooleanStateController.java7
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java23
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PropertySheetWidgetFactory.java15
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/DelegatingContentAndLabelProvider.java207
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ExtendedLabelProvider.java29
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemExtendedLabelProvider.java49
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemExtendedLabelProviderFactory.java (renamed from common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemContentProviderFactory.java)16
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemLabelProvider.java44
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemLabelProviderFactory.java16
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemStructuredContentProvider.java105
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemStructuredContentProviderFactory.java (renamed from common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/TreeItemContentProviderFactory.java)18
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemTreeContentProvider.java111
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemTreeContentProviderFactory.java29
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemTreeStateProviderFactoryProvider.java (renamed from common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemContentProvider.java)26
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/StructuredStateProvider.java (renamed from common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/TreeItemContentProvider.java)32
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/TreeStateProvider.java29
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/META-INF/MANIFEST.MF111
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/BooleanReference.java166
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ExceptionHandler.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ExceptionHandler.java)8
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Filter.java8
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ModifiableObjectReference.java29
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ObjectReference.java35
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ReadOnlyObjectReference.java43
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/command/Command.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Command.java)4
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/command/CommandExecutor.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/CommandExecutor.java)39
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/command/ExtendedCommandExecutor.java126
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/command/InterruptibleCommand.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/InterruptibleCommand.java)6
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/command/InterruptibleCommandExecutor.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/InterruptibleCommandExecutor.java)6
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/command/NotifyingRepeatingCommand.java102
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/command/RepeatingCommand.java80
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/command/StatefulCommandExecutor.java35
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/command/StatefulExtendedCommandExecutor.java25
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AbstractBooleanReference.java85
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AbstractTransformer.java30
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AsynchronousCommandExecutor.java168
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Classpath.java22
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CollectingExceptionHandler.java54
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ConsumerThreadCoordinator.java112
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/FilterAdapter.java30
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/IntReference.java133
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/LazyObjectReference.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/LazyReadOnlyObjectReference.java)14
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ListenerList.java12
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ModifiableBooleanReference.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanReference.java)8
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ModifiableIntReference.java40
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReadOnlyBooleanReference.java46
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReadOnlyIntReference.java145
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/RunnableAdapter.java26
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleBooleanReference.java24
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleCommandExecutor.java46
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleFilter.java61
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleIntReference.java6
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleObjectReference.java6
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StatefulCommandExecutor.java33
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedBoolean.java10
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedInt.java10
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedObject.java10
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedStack.java6
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommandExecutor.java65
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Transformer.java2
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/TransformerAdapter.java27
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/AbstractAsynchronousCommandExecutor.java276
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/AbstractQueueingCommandExecutor.java96
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/AbstractSafeCommandExecutor.java57
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/AbstractSingleUseQueueingCommandExecutor.java165
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/AbstractStatefulCommandExecutor.java67
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/AbstractThreadLocalCommandExecutor.java63
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/AsynchronousCommandExecutor.java100
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/AsynchronousExtendedCommandExecutor.java153
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/AsynchronousNotifyingRepeatingCommandWrapper.java160
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/AsynchronousRepeatingCommandWrapper.java287
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/CommandRunnable.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CommandRunnable.java)15
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/CompositeCommand.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CompositeCommand.java)11
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/NotifyingRepeatingCommandWrapper.java98
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/QueueingCommandExecutor.java32
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/QueueingExtendedCommandExecutor.java83
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/RepeatingCommandState.java220
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/RepeatingCommandWrapper.java170
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/RunnableCommand.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/RunnableCommand.java)15
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/SafeCommandExecutor.java44
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/SafeExtendedCommandExecutor.java63
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/SimpleStatefulCommandExecutor.java32
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/SimpleStatefulExtendedCommandExecutor.java64
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/SingleUseQueueingCommandExecutor.java33
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/SingleUseQueueingExtendedCommandExecutor.java78
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/SynchronizingCommand.java163
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/ThreadLocalCommand.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommand.java)14
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/ThreadLocalCommandExecutor.java30
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/ThreadLocalExtendedCommandExecutor.java40
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/ChangeSupport.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractPropertyValueModel.java29
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractPropertyValueModelAdapter.java27
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectAdapter.java138
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectCollectionValueModelAdapter.java35
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectListValueModelAdapter.java32
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectPropertyValueModelAdapter.java42
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectTreeValueModelAdapter.java119
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedWritablePropertyValueModel.java169
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CachingPropertyValueModelWrapper.java101
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CachingTransformationPropertyValueModel.java112
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CachingTransformationWritablePropertyValueModel.java107
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ChangePropertyValueModelAdapter.java40
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionAspectAdapter.java118
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionListValueModelAdapter.java9
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionPropertyValueModelAdapter.java105
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionValueModelWrapper.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeBooleanPropertyValueModel.java52
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeCollectionValueModel.java12
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeListValueModel.java11
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositePropertyValueModel.java95
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/DoubleModifiablePropertyValueModel.java53
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/DoublePropertyValueModel.java165
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ElementPropertyValueModelAdapter.java130
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringCollectionValueModel.java25
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringPropertyValueModel.java98
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringWritablePropertyValueModel.java114
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemChangeListValueModelAdapter.java24
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListAspectAdapter.java124
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCollectionValueModelAdapter.java11
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCurator.java45
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListPropertyValueModelAdapter.java83
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListValueModelWrapper.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullPropertyValueModel.java12
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyAspectAdapter.java91
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyCollectionValueModelAdapter.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyListValueModelAdapter.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyValueModelWrapper.java82
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ReadOnlyWritablePropertyValueModelWrapper.java11
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SetCollectionValueModel.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimplePropertyValueModel.java26
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SortedListValueModelAdapter.java8
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SortedListValueModelWrapper.java7
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StatePropertyValueModelAdapter.java40
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationListValueModel.java9
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationPropertyValueModel.java132
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationWritablePropertyValueModel.java115
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TreeAspectAdapter.java155
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TreePropertyValueModelAdapter.java144
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueAspectAdapter.java50
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueChangeAdapter.java24
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/prefs/PreferencePropertyValueModel.java11
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/prefs/PreferencesCollectionValueModel.java7
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/RadioButtonModelAdapter.java86
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AbstractNode.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/AsynchronousSynchronizer.java188
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/CallbackAsynchronousSynchronizer.java120
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/CallbackSynchronousSynchronizer.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/AbstractChangeListener.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SimpleChangeListener.java)11
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ChangeAdapter.java14
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CollectionChangeAdapter.java15
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CommandChangeListener.java7
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ListChangeAdapter.java15
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/PropertyChangeAdapter.java17
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/PropertyValueModel.java12
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritablePropertyValueModel.java12
-rw-r--r--common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/resource/java/JavaResourceModelTestCase.java4
-rw-r--r--common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/jface/DelegatingLabelProviderUiTest.java115
-rw-r--r--common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/jface/DelegatingTreeContentProviderUiTest.java65
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/META-INF/MANIFEST.MF1
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ExceptionHandlerTests.java22
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/FilterTests.java9
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/JptCommonUtilityTests.java10
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/MultiThreadedTestCase.java4
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedIntTests.java5
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedObjectTests.java5
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/TestCommand.java18
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/command/AsynchronousCommandExecutorTests.java (renamed from common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/AsynchronousCommandExecutorTests.java)18
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/command/AsynchronousRepeatingCommandWrapperTests.java (renamed from common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/AsynchronousSynchronizerTests.java)126
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/command/CommandExecutorTests.java (renamed from common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CommandExecutorTests.java)33
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/command/CommandRunnableTests.java (renamed from common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CommandRunnableTests.java)9
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/command/CommandTests.java (renamed from common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CommandTests.java)17
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/command/CompositeCommandTests.java (renamed from common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CompositeCommandTests.java)11
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/command/JptUtilityCommandTests.java37
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CachingTransformationPropertyValueModelTests.java14
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CachingTransformationWritablePropertyValueModelTests.java24
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CollectionAspectAdapterTests.java22
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CollectionPropertyValueModelAdapterTests.java4
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositePropertyValueModelTests.java14
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/DoubleModifiablePropertyValueModelTests.java118
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/DoublePropertyValueModelTests.java223
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/FilteringPropertyValueModelTests.java19
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/JptUtilityModelValueTests.java12
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ListAspectAdapterTests.java27
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyAspectAdapterTests.java15
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationPropertyValueModelTests.java35
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TreeAspectAdapterTests.java362
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/JptUtilitySynchronizersTests.java4
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/SynchronousSynchronizerTests.java5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/DbwsGeneratorUi.java4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/DbwsGeneratorWizard.java4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml107
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbProjectManager.java45
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbNode.java6
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbProject.java14
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbNode.java8
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbProject.java31
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaElementAdapterFactory.java46
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JaxbPlatformTester.java63
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/ResourceAdapterFactory.java51
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbLibraryProviderInstallOperationConfigAdapterFactory.java46
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformTester.java54
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/AbstractJaxbFileResourceModel.java129
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceImpl.java174
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbprops/JaxbPropertiesResourceImpl.java100
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidator.java11
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/plugin.xml10
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorItemLabelProviderFactory.java27
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorUi.java20
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbPersistentAttributeItemLabelProvider.java44
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml2
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java82
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory.java92
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorUi.java24
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbClassItemContentProvider.java37
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbClassItemLabelProvider.java51
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemContentProvider.java36
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemLabelProvider.java56
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbEnumConstantItemLabelProvider.java51
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbEnumItemContentProvider.java38
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbEnumItemLabelProvider.java43
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemContentProvider.java37
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemLabelProvider.java54
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentAttributeItemLabelProvider.java79
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbRegistryItemContentProvider.java39
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTypeItemLabelProvider.java60
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentAndLabelProvider.java22
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java126
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorItemLabelProviderFactory.java24
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorLabelProvider.java138
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorTreeItemContentProviderFactory.java25
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java11
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java22
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ProjectWizardPage.java4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/navigator/JaxbNavigatorUi.java14
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/projects/TestJaxbProject.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml248
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_core.properties16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/GenericJpaProjectManager.java1100
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFile.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaNode.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformFactory.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java221
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProjectManager.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaStructureNode.java114
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdTypeMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaRootContextNode.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedSuperclass.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEntity.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdTypeMapping.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaStructureNodes.java)23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedSuperclass.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEntity.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdTypeMapping.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmStructureNodes.java)22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedSuperclass.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceStructureNodes.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java295
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java575
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/FileAdapterFactory.java130
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/InternalJpaProjectManager.java1417
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaPlatformTester.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaTester.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/ProjectAdapterFactory.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/SimpleJpaProjectConfig.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/WorkspaceAdapterFactory.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/XmlFilePropertyTester.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaLibraryProviderInstallOperationConfigAdapterFactory.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JavaElementAdapterFactory.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformTester.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/ResourceAdapterFactory.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourcePropertyTester.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/synch/SynchronizeClassesJob.java146
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationPreferences.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidator.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MetamodelSynchronizer.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/AbstractXmlResourceProvider.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaXmlResource.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/ConnectionAdapter.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/plugin.xml18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/META-INF/MANIFEST.MF1
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/plugin.xml17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMultitenancyComposite.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLink2_3PersistenceUnitMetadataComposite.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappings2_0DetailsProvider.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappings2_3DetailsProvider.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsDetailsProvider.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml1_1UiDefinition.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml1_2UiDefinition.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_0UiDefinition.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_1UiDefinition.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXmlUiDefinition.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkPersistenceXmlUiDefinition.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/SharedCacheComposite.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/CacheStatementsPropertiesComposite.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemContentProviderFactory.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemLabelProviderFactory.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistencexml/details/EclipseLinkPersistenceUnitItemContentProvider.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLink1_1JpaPlatformUiFactory.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLink1_2JpaPlatformUiFactory.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLink2_0JpaPlatformUi.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLink2_0JpaPlatformUiFactory.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLink2_1JpaPlatformUiFactory.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLink2_2JpaPlatformUiFactory.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLink2_3JpaPlatformUiFactory.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLink2_4JpaPlatformUiFactory.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUi.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUiFactory.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLinkNavigatorItemContentProviderFactory.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLinkNavigatorProvider.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/structure/EclipseLinkOrmResourceModelStructureProvider.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/structure/EclipseLinkPersistenceItemContentProviderFactory.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/structure/EclipseLinkPersistenceResourceModelStructureProvider.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/structure/EclipseLinkPersistenceStructureItemContentProviderFactory.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/structure/EclipseLinkPersistenceUnitItemContentProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_0UiDefinition.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/PackageGenerator.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.xml339
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_ui.properties9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaFileModel.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaPlatformUi.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaProjectModel.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaRootContextNodeModel.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JptJpaUiPlugin.java147
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/ResourceUiDefinition.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/JpaDetailsPageManager.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/JpaDetailsPage.java)53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/JpaDetailsProvider.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/EditorPartAdapterFactory.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/FileAdapterFactory.java137
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaFileAdapterFactory.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaJavaCompletionProposalComputer.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaPlatformAdapterFactory.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaStructureNodeAdapterFactory.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JptResourceModelPropertyTester.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JptUiMessages.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/ProjectAdapterFactory.java197
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/OpenJpaResourceAction.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/ProjectAction.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/SynchronizeClassesAction.java241
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/AddPersistentAttributeToXmlAndMapHandler.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/AddPersistentAttributeToXmlHandler.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/AddPersistentClassHandler.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/ConvertJavaProjectToJpaCommandHandler.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/RemovePersistentAttributeFromXmlHandler.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/UpgradeXmlFileVersionHandler.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEntityMappingsDetailsProvider.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractJpaDetailsPage.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOverridesComposite.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractPrimaryKeyJoinColumnsComposite.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinTableComposite.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoiningStrategyJoinColumnsComposite.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoiningStrategyJoinColumnsWithOverrideOptionComposite.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MapAsComposite.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ReferenceTableComposite.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/AbstractJavaResourceUiDefinition.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPersistentAttributeDetailsProvider.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPersistentTypeDetailsProvider.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/EntityMappingsDetailsProvider.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPersistentAttributeDetailsProvider.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPersistentTypeDetailsProvider.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmXmlUiDefinition.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/PersistenceEditor.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jface/JarFileItemLabelProvider.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jface/XmlMappingFileViewerFilter.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Jpa2_0FlagTransformer.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Jpa2_0ProjectFlagModel.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/EntityMappings2_0DetailsProvider.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmXml2_0UiDefinition.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceXml2_0UiDefinition.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/platform/generic/Generic2_0JpaPlatformUiFactory.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlJavaCompletionProposalComputer.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlSseCompletionProposalComputer.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/listeners/SWTConnectionListenerWrapper.java471
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/MapAsContribution.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorContentAndLabelProvider.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorContentProvider.java254
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorItemContentProviderFactory.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorItemLabelProviderFactory.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorLabelProvider.java138
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorTreeItemContentProviderFactory.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/RootContextNodeModelItemContentProvider.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/RootContextNodeModelItemLabelProvider.java90
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/PersistenceUnitMappingFilesComposite.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/PersistenceXmlUiDefinition.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/BaseJpaPlatformUi.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/ClassRefItemLabelProvider.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/EntityMappingsItemLabelProvider.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/GenericJpaPlatformUi.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/GenericJpaPlatformUiFactory.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/GenericNavigatorItemContentProviderFactory.java287
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/GenericNavigatorItemLabelProviderFactory.java118
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/GenericNavigatorProvider.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/JarFileRefItemLabelProvider.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/JavaPersistentTypeItemContentProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/MappingFileRefItemLabelProvider.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/OrmPersistentTypeItemContentProvider.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/OrmXmlItemContentProvider.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/OrmXmlItemLabelProvider.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceItemLabelProvider.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceUnitItemContentProvider.java198
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceUnitItemLabelProvider.java160
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceXmlItemContentProvider.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceXmlItemLabelProvider.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentAttributeItemContentProvider.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentAttributeItemLabelProvider.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentTypeItemLabelProvider.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/RootContextItemContentProvider.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/RootContextItemLabelProvider.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/preferences/JpaProblemSeveritiesPage.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java700
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/DefaultJpaSelection.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/DefaultJpaSelectionManager.java288
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaDetailsSelectionParticipant.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaPageManager.java296
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaSelection.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaSelectionEvent.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaSelectionManager.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaSelectionParticipant.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaStructureSelectionParticipant.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaTextEditorManager.java336
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaWindowManager.java126
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaWorkbenchManager.java251
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/SelectionManagerFactory.java105
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/TextEditorAdapterFactory.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/TextEditorSelectionParticipant.java215
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/ViewPartAdapterFactory.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/WorkbenchAdapterFactory.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/WorkbenchPartAdapterFactory.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/WorkbenchWindowAdapterFactory.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/EntityMappingsItemContentProvider.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/GeneralJpaMappingItemLabelProviderFactory.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/JavaItemContentProviderFactory.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/JavaItemLabelProviderFactory.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/JavaResourceModelStructureProvider.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/JavaStructureItemContentProviderFactory.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/JavaStructureItemLabelProviderFactory.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/JpaFileItemContentProvider.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/MappingStructureItemLabelProviderFactory.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/OrmItemContentProviderFactory.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/OrmItemLabelProviderFactory.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/OrmResourceModelStructureProvider.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/OrmStructureItemContentProviderFactory.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/OrmStructureItemLabelProviderFactory.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceItemContentProvider.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceItemContentProviderFactory.java270
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceItemLabelProviderFactory.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceResourceModelStructureProvider.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceStructureItemContentProviderFactory.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceStructureItemLabelProviderFactory.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceUnitItemContentProvider.java176
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/ResourceModelItemContentProvider.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/AbstractJpaView.java166
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaDetailsView.java392
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaStructurePage.java505
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaStructureView.java227
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/structure/JpaStructurePage.java412
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/structure/JpaStructureView.java134
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/DatabaseSchemaWizardPage.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizard.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizardPage.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/SelectJpaOrmMappingFileDialog.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityClassWizardPage.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityWizard.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/model/EntityDataModelProvider.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java343
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DatabaseGroup.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/PromptJPAProjectWizardPage.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesSelectorWizardPage.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileWizard.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/navigator/JpaNavigatorProvider.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/selection/JpaEditorManager.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/selection/JpaSelectionManager.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/selection/JpaViewManager.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/structure/JpaStructureProvider.java41
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformUiFactory.java15
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/JptJpaCoreTestsPlugin.java16
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaFileTests.java116
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/model/JpaProjectManagerTests.java176
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/projects/TestJpaProject.java61
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JavaResourceModelTestCase.java4
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/META-INF/MANIFEST.MF2
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditor.java13
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java3
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/util/ModelIntegrationUtil.java8
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java71
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java11
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/META-INF/MANIFEST.MF2
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/JPACreateFactory.java17
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/JPAEditorTestsActivator.java22
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/editor/EditorTest.java9
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/ClickAddFeatureTest.java3
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/CreateDeleteOnlyAttributeTest.java4
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/CreateRelationFeaturesTest.java16
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/SaveEntityFeatureTest.java16
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/listener/JPAProjectListenerTest.java18
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/modelintegration/ui/ModelIntegrationTest.java22
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/modelintegration/util/ModelIntegrationUtilTest.java3
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/relation/CreateRelationAttributesTest.java18
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/relation/CreateRelationsInFieldAnnotatedEntitiesTest.java18
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/relation/CreateRelationsTest.java97
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/util/CreateDeleteEntity.java5
659 files changed, 24924 insertions, 16577 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/META-INF/MANIFEST.MF b/common/plugins/org.eclipse.jpt.common.core/META-INF/MANIFEST.MF
index 2b26df13ba..0f5bc3bef3 100644
--- a/common/plugins/org.eclipse.jpt.common.core/META-INF/MANIFEST.MF
+++ b/common/plugins/org.eclipse.jpt.common.core/META-INF/MANIFEST.MF
@@ -28,15 +28,33 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
org.eclipse.wst.validation;bundle-version="[1.2.0,2.0.0)"
Dali-Comment: We friend 'utility' to all non-EclipseLink, non-test bundles
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.resource.java;x-friends:="org.eclipse.jpt.jpa.core,org.eclipse.jpt.jaxb.core",
- org.eclipse.jpt.common.core.internal.resource.java.binary;x-friends:="org.eclipse.jpt.jpa.core,org.eclipse.jpt.jaxb.core",
- org.eclipse.jpt.common.core.internal.resource.java.source;x-friends:="org.eclipse.jpt.jpa.core,org.eclipse.jpt.jaxb.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.resource.java;
+ x-friends:="org.eclipse.jpt.jpa.core,
+ org.eclipse.jpt.jaxb.core",
+ org.eclipse.jpt.common.core.internal.resource.java.binary;
+ x-friends:="org.eclipse.jpt.jpa.core,
+ org.eclipse.jpt.jaxb.core",
+ org.eclipse.jpt.common.core.internal.resource.java.source;
+ x-friends:="org.eclipse.jpt.jpa.core,
+ org.eclipse.jpt.jaxb.core",
org.eclipse.jpt.common.core.internal.utility;
x-friends:="org.eclipse.jpt.common.ui,
org.eclipse.jpt.jaxb.core,
@@ -46,12 +64,20 @@ Export-Package: org.eclipse.jpt.common.core,
org.eclipse.jpt.jpa.db.ui,
org.eclipse.jpt.jpa.gen,
org.eclipse.jpt.jpa.ui",
- org.eclipse.jpt.common.core.internal.utility.jdt;x-friends:="org.eclipse.jpt.jaxb.core,org.eclipse.jpt.jpa.core",
- org.eclipse.jpt.common.core.internal.utility.translators;x-friends:="org.eclipse.jpt.jpa.core,org.eclipse.jpt.jaxb.core",
+ org.eclipse.jpt.common.core.internal.utility.command;
+ 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.jaxb.core,
+ org.eclipse.jpt.jpa.core",
+ org.eclipse.jpt.common.core.internal.utility.translators;
+ x-friends:="org.eclipse.jpt.jpa.core,
+ org.eclipse.jpt.jaxb.core",
org.eclipse.jpt.common.core.libprov,
org.eclipse.jpt.common.core.libval,
org.eclipse.jpt.common.core.resource,
org.eclipse.jpt.common.core.resource.java,
org.eclipse.jpt.common.core.utility,
+ org.eclipse.jpt.common.core.utility.command,
org.eclipse.jpt.common.core.utility.jdt
Import-Package: com.ibm.icu.text;version="4.0.1"
diff --git a/common/plugins/org.eclipse.jpt.common.core/plugin.xml b/common/plugins/org.eclipse.jpt.common.core/plugin.xml
index 0fe4f7e514..6110a45534 100644
--- a/common/plugins/org.eclipse.jpt.common.core/plugin.xml
+++ b/common/plugins/org.eclipse.jpt.common.core/plugin.xml
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<!--
- Copyright (c) 2011 Oracle. All rights reserved.
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v1.0, which accompanies this distribution
- and is available at http://www.eclipse.org/legal/epl-v10.html.
-
- Contributors:
- Oracle - initial API and implementation
+ Copyright (c) 2011, 2012 Oracle. All rights reserved.
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0, which accompanies this distribution
+ and is available at http://www.eclipse.org/legal/epl-v10.html.
+
+ Contributors:
+ Oracle - initial API and implementation
-->
<plugin>
@@ -26,7 +26,29 @@
schema="schema/resourceLocators.exsd"/>
- <!-- ***** Eclipse core extensions ***** -->
+ <!-- ***** adapters ***** -->
+
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+
+ <!-- IProject -> ProjectResourceLocator -->
+ <factory
+ adaptableType="org.eclipse.core.resources.IProject"
+ class="org.eclipse.jpt.common.core.internal.resource.ProjectAdapterFactory">
+ <adapter type="org.eclipse.jpt.common.core.resource.ProjectResourceLocator"/>
+ </factory>
+
+ <!-- ResourceReference -> IResource -->
+ <factory
+ adaptableType="org.eclipse.jpt.common.core.ResourceReference"
+ class="org.eclipse.jpt.common.core.internal.ResourceReferenceAdapterFactory">
+ <adapter type="org.eclipse.core.resources.IResource"/>
+ </factory>
+
+ </extension>
+
+
+ <!-- ***** content types ***** -->
<extension
point="org.eclipse.core.contenttype.contentTypes">
@@ -54,17 +76,7 @@
</extension>
- <extension
- point="org.eclipse.core.runtime.adapters">
-
- <factory
- class="org.eclipse.jpt.common.core.internal.ResourceAdapterFactory"
- adaptableType="org.eclipse.core.resources.IResource">
- <adapter type="org.eclipse.jpt.common.core.IResourcePart"/>
- </factory>
-
- </extension>
-
+ <!-- ***** property testers ***** -->
<extension
point="org.eclipse.core.expressions.propertyTesters">
@@ -74,11 +86,13 @@
type="org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider"
namespace="org.eclipse.jpt.common.core"
properties="id, extendsId"
- class="org.eclipse.jpt.common.core.internal.libprov.LibraryProviderPropertyTester"/>
+ class="org.eclipse.jpt.common.core.internal.LibraryProviderPropertyTester"/>
</extension>
+ <!-- ***** Dali extensions (eat our own dogfood) ***** -->
+
<extension
point="org.eclipse.jpt.common.core.resourceLocators">
@@ -141,6 +155,8 @@
</extension>
+ <!-- ***** WTP Library Provider Framework Integration ***** -->
+
<extension
point="org.eclipse.jst.common.project.facet.core.libraryProviders">
diff --git a/common/plugins/org.eclipse.jpt.common.core/property_files/jpt_common_core.properties b/common/plugins/org.eclipse.jpt.common.core/property_files/jpt_common_core.properties
index e474609500..a4eef57496 100644
--- a/common/plugins/org.eclipse.jpt.common.core/property_files/jpt_common_core.properties
+++ b/common/plugins/org.eclipse.jpt.common.core/property_files/jpt_common_core.properties
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (c) 2011 Oracle. All rights reserved.
+# Copyright (c) 2012 Oracle. All rights reserved.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v1.0, which accompanies this distribution
# and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -7,6 +7,7 @@
# Contributors:
# Oracle - initial API and implementation
################################################################################
+DALI_JOB_NAME=Dali
DALI_EVENT_HANDLER_THREAD_NAME=Dali Event Handler
GENERATION_CREATING_LAUNCH_CONFIG_TASK=Creating launch configuration
GENERATION_SAVING_LAUNCH_CONFIG_TASK=Saving launch configuration
diff --git a/common/plugins/org.eclipse.jpt.common.core/schema/resourceLocators.exsd b/common/plugins/org.eclipse.jpt.common.core/schema/resourceLocators.exsd
index 5eaf59b07a..d82f686e66 100644
--- a/common/plugins/org.eclipse.jpt.common.core/schema/resourceLocators.exsd
+++ b/common/plugins/org.eclipse.jpt.common.core/schema/resourceLocators.exsd
@@ -6,7 +6,7 @@
<meta.schema plugin="org.eclipse.jpt.common.core" id="resourceLocators" name="Resource Locators"/>
</appinfo>
<documentation>
- Used to provide custom (non-java) resource location logic to JPT projects.
+ Used to provide custom (non-Java) resource location logic to JPT projects.
</documentation>
</annotation>
@@ -120,7 +120,7 @@
<documentation>
&lt;br&gt;
&lt;p&gt;
-The following example is the included simple java resource locator, which is used for simple java projects. It is of &quot;lowest&quot; priority, since all JPT projects will at their roots be simple java projects.
+The following example is the included simple Java resource locator, which is used for simple Java projects. It is of &quot;lowest&quot; priority, since all JPT projects will at their roots be simple Java projects.
&lt;p&gt;
&lt;pre&gt;
&lt;extension
@@ -147,11 +147,11 @@ The following example is the included simple java resource locator, which is use
</appinfo>
<documentation>
&lt;p&gt;
-The contributed resource locator class must implement &lt;code&gt;org.eclipse.jpt.co9mmon.core.resource.ResourceLocator&lt;/code&gt;.
+The contributed resource locator class must implement &lt;code&gt;org.eclipse.jpt.common.core.resource.ResourceLocator&lt;/code&gt;.
&lt;p&gt;
The enablement variables include:
&lt;ul&gt;
-&lt;li&gt;&quot;project&quot; which gives the current IProject.&lt;/li&gt;
+&lt;li&gt;&quot;project&quot; which gives the current &lt;code&gt;IProject&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
</documentation>
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
index 1dfc996b70..ccbb34d598 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
+ * Copyright (c) 2011, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,9 +9,6 @@
******************************************************************************/
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;
@@ -19,10 +16,8 @@ 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
@@ -82,22 +77,6 @@ public class JptCommonCorePlugin
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<LibraryValidator> getLibraryValidators(
JptLibraryProviderInstallOperationConfig config) {
return LibraryValidatorManager.instance().getLibraryValidators(config);
@@ -108,7 +87,7 @@ public class JptCommonCorePlugin
private static JptCommonCorePlugin INSTANCE;
/**
- * Return the singleton jpt common core plug-in.
+ * Return the singleton Dali common core plug-in.
*/
public static JptCommonCorePlugin instance() {
return INSTANCE;
@@ -118,13 +97,6 @@ public class JptCommonCorePlugin
// ********** 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) {
@@ -145,6 +117,13 @@ public class JptCommonCorePlugin
log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, throwable));
}
+ /**
+ * Log the specified status.
+ */
+ public static void log(IStatus status) {
+ INSTANCE.getLog().log(status);
+ }
+
// ********** plug-in implementation **********
@@ -169,6 +148,5 @@ public class JptCommonCorePlugin
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
index d43f22cc7c..f183add042 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModel.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.common.core;
+import org.eclipse.core.resources.IFile;
+
/**
* Listeners are notified whenever anything in the JPT resource model changes.
* <p>
@@ -22,14 +24,19 @@ package org.eclipse.jpt.common.core;
* @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.
+ * Return the model's resource type. This can change.
+ * Return <code>null</code> if the resource type cannot be determined,
+ * the content type is <code>null</code> or the version is <code>null</code>.
*/
JptResourceType getResourceType();
/**
+ * Return the model's file.
+ */
+ IFile getFile();
+
+ /**
* Changes to the resource model result in events.
* In particular, the JPA project performs an "update" whenever a resource
* model changes.
@@ -40,5 +47,4 @@ public interface JptResourceModel {
* @see #addResourceModelListener(JptResourceModelListener)
*/
void removeResourceModelListener(JptResourceModelListener listener);
-
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/ResourceReference.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/ResourceReference.java
new file mode 100644
index 0000000000..8075a9ec6b
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/ResourceReference.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core;
+
+import org.eclipse.core.resources.IResource;
+
+/**
+ * An object that has a corresponding {@link IResource}
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.1
+ * @see org.eclipse.jpt.common.core.internal.ResourceReferenceAdapterFactory
+ */
+public interface ResourceReference {
+ /**
+ * 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/internal/JptCommonCoreMessages.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptCommonCoreMessages.java
index b962c61115..b9e6e40681 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptCommonCoreMessages.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptCommonCoreMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -16,6 +16,7 @@ import org.eclipse.osgi.util.NLS;
*/
public class JptCommonCoreMessages {
+ public static String DALI_JOB_NAME;
public static String DALI_EVENT_HANDLER_THREAD_NAME;
public static String GENERATION_CREATING_LAUNCH_CONFIG_TASK;
public static String GENERATION_SAVING_LAUNCH_CONFIG_TASK;
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/LibraryProviderPropertyTester.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/LibraryProviderPropertyTester.java
new file mode 100644
index 0000000000..0f3e21f034
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/LibraryProviderPropertyTester.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.internal;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
+
+/**
+ * Property tester for {@link ILibraryProvider}.
+ * See <code>org.eclipse.jpt.common.core/plugin.xml</code>
+ */
+public class LibraryProviderPropertyTester
+ extends PropertyTester
+{
+ public static final String ID = "id"; //$NON-NLS-1$
+ public static final String EXTENDS_ID = "extendsId"; //$NON-NLS-1$
+
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if (receiver instanceof ILibraryProvider) {
+ return this.test((ILibraryProvider) receiver, property, expectedValue);
+ }
+ return false;
+ }
+
+ private boolean test(ILibraryProvider libraryProvider, String property, Object expectedValue) {
+ if (property.equals(ID)) {
+ return libraryProvider.getId().equals(expectedValue);
+ }
+ if (property.equals(EXTENDS_ID)) {
+ while (libraryProvider != null) {
+ if (libraryProvider.getId().equals(expectedValue)) {
+ return true;
+ }
+ libraryProvider = libraryProvider.getBaseProvider();
+ }
+ return false;
+ }
+ return false;
+ }
+}
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/ResourceReferenceAdapterFactory.java
index 6514e060f1..f97e5d0dd1 100644
--- 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/ResourceReferenceAdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,37 +11,33 @@ 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;
+import org.eclipse.jpt.common.core.ResourceReference;
/**
- * Factory to build adapters for converting Eclipse resources to Dali
- * resource parts.
- * <p>
+ * Factory to build adapters for a {@link ResourceReference}:<ul>
+ * <li>{@link IResource}
+ * </ul>
* See <code>org.eclipse.jpt.common.core plugin.xml</code>.
*/
-public class ResourceAdapterFactory
+public class ResourceReferenceAdapterFactory
implements IAdapterFactory
{
- private static final Class<?>[] ADAPTER_LIST = new Class[] { IResourcePart.class };
+ private static final Class<?>[] ADAPTER_LIST = new Class[] { IResource.class };
public Class<?>[] getAdapterList() {
return ADAPTER_LIST;
}
public Object getAdapter(Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType) {
- if (adaptableObject instanceof IResource) {
- return this.getAdapter((IResource) adaptableObject, adapterType);
+ if (adaptableObject instanceof ResourceReference) {
+ return this.getAdapter((ResourceReference) adaptableObject, adapterType);
}
return null;
}
- private Object getAdapter(final IResource resource, Class <?>adapterType) {
- if (adapterType == IResourcePart.class) {
- return new IResourcePart() {
- public IResource getResource() {
- return resource;
- }
- };
+ private Object getAdapter(ResourceReference resourceReference, Class <?>adapterType) {
+ if (adapterType == IResource.class) {
+ return resourceReference.getResource();
}
return null;
}
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/operations/AbstractJptFileCreationDataModelProvider.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/AbstractJptFileCreationDataModelProvider.java
index e15e98011a..1106f12032 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/AbstractJptFileCreationDataModelProvider.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/AbstractJptFileCreationDataModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -19,6 +19,7 @@ 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.core.resource.ProjectResourceLocator;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
@@ -130,7 +131,8 @@ public abstract class AbstractJptFileCreationDataModelProvider
protected IContainer getDefaultContainer() {
IProject project = (IProject) this.model.getProperty(PROJECT);
if (project != null) {
- return JptCommonCorePlugin.getResourceLocator(project).getDefaultResourceLocation(project);
+ ProjectResourceLocator locator = (ProjectResourceLocator) project.getAdapter(ProjectResourceLocator.class);
+ return locator.getDefaultResourceLocation();
}
return null;
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ModuleResourceLocator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ModuleResourceLocator.java
index 104081ec57..d76318d249 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ModuleResourceLocator.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ModuleResourceLocator.java
@@ -1,11 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
+ * Copyright (c) 2010, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.common.core.internal.resource;
@@ -17,63 +17,71 @@ 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 {
-
+ extends SimpleJavaResourceLocator
+{
/**
- * Return the folder representing the "META-INF" runtime location
+ * Return the folder representing the <code>META-INF</code> runtime location.
*/
@Override
public IContainer getDefaultResourceLocation(IProject project) {
- IVirtualComponent component = ComponentCore.createComponent(project);
- return component.getRootFolder().getFolder(META_INF_PATH).getUnderlyingFolder();
+ return this.getRootFolder(project).getFolder(META_INF_PATH).getUnderlyingFolder();
}
@Override
public IPath getResourcePath(IProject project, IPath runtimePath) {
- IVirtualComponent component = ComponentCore.createComponent(project);
- return component.getRootFolder().getFile(runtimePath).getWorkspaceRelativePath();
+ return this.getRootFolder(project).getFile(runtimePath).getWorkspaceRelativePath();
}
@Override
public IPath getRuntimePath(IProject project, IPath resourcePath) {
+ IVirtualFolder rootFolder = this.getRootFolder(project);
IFile file = PlatformTools.getFile(resourcePath);
- IVirtualComponent component = ComponentCore.createComponent(project);
- IVirtualFolder root = component.getRootFolder();
- IVirtualFile vFile = findVirtualFile(root, file);
+ IVirtualFile vFile = this.getVirtualFile(rootFolder, file);
if (vFile != null) {
return vFile.getRuntimePath().makeRelative();
}
- // couldn't find it. try the super-case
+ // couldn't find it - try the super-case
return super.getRuntimePath(project, resourcePath);
}
- private IVirtualFile findVirtualFile(IVirtualFolder vFolder, IFile file) {
+ protected IVirtualFile getVirtualFile(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;
- }
- }
- }
+ return this.getVirtualFile_(vFolder, file);
+ } catch (CoreException ex) {
+ JptCommonCorePlugin.log(ex);
+ return null;
}
- catch (CoreException ce) {
- // fall through
- JptCommonCorePlugin.log(ce);
+ }
+
+ protected IVirtualFile getVirtualFile_(IVirtualFolder vFolder, IFile file) throws CoreException {
+ for (IVirtualResource vResource : vFolder.members()) {
+ IVirtualFile vFile = this.getVirtualFile(vResource, file);
+ if (vFile != null) {
+ return vFile;
+ }
}
return null;
}
+
+ protected IVirtualFile getVirtualFile(IVirtualResource vResource, IFile file) throws CoreException {
+ switch (vResource.getType()) {
+ case IVirtualResource.FILE:
+ IVirtualFile vFile = (IVirtualFile) vResource;
+ return file.equals(vFile.getUnderlyingResource()) ? vFile : null;
+ case IVirtualResource.FOLDER:
+ // recurse
+ return this.getVirtualFile_((IVirtualFolder) vResource, file);
+ default:
+ return null;
+ }
+ }
+
+ protected IVirtualFolder getRootFolder(IProject project) {
+ return ComponentCore.createComponent(project).getRootFolder();
+ }
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/PluginResourceLocator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/PluginResourceLocator.java
index 4dcd3fd221..2e8f070000 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/PluginResourceLocator.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/PluginResourceLocator.java
@@ -1,11 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
+ * Copyright (c) 2010, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.common.core.internal.resource;
@@ -16,68 +16,74 @@ 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 {
-
+ 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);
+ IContainer bundleRoot = this.getBundleRoot(project);
+ return (bundleRoot != null) ?
+ bundleRoot.getFolder(META_INF_PATH) :
+ super.getDefaultResourceLocation(project);
}
-
+
@Override
public IPath getResourcePath(IProject project, IPath runtimePath) {
- try {
- IContainer root = getBundleRoot(project);
- IPath resourcePath = root.getFullPath().append(runtimePath);
+ IContainer bundleRoot = this.getBundleRoot(project);
+ if (bundleRoot != null) {
+ IPath resourcePath = bundleRoot.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());
+ IContainer bundleRoot = this.getBundleRoot(project);
+ if (bundleRoot != null) {
+ IFile file = PlatformTools.getFile(resourcePath);
+ if (bundleRoot.contains(file)) {
+ return resourcePath.makeRelativeTo(bundleRoot.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 IContainer getBundleRoot(IProject project) {
+ try {
+ return this.getBundleRoot_(project);
+ } catch (CoreException ex) {
+ // problem creating description on an existing project
+ JptCommonCorePlugin.log(ex);
+ return null;
+ }
}
-
+
+ protected IContainer getBundleRoot_(IProject project) throws CoreException {
+ BundleContext bundleContext = JptCommonCorePlugin.instance().getBundle().getBundleContext();
+ if (bundleContext == null) {
+ return project;
+ }
+ ServiceReference<IBundleProjectService> serviceRef = bundleContext.getServiceReference(IBundleProjectService.class);
+ if (serviceRef == null) {
+ return project;
+ }
+ IBundleProjectService service = bundleContext.getService(serviceRef);
+ if (service == null) {
+ bundleContext.ungetService(serviceRef);
+ return project;
+ }
+ IPath bundleRoot = service.getDescription(project).getBundleRoot();
+ bundleContext.ungetService(serviceRef);
+ return (bundleRoot == null) ? project : project.getFolder(bundleRoot);
+ }
+
protected IBundleProjectService getBundleProjectService() {
BundleContext context = JptCommonCorePlugin.instance().getBundle().getBundleContext();
ServiceReference<IBundleProjectService> reference = context.getServiceReference(IBundleProjectService.class);
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ProjectAdapterFactory.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ProjectAdapterFactory.java
new file mode 100644
index 0000000000..1b0e356297
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ProjectAdapterFactory.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.internal.resource;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.jpt.common.core.resource.ProjectResourceLocator;
+
+/**
+ * Factory to build Dali adapters for an {@link IProject}:<ul>
+ * <li>{@link org.eclipse.jpt.common.core.resource.ProjectResourceLocator}
+ * </ul>
+ * See <code>org.eclipse.jpt.common.core/plugin.xml</code>.
+ */
+public class ProjectAdapterFactory
+ implements IAdapterFactory
+{
+ private static final Class<?>[] ADAPTER_LIST = new Class[] {
+ ProjectResourceLocator.class
+ };
+
+ public Class<?>[] getAdapterList() {
+ return ADAPTER_LIST;
+ }
+
+ public Object getAdapter(Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType) {
+ if (adaptableObject instanceof IProject) {
+ return this.getAdapter((IProject) adaptableObject, adapterType);
+ }
+ return null;
+ }
+
+ private Object getAdapter(IProject project, Class<?> adapterType) {
+ if (adapterType == ProjectResourceLocator.class) {
+ return this.getProjectResourceLocator(project);
+ }
+ return null;
+ }
+
+ private ProjectResourceLocator getProjectResourceLocator(IProject project) {
+ return new SimpleProjectResourceLocator(project);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleJavaResourceLocator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleJavaResourceLocator.java
index 2050f09006..a409df8da8 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleJavaResourceLocator.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleJavaResourceLocator.java
@@ -1,11 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
+ * Copyright (c) 2010, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.common.core.internal.resource;
@@ -22,131 +22,195 @@ 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.jpt.common.utility.Filter;
+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.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jst.j2ee.internal.J2EEConstants;
-public class SimpleJavaResourceLocator
- implements ResourceLocator {
-
- protected static IPath META_INF_PATH = new Path(J2EEConstants.META_INF);
-
+public class SimpleJavaResourceLocator
+ implements ResourceLocator
+{
+ protected static final 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
+ * Return whether the specified container is either:<ul>
+ * <li>on the corresponding Java project's classpath; or
+ * <li>in the non-Java resources, but not in the project output location
+ * </ul>
*/
- public boolean acceptResourceLocation(IProject project, IContainer container) {
- IJavaProject javaProject = getJavaProject(project);
+ public boolean resourceLocationIsValid(IProject project, IContainer container) {
+ try {
+ return this.resourceLocationIsValid_(project, container);
+ } catch (JavaModelException ex) {
+ JptCommonCorePlugin.log(ex);
+ // happens if the Java project does not exist
+ return false;
+ }
+ }
+
+ protected boolean resourceLocationIsValid_(IProject project, IContainer container) throws JavaModelException {
+ IJavaProject javaProject = this.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;
- }
+
+ IPath outputPath = javaProject.getOutputLocation();
+ IPath containerPath = container.getFullPath();
+ if (container.equals(project) && outputPath.isPrefixOf(containerPath)) {
+ return true;
+ }
+
+ if (outputPath.isPrefixOf(containerPath)) {
+ return false;
+ }
+ for (Object resource : javaProject.getNonJavaResources()) {
+ if (resource instanceof IFolder) {
+ IFolder folder = (IFolder) resource;
+ if (folder.getFullPath().isPrefixOf(containerPath)) {
+ 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)
+ * Return the default resource location for the specified project:<ul>
+ * <li>the first package fragment root (source folder) <code>META-INF</code>
+ * folder if it exists; or
+ * <li>the project rooted <code>META-INF</code> folder if it exists; or
+ * <li>the non-existent <code>META-INF</code> folder in the first package
+ * fragment root (source folder)
+ * </ul>
*/
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);
+ return this.getDefaultResourceLocation_(project);
+ } catch (Exception ex) {
+ JptCommonCorePlugin.log(ex);
+ // happens if the Java project does not exist or there is a problem with the
+ // Java resources
+ return null;
+ }
+ }
+
+ protected IContainer getDefaultResourceLocation_(IProject project) throws JavaModelException {
+ IContainer defaultLocation = null;
+ for (IContainer sourceFolder : this.getSourceFolders(project)) {
+ IFolder metaInfFolder = sourceFolder.getFolder(META_INF_PATH);
if (metaInfFolder.exists()) {
return metaInfFolder;
}
+ if (defaultLocation == null) {
+ // save the first one, to use if none found
+ defaultLocation = 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);
+ IFolder metaInfFolder = project.getFolder(META_INF_PATH);
+ if (metaInfFolder.exists()) {
+ return metaInfFolder;
}
-
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 this.getResourcePath_(project, runtimePath);
+ } catch (Exception ex) {
+ JptCommonCorePlugin.log(ex);
return null;
}
- return firstResourcePath;
}
-
+
+ protected IPath getResourcePath_(IProject project, IPath runtimePath) throws JavaModelException {
+ IPath defaultResourcePath = null;
+ for (IContainer sourceFolder : this.getSourceFolders(project)) {
+ IPath resourcePath = sourceFolder.getFullPath().append(runtimePath);
+ IFile file = project.getWorkspace().getRoot().getFile(resourcePath);
+ if (file.exists()) {
+ return file.getFullPath();
+ }
+ if (defaultResourcePath == null) {
+ // save the first one, to use if none found
+ defaultResourcePath = resourcePath;
+ }
+ }
+ return defaultResourcePath;
+ }
+
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());
- }
- }
- }
+ return this.getRuntimePath_(project, resourcePath);
+ } catch (Exception ex) {
+ JptCommonCorePlugin.log(ex);
+ return resourcePath.makeRelativeTo(project.getFullPath());
}
- catch (JavaModelException jme) {
- // fall through
- JptCommonCorePlugin.log(jme);
+ }
+
+ protected IPath getRuntimePath_(IProject project, IPath resourcePath) throws JavaModelException {
+ IFile file = PlatformTools.getFile(resourcePath);
+ for (IContainer sourceFolder : this.getSourceFolders(project)) {
+ if (sourceFolder.contains(file)) {
+ return resourcePath.makeRelativeTo(sourceFolder.getFullPath());
+ }
}
return resourcePath.makeRelativeTo(project.getFullPath());
}
-
- private IJavaProject getJavaProject(IProject project) {
+
+ protected Iterable<IContainer> getSourceFolders(IProject project) throws JavaModelException {
+ return new TransformationIterable<IPackageFragmentRoot, IContainer>(this.getSourcePackageFragmentRoots(project), ROOT_CONTAINER_TRANSFORMER);
+ }
+
+ protected static final Transformer<IPackageFragmentRoot, IContainer> ROOT_CONTAINER_TRANSFORMER = new RootContainerTransformer();
+
+ protected static class RootContainerTransformer
+ implements Transformer<IPackageFragmentRoot, IContainer>
+ {
+ public IContainer transform(IPackageFragmentRoot pfr) {
+ try {
+ return this.transform_(pfr);
+ } catch (JavaModelException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ protected IContainer transform_(IPackageFragmentRoot pfr) throws JavaModelException {
+ return (IContainer) pfr.getUnderlyingResource();
+ }
+ }
+
+ protected Iterable<IPackageFragmentRoot> getSourcePackageFragmentRoots(IProject project) throws JavaModelException {
+ return new FilteringIterable<IPackageFragmentRoot>(this.getPackageFragmentRoots(project), SOURCE_ROOT_FILTER);
+ }
+
+ protected static final Filter<IPackageFragmentRoot> SOURCE_ROOT_FILTER = new SourceRootFilter();
+
+ protected static class SourceRootFilter
+ implements Filter<IPackageFragmentRoot>
+ {
+ public boolean accept(IPackageFragmentRoot pfr) {
+ try {
+ return this.accept_(pfr);
+ } catch (JavaModelException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ protected boolean accept_(IPackageFragmentRoot pfr) throws JavaModelException {
+ return pfr.getKind() == IPackageFragmentRoot.K_SOURCE;
+ }
+ }
+
+ protected Iterable<IPackageFragmentRoot> getPackageFragmentRoots(IProject project) throws JavaModelException {
+ return new ArrayIterable<IPackageFragmentRoot>(this.getPackageFragmentRootsArray(project));
+ }
+
+ protected IPackageFragmentRoot[] getPackageFragmentRootsArray(IProject project) throws JavaModelException {
+ return this.getJavaProject(project).getPackageFragmentRoots();
+ }
+
+ protected 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/SimpleProjectResourceLocator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleProjectResourceLocator.java
new file mode 100644
index 0000000000..71b1d522ef
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleProjectResourceLocator.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.internal.resource;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jpt.common.core.resource.ProjectResourceLocator;
+import org.eclipse.jpt.common.core.resource.ResourceLocator;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * @see org.eclipse.jpt.common.core.internal.resource.ProjectAdapterFactory
+ * @see ResourceLocatorManager
+ */
+public class SimpleProjectResourceLocator
+ implements ProjectResourceLocator
+{
+ protected final IProject project;
+
+
+ public SimpleProjectResourceLocator(IProject project) {
+ super();
+ this.project = project;
+ }
+
+ public boolean resourceLocationIsValid(IContainer container) {
+ ResourceLocator resourceLocator = this.getResourceLocator();
+ return (resourceLocator != null) && resourceLocator.resourceLocationIsValid(this.project, container);
+ }
+
+ public IContainer getDefaultResourceLocation() {
+ ResourceLocator resourceLocator = this.getResourceLocator();
+ return (resourceLocator == null) ? null : resourceLocator.getDefaultResourceLocation(this.project);
+ }
+
+ public IPath getResourcePath(IPath runtimePath) {
+ ResourceLocator resourceLocator = this.getResourceLocator();
+ return (resourceLocator == null) ? null : resourceLocator.getResourcePath(this.project, runtimePath);
+ }
+
+ public IPath getRuntimePath(IPath resourcePath) {
+ ResourceLocator resourceLocator = this.getResourceLocator();
+ return (resourceLocator == null) ? null : resourceLocator.getRuntimePath(this.project, resourcePath);
+ }
+
+ public IFile getPlatformFile(IPath runtimePath) {
+ IPath sourcePath = this.getResourcePath(runtimePath);
+ return (sourcePath == null) ? null : this.project.getWorkspace().getRoot().getFile(sourcePath);
+ }
+
+ protected ResourceLocator getResourceLocator() {
+ return ResourceLocatorManager.instance().getResourceLocator(this.project);
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.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
index a7fffe7e8c..7d1cb6bfb4 100644
--- 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
@@ -1,11 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
+ * Copyright (c) 2010, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.common.core.internal.resource;
@@ -14,41 +14,39 @@ 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);
-
+ extends ModuleResourceLocator
+{
+ protected static final IPath WEB_INF_CLASSES_PATH = new Path(J2EEConstants.WEB_INF_CLASSES);
+ protected static final IPath WEB_META_INF_PATH = WEB_INF_CLASSES_PATH.append(META_INF_PATH);
+
/**
- * Return the folder representing the "WEB-INF/classes/META-INF" location
+ * Return the folder representing the <code>WEB-INF/classes/META-INF</code>
+ * 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 this.getRootFolder(project).getFolder(WEB_META_INF_PATH).getUnderlyingFolder();
}
-
+
/**
- * Return the full resource path representing the given runtime location appended
- * to the "WEB-INF/classes" location
+ * Return the full resource path representing the specified runtime location
+ * appended to the <code>WEB-INF/classes</code> 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;
+ return WEB_INF_CLASSES_PATH.isPrefixOf(runtimePath) ?
+ runtimePath.makeRelativeTo(WEB_INF_CLASSES_PATH) :
+ runtimePath;
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java
index be988599b1..d8cb8f1c1e 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java
@@ -36,7 +36,7 @@ abstract class BinaryMember
private boolean transient_; // 'transient' is a reserved word
private boolean public_; // 'public' is a reserved word
private boolean static_; // 'static' is a reserved word
- boolean protected_; // 'protected' is a reserved word
+ private boolean protected_; // 'protected' is a reserved word
// ********** construction/initialization **********
@@ -273,7 +273,7 @@ abstract class BinaryMember
}
public boolean isPublicOrProtected() {
- return isPublic() || isProtected();
+ return this.isPublic() || this.isProtected();
}
// ********** IMember adapter **********
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java
index c1bc7414c6..33c4f9de52 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java
@@ -193,7 +193,7 @@ final class BinaryType
// ***** public/protected no-arg constructor *****
public boolean hasPublicOrProtectedNoArgConstructor() {
- Iterable<JavaResourceMethod> constructors = getConstructors();
+ Iterable<JavaResourceMethod> constructors = this.getConstructors();
if (CollectionTools.size(constructors) == 0) {
return true;
}
@@ -207,7 +207,7 @@ final class BinaryType
}
public boolean hasPublicNoArgConstructor() {
- Iterable<JavaResourceMethod> constructors = getConstructors();
+ Iterable<JavaResourceMethod> constructors = this.getConstructors();
if (CollectionTools.size(constructors) == 0) {
return true;
}
@@ -220,10 +220,10 @@ final class BinaryType
}
protected Iterable<JavaResourceMethod> getConstructors() {
- return new FilteringIterable<JavaResourceMethod>(getMethods()) {
+ return new FilteringIterable<JavaResourceMethod>(this.getMethods()) {
@Override
- protected boolean accept(JavaResourceMethod o) {
- return o.isConstructor();
+ protected boolean accept(JavaResourceMethod method) {
+ return method.isConstructor();
}
};
}
@@ -260,7 +260,7 @@ final class BinaryType
// Both requirements are validated by the compiler so they are excluded here
public boolean hasEqualsMethod() {
for (JavaResourceMethod method : this.getMethods()) {
- if (StringTools.stringsAreEqual(method.getMethodName(), "equals")
+ if (StringTools.stringsAreEqual(method.getMethodName(), "equals") //$NON-NLS-1$
&& method.getParametersSize() == 1
&& StringTools.stringsAreEqual(method.getParameterTypeName(0), Object.class.getName())) {
return true;
@@ -275,7 +275,7 @@ final class BinaryType
// Both requirements are validated by the compiler so they are excluded here
public boolean hasHashCodeMethod() {
for (JavaResourceMethod method : this.getMethods()) {
- if (StringTools.stringsAreEqual(method.getMethodName(), "hashCode")
+ if (StringTools.stringsAreEqual(method.getMethodName(), "hashCode") //$NON-NLS-1$
&& method.getParametersSize() == 0) {
return true;
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceCompilationUnit.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceCompilationUnit.java
index 57c43e85dd..bf69665e48 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceCompilationUnit.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceCompilationUnit.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -19,7 +19,7 @@ import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
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.command.CommandExecutor;
import org.eclipse.jpt.common.utility.internal.ListenerList;
/**
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceMember.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceMember.java
index 7ecfef3165..694c3af5ab 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceMember.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceMember.java
@@ -195,7 +195,6 @@ abstract class SourceMember<M extends Member>
}
public boolean isPublicOrProtected() {
- return isPublic() || isProtected();
+ return this.isPublic() || this.isProtected();
}
-
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java
index 3ea302a474..0ee2aae4a1 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java
@@ -1,13 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 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
- ******************************************************************************/
+ * Copyright (c) 2010, 2012 Red Hat, 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.common.core.internal.resource.java.source;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -20,7 +19,7 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.core.resource.java.JavaResourcePackage;
import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageInfoCompilationUnit;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.jpt.common.utility.CommandExecutor;
+import org.eclipse.jpt.common.utility.command.CommandExecutor;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
/**
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java
index c2769e6e5d..f28e79420e 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java
@@ -281,7 +281,7 @@ final class SourceType
}
public boolean hasPublicNoArgConstructor() {
- Iterable<JavaResourceMethod> constructors = getConstructors();
+ Iterable<JavaResourceMethod> constructors = this.getConstructors();
if (CollectionTools.size(constructors) == 0) {
return true;
}
@@ -294,10 +294,10 @@ final class SourceType
}
protected Iterable<JavaResourceMethod> getConstructors() {
- return new FilteringIterable<JavaResourceMethod>(getMethods()) {
+ return new FilteringIterable<JavaResourceMethod>(this.getMethods()) {
@Override
- protected boolean accept(JavaResourceMethod o) {
- return o.isConstructor();
+ protected boolean accept(JavaResourceMethod method) {
+ return method.isConstructor();
}
};
}
@@ -578,7 +578,7 @@ final class SourceType
// Both requirements are validated by the compiler so they are excluded here
public boolean hasEqualsMethod() {
for (JavaResourceMethod method : this.getMethods()) {
- if (StringTools.stringsAreEqual(method.getMethodName(), "equals")
+ if (StringTools.stringsAreEqual(method.getMethodName(), "equals") //$NON-NLS-1$
&& method.getParametersSize() == 1
&& StringTools.stringsAreEqual(method.getParameterTypeName(0), Object.class.getName())) {
return true;
@@ -593,7 +593,7 @@ final class SourceType
// Both requirements are validated by the compiler so they are excluded here
public boolean hasHashCodeMethod() {
for (JavaResourceMethod method : this.getMethods()) {
- if (StringTools.stringsAreEqual(method.getMethodName(), "hashCode")
+ if (StringTools.stringsAreEqual(method.getMethodName(), "hashCode") //$NON-NLS-1$
&& method.getParametersSize() == 0) {
return true;
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceTypeCompilationUnit.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceTypeCompilationUnit.java
index fc1f76eb08..bf5333f91d 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceTypeCompilationUnit.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceTypeCompilationUnit.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -21,7 +21,7 @@ import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.jpt.common.utility.CommandExecutor;
+import org.eclipse.jpt.common.utility.command.CommandExecutor;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
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
index 38a4cda80f..947d027e5e 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -12,6 +12,7 @@ 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.core.utility.command.JobCommand;
import org.eclipse.jpt.common.utility.internal.ListenerList;
import org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer;
@@ -148,7 +149,5 @@ public class CallbackJobSynchronizer
this.scheduled = false;
super.stop();
}
-
}
-
}
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
index 2ab0283e5a..768e8e01e6 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -13,6 +13,7 @@ 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.core.utility.command.JobCommand;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.synchronizers.Synchronizer;
@@ -104,7 +105,9 @@ public class JobSynchronizer
* 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 {
+ static class SynchronizationJob
+ extends Job
+ {
/**
* The client-supplied job command that executes every time the job
* runs.
@@ -192,7 +195,5 @@ public class JobSynchronizer
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
index 44183a9b68..462ccd18c3 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/PlatformTools.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/PlatformTools.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -27,7 +27,15 @@ import org.eclipse.jpt.common.core.JptCommonCorePlugin;
* A collection of utilities for dealing with the Eclipse platform API.
*/
public class PlatformTools {
-
+ /**
+ * Add some Generic Goodness to the method signature.
+ * @see org.eclipse.core.runtime.IAdapterManager#getAdapter(Object, Class)
+ */
+ @SuppressWarnings("unchecked")
+ public static <A> A getAdapter(Object o, Class<A> adapterType) {
+ return (A) Platform.getAdapterManager().getAdapter(o, adapterType);
+ }
+
/**
* Return the {@link IContainer} with the workspace relative "full" path
*/
@@ -66,7 +74,7 @@ public class PlatformTools {
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
+ // e.g. we get a FNFE if the workspace is out of sync with the O/S file system
// JptCorePlugin.log(ex);
// look for content type based on the file name only(?)
@@ -104,5 +112,4 @@ public class 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
index 04d8a24d15..ca5915ac96 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,6 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.common.core.internal.utility;
+import java.io.Serializable;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jpt.common.utility.internal.StringTools;
@@ -16,8 +17,10 @@ import org.eclipse.jpt.common.utility.internal.StringTools;
* A job scheduling rule that conflicts only with itself.
*/
public final class SimpleSchedulingRule
- implements ISchedulingRule
+ implements ISchedulingRule, Serializable
{
+ private static final long serialVersionUID = 1L;
+
public SimpleSchedulingRule() {
super();
}
@@ -34,5 +37,4 @@ public final class SimpleSchedulingRule
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/command/AbstractSingleUseQueueingJobCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/AbstractSingleUseQueueingJobCommandExecutor.java
new file mode 100644
index 0000000000..ef298557aa
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/AbstractSingleUseQueueingJobCommandExecutor.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.internal.utility.command;
+
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jpt.common.core.utility.command.CombinedCommandExecutor;
+import org.eclipse.jpt.common.core.utility.command.JobCommand;
+import org.eclipse.jpt.common.utility.command.Command;
+import org.eclipse.jpt.common.utility.command.StatefulCommandExecutor;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.command.AbstractSingleUseQueueingCommandExecutor;
+
+/**
+ * This job command executor wraps and extends an
+ * {@link AbstractSingleUseQueueingCommandExecutor},
+ * adding support for executing {@link JobCommand}s.
+ * <p>
+ * <strong>NB:</strong> This executor <em>ignores</em> any
+ * {@link ISchedulingRule scheduling rules}.
+ */
+public abstract class AbstractSingleUseQueueingJobCommandExecutor<E1 extends AbstractSingleUseQueueingCommandExecutor<E2>, E2 extends StatefulCommandExecutor>
+ implements CombinedCommandExecutor, StatefulCommandExecutor
+{
+ /**
+ * Since the {@link JobCommand}s are simply converted into {@link Command}s,
+ * we can delegate to an {@link AbstractSingleUseQueueingCommandExecutor}.
+ */
+ protected final E1 commandExecutor;
+
+
+ protected AbstractSingleUseQueueingJobCommandExecutor(E1 commandExecutor) {
+ super();
+ this.commandExecutor = commandExecutor;
+ }
+
+ /**
+ * @see AbstractSingleUseQueueingCommandExecutor#start()
+ */
+ public void start() {
+ this.commandExecutor.start();
+ }
+
+ /**
+ * @see AbstractSingleUseQueueingCommandExecutor#execute(Command)
+ */
+ public void execute(Command command) {
+ this.commandExecutor.execute(command);
+ }
+
+ /**
+ * @see AbstractSingleUseQueueingCommandExecutor#execute(Command)
+ */
+ public void execute(JobCommand command) {
+ this.commandExecutor.execute(new JobCommandCommandAdapter(command));
+ }
+
+ /**
+ * @see AbstractSingleUseQueueingCommandExecutor#execute(Command)
+ */
+ public void execute(JobCommand command, String jobName) {
+ // ignore 'jobName'
+ this.commandExecutor.execute(new JobCommandCommandAdapter(command));
+ }
+
+ /**
+ * @see AbstractSingleUseQueueingCommandExecutor#execute(Command)
+ */
+ public void execute(JobCommand command, String jobName, ISchedulingRule rule) {
+ // ignore 'jobName' and 'rule'
+ this.commandExecutor.execute(new JobCommandCommandAdapter(command));
+ }
+
+ /**
+ * @see AbstractSingleUseQueueingCommandExecutor#suspend()
+ */
+ public void suspend() {
+ this.commandExecutor.suspend();
+ }
+
+ /**
+ * @see AbstractSingleUseQueueingCommandExecutor#resume()
+ */
+ public void resume() {
+ this.commandExecutor.resume();
+ }
+
+ /**
+ * @see AbstractSingleUseQueueingCommandExecutor#stop()
+ */
+ public void stop() throws InterruptedException {
+ this.commandExecutor.stop();
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.commandExecutor);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/CommandJobCommandAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/CommandJobCommandAdapter.java
new file mode 100644
index 0000000000..97c52316e3
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/CommandJobCommandAdapter.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.internal.utility.command;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jpt.common.core.utility.command.JobCommand;
+import org.eclipse.jpt.common.utility.command.Command;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * Adapt a {@link Command} to the {@link JobCommand} interface.
+ * Necessarily, the progress monitor is ignored and a status of
+ * OK is returned.
+ */
+public class CommandJobCommandAdapter
+ implements JobCommand
+{
+ private final Command command;
+
+
+ public CommandJobCommandAdapter(Command command) {
+ super();
+ if (command == null) {
+ throw new NullPointerException();
+ }
+ this.command = command;
+ }
+
+ public IStatus execute(IProgressMonitor monitor) {
+ this.command.execute();
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.command);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/JobCommandCommandAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/JobCommandCommandAdapter.java
new file mode 100644
index 0000000000..ac69a5b03b
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/JobCommandCommandAdapter.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.internal.utility.command;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jpt.common.core.utility.command.JobCommand;
+import org.eclipse.jpt.common.utility.command.Command;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * Adapt a {@link JobCommand} to the {@link Command} interface.
+ * Necessarily passing in a <em>null</em> progress monitor
+ * and ignoring the returned status.
+ */
+public class JobCommandCommandAdapter
+ implements Command
+{
+ private final JobCommand jobCommand;
+
+
+ public JobCommandCommandAdapter(JobCommand jobCommand) {
+ super();
+ if (jobCommand == null) {
+ throw new NullPointerException();
+ }
+ this.jobCommand = jobCommand;
+ }
+
+ public void execute() {
+ this.jobCommand.execute(new NullProgressMonitor());
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.jobCommand);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/JobCommandJob.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/JobCommandJob.java
new file mode 100644
index 0000000000..70318e1df2
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/JobCommandJob.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.internal.utility.command;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jpt.common.core.utility.command.JobCommand;
+import org.eclipse.jpt.common.utility.command.Command;
+
+/**
+ * A job that executes a {@link JobCommand job command} or
+ * {@link Command command}.
+ */
+public class JobCommandJob
+ extends Job
+{
+ private final JobCommand command;
+
+
+ public JobCommandJob(String name, Command command) {
+ this(name, new CommandJobCommandAdapter(command));
+ }
+
+ public JobCommandJob(String name, JobCommand command) {
+ super(name);
+ if (command == null) {
+ throw new NullPointerException();
+ }
+ this.command = command;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ return this.command.execute(monitor);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/NotifyingRepeatingJobCommandWrapper.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/NotifyingRepeatingJobCommandWrapper.java
new file mode 100644
index 0000000000..1e49f6b18f
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/NotifyingRepeatingJobCommandWrapper.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.internal.utility.command;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jpt.common.core.utility.command.NotifyingRepeatingJobCommand;
+import org.eclipse.jpt.common.core.utility.command.JobCommand;
+import org.eclipse.jpt.common.core.utility.command.JobCommandExecutor;
+import org.eclipse.jpt.common.utility.ExceptionHandler;
+import org.eclipse.jpt.common.utility.internal.ListenerList;
+
+/**
+ * @see org.eclipse.jpt.common.utility.internal.command.NotifyingRepeatingCommandWrapper
+ */
+public class NotifyingRepeatingJobCommandWrapper
+ extends RepeatingJobCommandWrapper
+ implements NotifyingRepeatingJobCommand
+{
+ private final ListenerList<Listener> listenerList = new ListenerList<Listener>(Listener.class);
+
+
+ // ********** construction **********
+
+ /**
+ * Construct a notifying repeating command wrapper that executes the
+ * specified command. Any exceptions thrown by the command or listener
+ * will be handled by the specified exception handler.
+ */
+ public NotifyingRepeatingJobCommandWrapper(JobCommand command, ExceptionHandler exceptionHandler) {
+ super(command, exceptionHandler);
+ }
+
+ /**
+ * Construct a notifying repeating command wrapper that executes the
+ * specified command and uses the specified command executor to execute the
+ * wrapped command whenever it is not already executing.
+ * Any exceptions thrown by the command or listener will be handled by the
+ * specified exception handler.
+ */
+ public NotifyingRepeatingJobCommandWrapper(JobCommand command, JobCommandExecutor startCommandExecutor, ExceptionHandler exceptionHandler) {
+ super(command, startCommandExecutor, exceptionHandler);
+ }
+
+
+ // ********** listeners **********
+
+ public void addListener(Listener listener) {
+ this.listenerList.add(listener);
+ }
+
+ public void removeListener(Listener listener) {
+ this.listenerList.remove(listener);
+ }
+
+
+ // ********** override **********
+
+ @Override
+ /* private protected */ IStatus executeCommand(IProgressMonitor monitor) {
+ IStatus status = super.executeCommand(monitor);
+ if (this.state.isQuiesced()) {
+ // hmmm - we will notify listeners even when we are "stopped"; that seems OK...
+ this.executionQuiesced(monitor);
+ }
+ return status;
+ }
+
+ /**
+ * Notify our listeners.
+ */
+ private void executionQuiesced(IProgressMonitor monitor) {
+ for (Listener listener : this.listenerList.getListeners()) {
+ this.notifyListener(listener, monitor);
+ }
+ }
+
+ private void notifyListener(Listener listener, IProgressMonitor monitor) {
+ try {
+ listener.executionQuiesced(this, monitor);
+ } catch (OperationCanceledException ex) {
+ throw ex; // seems reasonable...
+ } catch (Throwable ex) {
+ this.exceptionHandler.handleException(ex);
+ }
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/RepeatingJobCommandWrapper.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/RepeatingJobCommandWrapper.java
new file mode 100644
index 0000000000..8fee7f6366
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/RepeatingJobCommandWrapper.java
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.internal.utility.command;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jpt.common.core.utility.command.JobCommand;
+import org.eclipse.jpt.common.core.utility.command.JobCommandExecutor;
+import org.eclipse.jpt.common.core.utility.command.RepeatingJobCommand;
+import org.eclipse.jpt.common.utility.ExceptionHandler;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.command.RepeatingCommandState;
+
+/**
+ * Wrap a repeating {@link JobCommand}.
+ * <p>
+ * <strong>NB:</strong> The {@link IProgressMonitor progress monitor} passed to
+ * the job command wrapper is <em>ignored</em>. The {@link IProgressMonitor
+ * progress monitor} passed to the <em>wrapped</em> job command is determined by
+ * the {@link #startCommandExecutor start command executor}. That same
+ * {@link IProgressMonitor progress monitor} is passed to the <em>wrapped</em>
+ * job command for every execution during an execution "cycle". It is
+ * <em>not</em> reset with each execution; so several
+ * executions may take place before a new progress monitor is passed to the
+ * command.
+ * @see org.eclipse.jpt.common.utility.internal.command.RepeatingCommandWrapper
+ */
+public class RepeatingJobCommandWrapper
+ implements RepeatingJobCommand
+{
+ /**
+ * The client-supplied command that performs the execution. It may
+ * trigger further calls to {@link #execute(IProgressMonitor)}
+ * (i.e. the <em>wrapped</em>
+ * command's execution may recurse back to the client code that executes the
+ * <em>wrapper</em> command).
+ */
+ /* CU private */ final JobCommand command;
+
+ /**
+ * The command executed whenever the wrapped {@link #command} must be
+ * executed and it is not already executing. If the wrapped {@link #command}
+ * is already executing, it will simply be re-executed directly (once it has
+ * completed its current execution), as opposed to calling the start
+ * command.
+ */
+ private final JobCommand startCommand;
+
+ /**
+ * The client-supplied command executor that provides the context for the
+ * {@link #startCommand start command}. By default, the start command is
+ * executed directly; but this executor provides a hook for executing the
+ * {@link #startCommand start command} asynchronously; after which,
+ * subsequent overlapping executions are executed synchronously.
+ */
+ private final JobCommandExecutor startCommandExecutor;
+
+ /**
+ * This handles the exceptions thrown by the <em>wrapped</em> command.
+ */
+ final ExceptionHandler exceptionHandler;
+
+ /**
+ * The command wrapper's state.
+ */
+ final RepeatingCommandState state;
+
+
+ // ********** construction **********
+
+ /**
+ * Construct a repeating command wrapper that executes the specified
+ * command. Any exceptions thrown by the command will be handled by the
+ * specified exception handler.
+ */
+ public RepeatingJobCommandWrapper(JobCommand command, ExceptionHandler exceptionHandler) {
+ this(command, JobCommandExecutor.Default.instance(), exceptionHandler);
+ }
+
+ /**
+ * Construct a repeating command wrapper that executes the specified
+ * command and uses the specified command executor to execute the wrapped
+ * command whenever it is not already executing.
+ * Any exceptions thrown by the command will be handled by the
+ * specified exception handler.
+ */
+ public RepeatingJobCommandWrapper(JobCommand command, JobCommandExecutor startCommandExecutor, ExceptionHandler exceptionHandler) {
+ super();
+ if ((command == null) || (startCommandExecutor == null) || (exceptionHandler == null)) {
+ throw new NullPointerException();
+ }
+ this.command = command;
+ this.startCommandExecutor = startCommandExecutor;
+ this.startCommand = this.buildStartJobCommand();
+ this.exceptionHandler = exceptionHandler;
+ this.state = this.buildState();
+ }
+
+ private JobCommand buildStartJobCommand() {
+ return new StartJobCommand();
+ }
+
+ private RepeatingCommandState buildState() {
+ return new RepeatingCommandState();
+ }
+
+
+ // ********** RepeatingJobCommand implementation **********
+
+ public void start() {
+ this.state.start();
+ }
+
+ /**
+ * It is possible to come back here if the wrapped command recurses
+ * to the client and triggers another execution.
+ */
+ // pretty sure no need for this method to be 'synchronized'
+ public IStatus execute(IProgressMonitor monitor) {
+ if (this.state.isReadyToStartExecutionCycle()) {
+ this.startCommandExecutor.execute(this.startCommand);
+ }
+ return Status.OK_STATUS;
+ }
+
+ public void stop() throws InterruptedException {
+ this.state.stop();
+ }
+
+ /**
+ * The start command.
+ * @see #startCommandExecutor
+ */
+ /* CU private */ class StartJobCommand
+ implements JobCommand
+ {
+ public IStatus execute(IProgressMonitor monitor) {
+ return RepeatingJobCommandWrapper.this.execute_(monitor);
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, RepeatingJobCommandWrapper.this.command);
+ }
+ }
+
+ /**
+ * This method will be called only once per execution cycle.
+ * Any further calls to {@link #execute(IProgressMonitor)} will
+ * simply set the {@link #state} to "repeat",
+ * causing the command to execute again.
+ */
+ /* CU private */ IStatus execute_(IProgressMonitor monitor) {
+ if (this.state.wasStoppedBeforeFirstExecutionCouldStart()) {
+ return Status.OK_STATUS;
+ }
+
+ do {
+ IStatus status = this.executeCommand(monitor);
+ if (status.getSeverity() == IStatus.CANCEL) {
+ return status; // seems reasonable...
+ }
+ } while (this.state.isRepeat());
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Execute the client-supplied command. Do not allow any unhandled
+ * exceptions to kill the wrapper. Pass to the exception handler.
+ * @see NotifyingRepeatingJobCommandWrapper
+ */
+ /* private protected */ IStatus executeCommand(IProgressMonitor monitor) {
+ try {
+ return this.command.execute(monitor);
+ } catch (OperationCanceledException ex) {
+ return Status.CANCEL_STATUS; // seems reasonable...
+ } catch (Throwable ex) {
+ this.exceptionHandler.handleException(ex);
+ return Status.OK_STATUS;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.command);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/SimpleJobCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/SimpleJobCommandExecutor.java
new file mode 100644
index 0000000000..96c858b752
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/SimpleJobCommandExecutor.java
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.internal.utility.command;
+
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jpt.common.core.utility.command.CombinedExtendedCommandExecutor;
+import org.eclipse.jpt.common.core.utility.command.JobCommand;
+import org.eclipse.jpt.common.utility.command.Command;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.SynchronizedBoolean;
+
+/**
+ * A command executor that schedules a {@link org.eclipse.core.runtime.jobs.Job
+ * job} to [asynchronously] execute each {@link JobCommand job command} or
+ * {@link Command command}.
+ * Synchronous command executions are coordinated with the job via a
+ * {@link LocalJobChangeListener job listener}.
+ */
+public class SimpleJobCommandExecutor
+ implements CombinedExtendedCommandExecutor
+{
+ private final String defaultJobName;
+ private final ISchedulingRule defaultJobSchedulingRule;
+
+
+ /**
+ * Construct a job command executor with no default job name and no
+ * default scheduling rule.
+ */
+ public SimpleJobCommandExecutor() {
+ this(null);
+ }
+
+ /**
+ * Construct a job command executor with the specified default job name and
+ * no default scheduling rule.
+ */
+ public SimpleJobCommandExecutor(String defaultJobName) {
+ this(defaultJobName, null);
+ }
+
+ /**
+ * Construct a job command executor with the specified default job name and
+ * default scheduling rule.
+ */
+ public SimpleJobCommandExecutor(String defaultJobName, ISchedulingRule defaultJobSchedulingRule) {
+ super();
+ this.defaultJobName = defaultJobName;
+ this.defaultJobSchedulingRule = defaultJobSchedulingRule;
+ }
+
+ public void execute(Command command) {
+ this.execute(new CommandJobCommandAdapter(command));
+ }
+
+ public void waitToExecute(Command command) throws InterruptedException {
+ this.waitToExecute(new CommandJobCommandAdapter(command));
+ }
+
+ public boolean waitToExecute(Command command, long timeout) throws InterruptedException {
+ return this.waitToExecute(new CommandJobCommandAdapter(command), timeout);
+ }
+
+ /**
+ * Assign the resulting {@link Job} the default name and scheduling rule.
+ */
+ public void execute(JobCommand command) {
+ this.execute(command, null);
+ }
+
+ /**
+ * Assign the resulting {@link Job} the default scheduling rule.
+ */
+ public void execute(JobCommand command, String jobName) {
+ this.execute(command, jobName, this.defaultJobSchedulingRule);
+ }
+
+ public void execute(JobCommand command, String jobName, ISchedulingRule rule) {
+ this.execute_(command, this.buildJobName(jobName, command), rule);
+ }
+
+ /**
+ * Pre-condition: the job name must not be <code>null</code>.
+ */
+ private void execute_(JobCommand command, String jobName, ISchedulingRule rule) {
+ Job job = new JobCommandJob(jobName, command);
+ job.setRule(rule);
+ job.schedule();
+ }
+
+ /**
+ * Assign the resulting {@link Job} the default name and scheduling rule.
+ */
+ public void waitToExecute(JobCommand command) throws InterruptedException {
+ this.waitToExecute(command, null);
+ }
+
+ /**
+ * Assign the resulting {@link Job} the default name and scheduling rule.
+ */
+ public boolean waitToExecute(JobCommand command, long timeout) throws InterruptedException {
+ return this.waitToExecute(command, null, timeout);
+ }
+
+ /**
+ * Assign the resulting {@link Job} the specified name and the default
+ * scheduling rule.
+ */
+ public void waitToExecute(JobCommand command, String jobName) throws InterruptedException {
+ this.waitToExecute(command, jobName, this.defaultJobSchedulingRule);
+ }
+
+ /**
+ * Assign the resulting {@link Job} the specified name and the default
+ * scheduling rule.
+ */
+ public boolean waitToExecute(JobCommand command, String jobName, long timeout) throws InterruptedException {
+ return this.waitToExecute(command, jobName, this.defaultJobSchedulingRule, timeout);
+ }
+
+ /**
+ * Assign the resulting {@link Job} the specified name and scheduling rule.
+ */
+ public void waitToExecute(JobCommand command, String jobName, ISchedulingRule rule) throws InterruptedException {
+ this.waitToExecute_(command, this.buildJobName(jobName, command), rule, 0);
+ }
+
+ /**
+ * Assign the resulting {@link Job} the specified name and scheduling rule.
+ */
+ public boolean waitToExecute(JobCommand command, String jobName, ISchedulingRule rule, long timeout) throws InterruptedException {
+ return this.waitToExecute_(command, this.buildJobName(jobName, command), rule, timeout);
+ }
+
+ /**
+ * Pre-condition: the job name must not be <code>null</code>.
+ * <p>
+ * Schedule a job that will notify us when it is finished.
+ * The current thread will suspend until the job is finished.
+ */
+ private boolean waitToExecute_(JobCommand command, String jobName, ISchedulingRule rule, long timeout) throws InterruptedException {
+ if ((timeout == 0L) && Job.getJobManager().isSuspended()) {
+ // the job manager is suspended during workbench start-up;
+ // so this method will lock up accordingly, which is not a Good Thing
+ // if it is called from the Eclipse Main thread during start-up
+ // (i.e. deadlock!)
+ return false;
+ }
+
+ Job job = new JobCommandJob(jobName, command);
+ LocalJobChangeListener listener = new LocalJobChangeListener();
+ job.addJobChangeListener(listener);
+ job.setRule(rule);
+ job.schedule();
+ try {
+ return listener.waitUntilDone(timeout);
+ } finally {
+ job.removeJobChangeListener(listener);
+ }
+ }
+
+ private String buildJobName(String jobName, Object command) {
+ if (jobName != null) {
+ return jobName;
+ }
+ if (this.defaultJobName != null) {
+ return this.defaultJobName;
+ }
+ return StringTools.buildToStringClassName(command.getClass());
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+
+
+ // ********** job listener **********
+
+ /**
+ * This job listener notifies any interested threads when the
+ * {@link Job job} is done.
+ */
+ /* CU private */ class LocalJobChangeListener
+ extends JobChangeAdapter
+ {
+ private final SynchronizedBoolean done = new SynchronizedBoolean(false);
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ super.done(event);
+ this.done.setTrue();
+ }
+
+ boolean waitUntilDone(long timeout) throws InterruptedException {
+ return this.done.waitUntilTrue(timeout);
+ }
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/SingleUseQueueingExtendedJobCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/SingleUseQueueingExtendedJobCommandExecutor.java
new file mode 100644
index 0000000000..5957e3e4b4
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/SingleUseQueueingExtendedJobCommandExecutor.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.internal.utility.command;
+
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jpt.common.core.utility.command.CombinedExtendedCommandExecutor;
+import org.eclipse.jpt.common.core.utility.command.JobCommand;
+import org.eclipse.jpt.common.utility.command.Command;
+import org.eclipse.jpt.common.utility.command.ExtendedCommandExecutor;
+import org.eclipse.jpt.common.utility.command.StatefulExtendedCommandExecutor;
+import org.eclipse.jpt.common.utility.internal.command.SingleUseQueueingExtendedCommandExecutor;
+
+/**
+ * This command executor wraps and extends a {@link SingleUseQueueingExtendedCommandExecutor},
+ * adding support for executing {@link JobCommand}s.
+ */
+public class SingleUseQueueingExtendedJobCommandExecutor
+ extends AbstractSingleUseQueueingJobCommandExecutor<SingleUseQueueingExtendedCommandExecutor, StatefulExtendedCommandExecutor>
+ implements CombinedExtendedCommandExecutor, StatefulExtendedCommandExecutor
+{
+ public SingleUseQueueingExtendedJobCommandExecutor() {
+ this(new SingleUseQueueingExtendedCommandExecutor());
+ }
+
+ public SingleUseQueueingExtendedJobCommandExecutor(ExtendedCommandExecutor commandExecutor) {
+ this(new SingleUseQueueingExtendedCommandExecutor(commandExecutor));
+ }
+
+ public SingleUseQueueingExtendedJobCommandExecutor(StatefulExtendedCommandExecutor commandExecutor) {
+ this(new SingleUseQueueingExtendedCommandExecutor(commandExecutor));
+ }
+
+ public SingleUseQueueingExtendedJobCommandExecutor(SingleUseQueueingExtendedCommandExecutor commandExecutor) {
+ super(commandExecutor);
+ }
+
+ /**
+ * @see SingleUseQueueingExtendedCommandExecutor#waitToExecute(Command)
+ */
+ public void waitToExecute(Command command) throws InterruptedException {
+ this.commandExecutor.waitToExecute(command);
+ }
+
+ /**
+ * @see SingleUseQueueingExtendedCommandExecutor#waitToExecute(Command, long)
+ */
+ public boolean waitToExecute(Command command, long timeout) throws InterruptedException {
+ return this.commandExecutor.waitToExecute(command, timeout);
+ }
+
+ /**
+ * @see SingleUseQueueingExtendedCommandExecutor#waitToExecute(Command)
+ */
+ public void waitToExecute(JobCommand command) throws InterruptedException {
+ this.commandExecutor.waitToExecute(new JobCommandCommandAdapter(command));
+ }
+
+ /**
+ * @see SingleUseQueueingExtendedCommandExecutor#waitToExecute(Command, long)
+ */
+ public boolean waitToExecute(JobCommand command, long timeout) throws InterruptedException {
+ return this.commandExecutor.waitToExecute(new JobCommandCommandAdapter(command), timeout);
+ }
+
+ /**
+ * @see SingleUseQueueingExtendedCommandExecutor#waitToExecute(Command)
+ */
+ public void waitToExecute(JobCommand command, String jobName) throws InterruptedException {
+ // ignore 'jobName'
+ this.commandExecutor.waitToExecute(new JobCommandCommandAdapter(command));
+ }
+
+ /**
+ * @see SingleUseQueueingExtendedCommandExecutor#waitToExecute(Command, long)
+ */
+ public boolean waitToExecute(JobCommand command, String jobName, long timeout) throws InterruptedException {
+ // ignore 'jobName'
+ return this.commandExecutor.waitToExecute(new JobCommandCommandAdapter(command), timeout);
+ }
+
+ /**
+ * @see SingleUseQueueingExtendedCommandExecutor#waitToExecute(Command)
+ */
+ public void waitToExecute(JobCommand command, String jobName, ISchedulingRule rule) throws InterruptedException {
+ // ignore 'jobName' and 'rule'
+ this.commandExecutor.waitToExecute(new JobCommandCommandAdapter(command));
+ }
+
+ /**
+ * @see SingleUseQueueingExtendedCommandExecutor#waitToExecute(Command, long)
+ */
+ public boolean waitToExecute(JobCommand command, String jobName, ISchedulingRule rule, long timeout) throws InterruptedException {
+ // ignore 'jobName' and 'rule'
+ return this.commandExecutor.waitToExecute(new JobCommandCommandAdapter(command), timeout);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/SingleUseQueueingJobCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/SingleUseQueueingJobCommandExecutor.java
new file mode 100644
index 0000000000..3b25de6625
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/SingleUseQueueingJobCommandExecutor.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.internal.utility.command;
+
+import org.eclipse.jpt.common.core.utility.command.JobCommand;
+import org.eclipse.jpt.common.utility.command.CommandExecutor;
+import org.eclipse.jpt.common.utility.command.StatefulCommandExecutor;
+import org.eclipse.jpt.common.utility.internal.command.SingleUseQueueingCommandExecutor;
+
+/**
+ * This command executor wraps and extends a {@link SingleUseQueueingCommandExecutor},
+ * adding support for executing {@link JobCommand}s.
+ */
+public class SingleUseQueueingJobCommandExecutor
+ extends AbstractSingleUseQueueingJobCommandExecutor<SingleUseQueueingCommandExecutor, StatefulCommandExecutor>
+{
+ public SingleUseQueueingJobCommandExecutor() {
+ this(new SingleUseQueueingCommandExecutor());
+ }
+
+ public SingleUseQueueingJobCommandExecutor(CommandExecutor commandExecutor) {
+ this(new SingleUseQueueingCommandExecutor(commandExecutor));
+ }
+
+ public SingleUseQueueingJobCommandExecutor(StatefulCommandExecutor commandExecutor) {
+ this(new SingleUseQueueingCommandExecutor(commandExecutor));
+ }
+
+ public SingleUseQueueingJobCommandExecutor(SingleUseQueueingCommandExecutor commandExecutor) {
+ super(commandExecutor);
+ }
+}
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
index 48ac9b202a..9a264f76d2 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -23,7 +23,7 @@ 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;
+import org.eclipse.jpt.common.utility.command.CommandExecutor;
/**
* Adapt and extend a JDT abstract type.
@@ -196,5 +196,4 @@ public abstract class AbstractJDTType
protected static List<BodyDeclaration> 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/JDTAnnotatedElement.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTAnnotatedElement.java
index c771c77ce5..85171fede1 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -21,8 +21,8 @@ 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.command.Command;
+import org.eclipse.jpt.common.utility.command.CommandExecutor;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.text.edits.MalformedTreeException;
import org.eclipse.text.edits.TextEdit;
@@ -176,7 +176,9 @@ public abstract class JDTAnnotatedElement
* 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 {
+ protected class ModifySharedDocumentCommand
+ implements Command
+ {
private final TextEdit edits;
private final IDocument doc;
@@ -197,5 +199,4 @@ public abstract class JDTAnnotatedElement
}
}
-
}
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
index 53d9bc2c1c..47ed58b777 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -20,7 +20,7 @@ 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;
+import org.eclipse.jpt.common.utility.command.CommandExecutor;
/**
* Adapt and extend a JDT enum.
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
index 6c2714d6e7..ea3529597d 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -19,7 +19,7 @@ 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;
+import org.eclipse.jpt.common.utility.command.CommandExecutor;
/**
* Adapt and extend a JDT enum constant.
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
index e343cb1596..45668bf042 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -22,7 +22,7 @@ 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;
+import org.eclipse.jpt.common.utility.command.CommandExecutor;
/**
* Adapt and extend a JDT field.
@@ -217,5 +217,4 @@ public class JDTFieldAttribute
}
}
-
}
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
index 35638f0503..609e79756f 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -16,7 +16,7 @@ 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;
+import org.eclipse.jpt.common.utility.command.CommandExecutor;
/**
* Adapt and extend a JDT member with simplified annotation handling.
@@ -86,5 +86,4 @@ public abstract class JDTMember extends JDTAnnotatedElement
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
index 26133ed2cc..17d31b430d 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -22,9 +22,9 @@ 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.command.CommandExecutor;
import org.eclipse.jpt.common.utility.internal.NameTools;
import org.eclipse.jpt.common.utility.internal.SimpleMethodSignature;
@@ -214,7 +214,6 @@ public class JDTMethodAttribute
public boolean isConstructor() {
return this.methodBinding.isConstructor();
}
-
}
protected static class JPTToolsAdapter
@@ -262,7 +261,5 @@ public class JDTMethodAttribute
}
return null;
}
-
}
-
}
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
index 2cef772df9..3057928eaf 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 Red Hat, Inc. All rights reserved.
+ * Copyright (c) 2005, 2012 Red Hat, 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.
@@ -18,7 +18,7 @@ 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;
+import org.eclipse.jpt.common.utility.command.CommandExecutor;
public class JDTPackage
extends JDTAnnotatedElement
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
index 55bef8862a..48d3da117e 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -21,7 +21,7 @@ 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;
+import org.eclipse.jpt.common.utility.command.CommandExecutor;
/**
* Adapt and extend a JDT type.
@@ -157,7 +157,9 @@ public class JDTType
// ********** JPT tools adapter **********
- protected static class JPTToolsAdapter implements JPTTools.TypeAdapter {
+ protected static class JPTToolsAdapter
+ implements JPTTools.TypeAdapter
+ {
private final ITypeBinding typeBinding;
protected JPTToolsAdapter(ITypeBinding typeBinding) {
super();
@@ -203,5 +205,4 @@ public class JDTType
return this.typeBinding.isPrimitive();
}
}
-
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/ProjectResourceLocator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/ProjectResourceLocator.java
new file mode 100644
index 0000000000..00f72fdbae
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/ProjectResourceLocator.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.common.core.resource;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * See <code>org.eclipse.jpt.common.core/plugin.xml</code>.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.2
+ * @since 3.2
+ * @see org.eclipse.jpt.common.core.internal.resource.ProjectAdapterFactory
+ */
+public interface ProjectResourceLocator {
+ /**
+ * Return whether the specified container is an acceptable (non-Java)
+ * resource location for the locator's project.
+ */
+ boolean resourceLocationIsValid(IContainer container);
+
+ /**
+ * Return the default location in which to create new (non-Java) resources.
+ */
+ IContainer getDefaultResourceLocation();
+
+ /**
+ * Return the workspace relative absolute resource path best represented by
+ * the specified runtime path for the locator's project.
+ */
+ IPath getResourcePath(IPath runtimePath);
+
+ /**
+ * Return the runtime path best represented by the specified workspace
+ * relative absolute resource path for the locator's project.
+ */
+ IPath getRuntimePath(IPath resourcePath);
+
+ /**
+ * Return an {@link IFile} that best represents the specified runtime
+ * location.
+ */
+ IFile getPlatformFile(IPath runtimePath);
+}
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
index 491608c147..fcb82ba6c7 100644
--- 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
@@ -1,11 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
+ * Copyright (c) 2010, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.common.core.resource;
@@ -14,6 +14,12 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
/**
+ * Client-defined resource locator.
+ * <p>
+ * See <code>org.eclipse.jpt.common.core/plugin.xml</code>.
+ * <p>
+ * See <code>org.eclipse.jpt.common.core/schema/resourceLocators.exsd</code>.
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
@@ -24,27 +30,26 @@ import org.eclipse.core.runtime.IPath;
* @since 3.0
*/
public interface ResourceLocator {
-
/**
- * Return whether the given container is an acceptable (non-java) resource
- * location for the given project
+ * Return whether the specified container is an acceptable (non-Java)
+ * resource location for the specified project.
*/
- boolean acceptResourceLocation(IProject project, IContainer container);
+ boolean resourceLocationIsValid(IProject project, IContainer container);
/**
- * Return the default location in which to create new (non-java) resources
+ * 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
+ * Return the workspace relative absolute resource path best represented by
+ * the specified runtime path for the specified 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
+ * Return the runtime path best represented by the specified workspace
+ * relative absolute resource path for the specified project.
*/
IPath getRuntimePath(IProject project, IPath resourcePath);
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceCompilationUnit.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceCompilationUnit.java
index 147f717bb4..0a752f4137 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceCompilationUnit.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceCompilationUnit.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -12,11 +12,11 @@ package org.eclipse.jpt.common.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;
+import org.eclipse.jpt.common.utility.command.CommandExecutor;
/**
* Dali resource for JDT compilation unit.
- *
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
@@ -70,5 +70,4 @@ public interface JavaResourceCompilationUnit
* Build an AST for the compilation unit with its bindings resolved.
*/
CompilationUnit buildASTRoot();
-
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceType.java
index d2dd201252..b4f237120c 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceType.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceType.java
@@ -51,12 +51,14 @@ public interface JavaResourceType
String PRIVATE_NO_ARG_CONSTRUCTOR_PROPERTY = "privateNoArgConstructor"; //$NON-NLS-1$
/**
- * Return whether the type has a public or protected no-arg constructor *or* only the default constructor
+ * Return whether the type has a public or protected no-arg constructor
+ * <em>or</em> only the default constructor.
*/
boolean hasPublicOrProtectedNoArgConstructor();
/**
- * Return whether the type has a public or protected no-arg constructor *or* only the default constructor
+ * Return whether the type has a public no-arg constructor
+ * <em>or</em> only the default constructor.
*/
boolean hasPublicNoArgConstructor();
@@ -73,12 +75,14 @@ public interface JavaResourceType
boolean hasAnyAnnotatedMethods();
/**
- * Return whether the type has equals() method
+ * Return whether the type overrides the
+ * {@link Object#equals(Object)} method.
*/
boolean hasEqualsMethod();
/**
- * Return whether the type has hashCode() method
+ * Return whether the type overrides the
+ * {@link Object#hashCode()} method.
*/
boolean hasHashCodeMethod();
@@ -99,5 +103,5 @@ public interface JavaResourceType
Iterable<JavaResourceMethod> getMethods();
String METHODS_COLLECTION = "methods"; //$NON-NLS-1$
- JavaResourceMethod getMethod(String propertyName);
+ JavaResourceMethod getMethod(String name);
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/CombinedCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/CombinedCommandExecutor.java
new file mode 100644
index 0000000000..982911ad1f
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/CombinedCommandExecutor.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.utility.command;
+
+import java.io.Serializable;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jpt.common.utility.command.Command;
+import org.eclipse.jpt.common.utility.command.CommandExecutor;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * Combine the job command executor and command executor interfaces.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface CombinedCommandExecutor
+ extends JobCommandExecutor, CommandExecutor
+{
+ /**
+ * Singleton implementation of the command executor interface
+ * that simply executes the command without any sort of enhancement.
+ */
+ final class Default
+ implements CombinedCommandExecutor, Serializable
+ {
+ public static final CombinedCommandExecutor INSTANCE = new Default();
+ public static CombinedCommandExecutor instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Default() {
+ super();
+ }
+ public void execute(Command command) {
+ command.execute();
+ }
+ public void execute(JobCommand command) {
+ command.execute(new NullProgressMonitor());
+ }
+ public void execute(JobCommand command, String jobName) {
+ this.execute(command);
+ }
+ public void execute(JobCommand command, String jobName, ISchedulingRule schedulingRule) {
+ this.execute(command);
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildSingletonToString(this);
+ }
+ private static final long serialVersionUID = 1L;
+ private Object readResolve() {
+ // replace this object with the singleton
+ return INSTANCE;
+ }
+ }
+
+
+ /**
+ * Singleton implementation of the command executor interface
+ * that ignores any commands.
+ */
+ final class Inactive
+ implements CombinedCommandExecutor, Serializable
+ {
+ public static final CombinedCommandExecutor INSTANCE = new Inactive();
+ public static CombinedCommandExecutor instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Inactive() {
+ super();
+ }
+ public void execute(Command command) {
+ // do nothing
+ }
+ public void execute(JobCommand command) {
+ // do nothing
+ }
+ public void execute(JobCommand command, String jobName) {
+ // do nothing
+ }
+ public void execute(JobCommand command, String jobName, ISchedulingRule schedulingRule) {
+ // do nothing
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildSingletonToString(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.core/src/org/eclipse/jpt/common/core/utility/command/CombinedExtendedCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/CombinedExtendedCommandExecutor.java
new file mode 100644
index 0000000000..f1a57014b9
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/CombinedExtendedCommandExecutor.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.utility.command;
+
+import java.io.Serializable;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jpt.common.utility.command.Command;
+import org.eclipse.jpt.common.utility.command.ExtendedCommandExecutor;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * Combine the synchronouse job command executor and command executor
+ * interfaces.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface CombinedExtendedCommandExecutor
+ extends CombinedCommandExecutor, ExtendedJobCommandExecutor, ExtendedCommandExecutor
+{
+ /**
+ * Singleton implementation of the command executor interface
+ * that simply executes the command without any sort of enhancement.
+ */
+ final class Default
+ implements CombinedExtendedCommandExecutor, Serializable
+ {
+ public static final CombinedExtendedCommandExecutor INSTANCE = new Default();
+ public static CombinedExtendedCommandExecutor instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Default() {
+ super();
+ }
+ public void execute(Command command) {
+ command.execute();
+ }
+ public void waitToExecute(Command command) {
+ command.execute();
+ }
+ public boolean waitToExecute(Command command, long timeout) {
+ command.execute();
+ return true;
+ }
+ public void execute(JobCommand command) {
+ command.execute(new NullProgressMonitor());
+ }
+ public void execute(JobCommand command, String jobName) {
+ this.execute(command);
+ }
+ public void execute(JobCommand command, String jobName, ISchedulingRule schedulingRule) {
+ this.execute(command);
+ }
+ public void waitToExecute(JobCommand command) {
+ this.execute(command);
+ }
+ public boolean waitToExecute(JobCommand command, long timeout) {
+ this.execute(command);
+ return true;
+ }
+ public void waitToExecute(JobCommand command, String jobName) {
+ this.execute(command);
+ }
+ public boolean waitToExecute(JobCommand command, String jobName, long timeout) {
+ this.execute(command);
+ return true;
+ }
+ public void waitToExecute(JobCommand command, String jobName, ISchedulingRule schedulingRule) {
+ this.execute(command);
+ }
+ public boolean waitToExecute(JobCommand command, String jobName, ISchedulingRule schedulingRule, long timeout) {
+ this.execute(command);
+ return true;
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildSingletonToString(this);
+ }
+ private static final long serialVersionUID = 1L;
+ private Object readResolve() {
+ // replace this object with the singleton
+ return INSTANCE;
+ }
+ }
+
+
+ /**
+ * Singleton implementation of the command executor interface
+ * that ignores any commands.
+ */
+ final class Inactive
+ implements CombinedExtendedCommandExecutor, Serializable
+ {
+ public static final CombinedExtendedCommandExecutor INSTANCE = new Inactive();
+ public static CombinedExtendedCommandExecutor instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Inactive() {
+ super();
+ }
+ public void execute(Command command) {
+ // do nothing
+ }
+ public void waitToExecute(Command command) {
+ // do nothing
+ }
+ public boolean waitToExecute(Command command, long timeout) {
+ // do nothing
+ return true;
+ }
+ public void execute(JobCommand command) {
+ // do nothing
+ }
+ public void execute(JobCommand command, String jobName) {
+ // do nothing
+ }
+ public void execute(JobCommand command, String jobName, ISchedulingRule schedulingRule) {
+ // do nothing
+ }
+ public void waitToExecute(JobCommand command) {
+ // do nothing
+ }
+ public boolean waitToExecute(JobCommand command, long timeout) throws InterruptedException {
+ // do nothing
+ return true;
+ }
+ public void waitToExecute(JobCommand command, String jobName) {
+ // do nothing
+ }
+ public boolean waitToExecute(JobCommand command, String jobName, long timeout) throws InterruptedException {
+ // do nothing
+ return true;
+ }
+ public void waitToExecute(JobCommand command, String jobName, ISchedulingRule schedulingRule) {
+ // do nothing
+ }
+ public boolean waitToExecute(JobCommand command, String jobName, ISchedulingRule schedulingRule, long timeout) throws InterruptedException {
+ // do nothing
+ return true;
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildSingletonToString(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.core/src/org/eclipse/jpt/common/core/utility/command/ExtendedJobCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/ExtendedJobCommandExecutor.java
new file mode 100644
index 0000000000..15c4b5d0a9
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/ExtendedJobCommandExecutor.java
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.utility.command;
+
+import java.io.Serializable;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * This interface extends the normal command executor to allow the client
+ * to control when a command is required to be executed synchronously.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ExtendedJobCommandExecutor
+ extends JobCommandExecutor
+{
+ /**
+ * Suspend the current thread until the specified command is executed.
+ * The command itself must be executed <em>after</em> any other commands
+ * previously passed to the command executor. The command may or may
+ * not be assigned to a {@link org.eclipse.core.runtime.jobs.Job}
+ * for execution.
+ * @see #execute(JobCommand)
+ */
+ void waitToExecute(JobCommand command) throws InterruptedException;
+
+ /**
+ * Suspend the current thread until the specified command is executed
+ * or the specified time-out occurs.
+ * The time-out is specified in milliseconds. Return <code>true</code> if
+ * the command was executed in the allotted time;
+ * return <code>false</code> if a time-out occurred and the command was
+ * <em>not</em> executed.
+ * If the time-out is zero, wait indefinitely.
+ * <p>
+ * The command itself must be executed <em>after</em> any other commands
+ * previously passed to the command executor. The command may or may
+ * not be assigned to a {@link org.eclipse.core.runtime.jobs.Job}
+ * for execution.
+ * @see #execute(JobCommand)
+ */
+ boolean waitToExecute(JobCommand command, long timeout) throws InterruptedException;
+
+ /**
+ * Suspend the current thread until the specified command is executed.
+ * The command itself must be executed <em>after</em> any other commands
+ * previously passed to the command executor. The command may or may
+ * not be assigned to a {@link org.eclipse.core.runtime.jobs.Job}
+ * for execution.
+ * @see #execute(JobCommand, String)
+ */
+ void waitToExecute(JobCommand command, String jobName) throws InterruptedException;
+
+ /**
+ * Suspend the current thread until the specified command is executed
+ * or the specified time-out occurs.
+ * The time-out is specified in milliseconds. Return <code>true</code> if
+ * the command was executed in the allotted time;
+ * return <code>false</code> if a time-out occurred and the command was
+ * <em>not</em> executed.
+ * If the time-out is zero, wait indefinitely.
+ * <p>
+ * The command itself must be executed <em>after</em> any other commands
+ * previously passed to the command executor. The command may or may
+ * not be assigned to a {@link org.eclipse.core.runtime.jobs.Job}
+ * for execution.
+ * @see #execute(JobCommand, String)
+ */
+ boolean waitToExecute(JobCommand command, String jobName, long timeout) throws InterruptedException;
+
+ /**
+ * Suspend the current thread until the specified command is executed.
+ * The command itself must be executed <em>after</em> any other commands
+ * previously passed to the command executor. The command may or may
+ * not be assigned to a {@link org.eclipse.core.runtime.jobs.Job}
+ * for execution.
+ * @see #execute(JobCommand, String, ISchedulingRule)
+ */
+ void waitToExecute(JobCommand command, String jobName, ISchedulingRule schedulingRule) throws InterruptedException;
+
+
+ /**
+ * Suspend the current thread until the specified command is executed
+ * or the specified time-out occurs.
+ * The time-out is specified in milliseconds. Return <code>true</code> if
+ * the command was executed in the allotted time;
+ * return <code>false</code> if a time-out occurred and the command was
+ * <em>not</em> executed.
+ * If the time-out is zero, wait indefinitely.
+ * <p>
+ * The command itself must be executed <em>after</em> any other commands
+ * previously passed to the command executor. The command may or may
+ * not be assigned to a {@link org.eclipse.core.runtime.jobs.Job}
+ * for execution.
+ * @see #execute(JobCommand, String, ISchedulingRule)
+ */
+ boolean waitToExecute(JobCommand command, String jobName, ISchedulingRule schedulingRule, long timeout) throws InterruptedException;
+
+
+ /**
+ * Singleton implementation of the command executor interface
+ * that simply executes the command without any sort of enhancement.
+ */
+ final class Default
+ implements ExtendedJobCommandExecutor, Serializable
+ {
+ public static final ExtendedJobCommandExecutor INSTANCE = new Default();
+ public static ExtendedJobCommandExecutor instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Default() {
+ super();
+ }
+ public void execute(JobCommand command) {
+ command.execute(new NullProgressMonitor());
+ }
+ public void execute(JobCommand command, String jobName) {
+ this.execute(command);
+ }
+ public void execute(JobCommand command, String jobName, ISchedulingRule schedulingRule) {
+ this.execute(command);
+ }
+ public void waitToExecute(JobCommand command) {
+ this.execute(command);
+ }
+ public boolean waitToExecute(JobCommand command, long timeout) {
+ this.execute(command);
+ return true;
+ }
+ public void waitToExecute(JobCommand command, String jobName) {
+ this.execute(command);
+ }
+ public boolean waitToExecute(JobCommand command, String jobName, long timeout) {
+ this.execute(command);
+ return true;
+ }
+ public void waitToExecute(JobCommand command, String jobName, ISchedulingRule schedulingRule) {
+ this.execute(command);
+ }
+ public boolean waitToExecute(JobCommand command, String jobName, ISchedulingRule schedulingRule, long timeout) {
+ this.execute(command);
+ return true;
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildSingletonToString(this);
+ }
+ private static final long serialVersionUID = 1L;
+ private Object readResolve() {
+ // replace this object with the singleton
+ return INSTANCE;
+ }
+ }
+
+
+ /**
+ * Singleton implementation of the command executor interface
+ * that ignores any commands.
+ */
+ final class Inactive
+ implements ExtendedJobCommandExecutor, Serializable
+ {
+ public static final ExtendedJobCommandExecutor INSTANCE = new Inactive();
+ public static ExtendedJobCommandExecutor instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Inactive() {
+ super();
+ }
+ public void execute(JobCommand command) {
+ // do nothing
+ }
+ public void execute(JobCommand command, String jobName) {
+ // do nothing
+ }
+ public void execute(JobCommand command, String jobName, ISchedulingRule schedulingRule) {
+ // do nothing
+ }
+ public void waitToExecute(JobCommand command) {
+ // do nothing
+ }
+ public boolean waitToExecute(JobCommand command, long timeout) throws InterruptedException {
+ // do nothing
+ return true;
+ }
+ public void waitToExecute(JobCommand command, String jobName) {
+ // do nothing
+ }
+ public boolean waitToExecute(JobCommand command, String jobName, long timeout) throws InterruptedException {
+ // do nothing
+ return true;
+ }
+ public void waitToExecute(JobCommand command, String jobName, ISchedulingRule schedulingRule) {
+ // do nothing
+ }
+ public boolean waitToExecute(JobCommand command, String jobName, ISchedulingRule schedulingRule, long timeout) throws InterruptedException {
+ // do nothing
+ return true;
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildSingletonToString(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.core/src/org/eclipse/jpt/common/core/utility/command/InterruptibleJobCommand.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/InterruptibleJobCommand.java
new file mode 100644
index 0000000000..4eb68d4bbb
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/InterruptibleJobCommand.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.utility.command;
+
+import java.io.Serializable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * Simple interface for implementing the GOF Command design pattern
+ * in an Eclipse job
+ * and allows for the command to throw an {@link InterruptedException}.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see org.eclipse.jpt.common.core.utility.command.JobCommand
+ */
+public interface InterruptibleJobCommand {
+
+ /**
+ * 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 return a result
+ * status of severity {@link IStatus#CANCEL}. The singleton
+ * cancel status {@link org.eclipse.core.runtime.Status#CANCEL_STATUS} can be used for
+ * this purpose.
+ * <p>
+ * Nested methods can also check the progress monitor
+ * and, if it is "canceled", throw an
+ * {@link org.eclipse.core.runtime.OperationCanceledException OperationCanceledException}.
+ *
+ * @see IProgressMonitor#isCanceled()
+ * @see org.eclipse.core.runtime.jobs.Job#run(IProgressMonitor monitor)
+ */
+ IStatus execute(IProgressMonitor monitor) throws InterruptedException;
+
+
+ /**
+ * Singleton implementation of the interruptible job command interface that
+ * will throw an interrupted exception when executed.
+ */
+ final class Interrupted
+ implements InterruptibleJobCommand, Serializable
+ {
+ public static final InterruptibleJobCommand INSTANCE = new Interrupted();
+ public static InterruptibleJobCommand instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Interrupted() {
+ super();
+ }
+ // throw an exception
+ public IStatus execute(IProgressMonitor monitor) throws InterruptedException {
+ throw new InterruptedException();
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildSingletonToString(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.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/utility/command/JobCommand.java
index 0a46bb470d..b70f49e3dc 100644
--- 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/utility/command/JobCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -7,13 +7,14 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.common.core.internal.utility;
+package org.eclipse.jpt.common.core.utility.command;
import java.io.Serializable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jpt.common.utility.internal.StringTools;
/**
* Simple interface for implementing the GOF Command design pattern in an
@@ -25,24 +26,36 @@ import org.eclipse.core.runtime.Status;
* 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 {
-
+public interface JobCommand
+ extends InterruptibleJobCommand
+{
/**
* 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
+ * the command should return a result
+ * status of severity {@link IStatus#CANCEL}. The singleton
+ * cancel status {@link Status#CANCEL_STATUS} can be used for
+ * this purpose.
+ * <p>
+ * Nested methods can also check the progress monitor
+ * and, if it is "canceled", throw an
* {@link org.eclipse.core.runtime.OperationCanceledException OperationCanceledException}.
+ *
* @see IProgressMonitor#isCanceled()
+ * @see org.eclipse.core.runtime.jobs.Job#run(IProgressMonitor monitor)
*/
IStatus execute(IProgressMonitor monitor);
+
/**
* Singleton implementation of the job command interface that will do
* nothing when executed.
*/
- final class Null implements JobCommand, Serializable {
+ final class Null
+ implements JobCommand, Serializable
+ {
public static final JobCommand INSTANCE = new Null();
public static JobCommand instance() {
return INSTANCE;
@@ -51,12 +64,12 @@ public interface JobCommand {
private Null() {
super();
}
- public IStatus execute(IProgressMonitor arg0) {
+ public IStatus execute(IProgressMonitor monitor) {
return Status.OK_STATUS;
}
@Override
public String toString() {
- return "JobCommand.Null"; //$NON-NLS-1$
+ return StringTools.buildSingletonToString(this);
}
private static final long serialVersionUID = 1L;
private Object readResolve() {
@@ -65,11 +78,14 @@ public interface JobCommand {
}
}
+
/**
* Singleton implementation of the job command interface that will throw an
* exception when executed.
*/
- final class Disabled implements JobCommand, Serializable {
+ final class Disabled
+ implements JobCommand, Serializable
+ {
public static final JobCommand INSTANCE = new Disabled();
public static JobCommand instance() {
return INSTANCE;
@@ -79,12 +95,12 @@ public interface JobCommand {
super();
}
// throw an exception
- public IStatus execute(IProgressMonitor arg0) {
+ public IStatus execute(IProgressMonitor monitor) {
throw new UnsupportedOperationException();
}
@Override
public String toString() {
- return "JobCommand.Disabled"; //$NON-NLS-1$
+ return StringTools.buildSingletonToString(this);
}
private static final long serialVersionUID = 1L;
private Object readResolve() {
@@ -92,5 +108,4 @@ public interface JobCommand {
return INSTANCE;
}
}
-
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/JobCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/JobCommandExecutor.java
new file mode 100644
index 0000000000..e2e1bcef8c
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/JobCommandExecutor.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.utility.command;
+
+import java.io.Serializable;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * This interface allows clients to control how a job 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 execute the command synchronously
+ * rather than dispatching it to a job queue).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JobCommandExecutor {
+
+ /**
+ * Execute the specified command, synchronously or asynchronously.
+ * Commands with the same scheduling rule must be executed in the order in
+ * which they are passed to the command executor.
+ * The command may or may not be assigned to a
+ * {@link org.eclipse.core.runtime.jobs.Job} for execution.
+ */
+ void execute(JobCommand command);
+
+ /**
+ * Execute the specified command, synchronously or asynchronously.
+ * Commands with the same scheduling rule must be executed in the order in
+ * which they are passed to the command executor.
+ * The command may or may not be assigned to a
+ * {@link org.eclipse.core.runtime.jobs.Job} for execution.
+ */
+ void execute(JobCommand command, String jobName);
+
+ /**
+ * Execute the specified command, synchronously or asynchronously.
+ * Commands with the same scheduling rule must be executed in the order in
+ * which they are passed to the command executor.
+ * The command may or may not be assigned to a
+ * {@link org.eclipse.core.runtime.jobs.Job} for execution.
+ */
+ void execute(JobCommand command, String jobName, ISchedulingRule schedulingRule);
+
+
+ /**
+ * Singleton implementation of the command executor interface
+ * that simply executes the command without any sort of enhancement.
+ */
+ final class Default
+ implements JobCommandExecutor, Serializable
+ {
+ public static final JobCommandExecutor INSTANCE = new Default();
+ public static JobCommandExecutor instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Default() {
+ super();
+ }
+ public void execute(JobCommand command) {
+ command.execute(new NullProgressMonitor());
+ }
+ public void execute(JobCommand command, String jobName) {
+ this.execute(command);
+ }
+ public void execute(JobCommand command, String jobName, ISchedulingRule schedulingRule) {
+ this.execute(command);
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildSingletonToString(this);
+ }
+ private static final long serialVersionUID = 1L;
+ private Object readResolve() {
+ // replace this object with the singleton
+ return INSTANCE;
+ }
+ }
+
+
+ /**
+ * Singleton implementation of the command executor interface
+ * that ignores any commands.
+ */
+ final class Inactive
+ implements JobCommandExecutor, Serializable
+ {
+ public static final JobCommandExecutor INSTANCE = new Inactive();
+ public static JobCommandExecutor instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Inactive() {
+ super();
+ }
+ public void execute(JobCommand command) {
+ // do nothing
+ }
+ public void execute(JobCommand command, String jobName) {
+ // do nothing
+ }
+ public void execute(JobCommand command, String jobName, ISchedulingRule schedulingRule) {
+ // do nothing
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildSingletonToString(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.core/src/org/eclipse/jpt/common/core/utility/command/NotifyingRepeatingJobCommand.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/NotifyingRepeatingJobCommand.java
new file mode 100644
index 0000000000..2710618aa2
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/NotifyingRepeatingJobCommand.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.utility.command;
+
+import java.io.Serializable;
+import java.util.EventListener;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * Extend the repeating job command to support listeners that are notified
+ * when an execution "cycle" is complete; i.e. the job command has,
+ * for the moment, handled every execution request and quiesced.
+ * This notification is <em>not</em> guaranteed to occur with <em>every</em>
+ * execution "cycle"; since other, unrelated, executions can be triggered
+ * concurrently, causing the "cycle" to continue.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface NotifyingRepeatingJobCommand
+ extends RepeatingJobCommand
+{
+ /**
+ * Add the specified listener.
+ */
+ void addListener(Listener listener);
+
+ /**
+ * Remove the specified listener.
+ */
+ void removeListener(Listener listener);
+
+
+ // ********** listener **********
+
+ /**
+ * Interface implemented by listeners to be notified whenever the
+ * job command has quiesced.
+ */
+ public interface Listener
+ extends EventListener
+ {
+ /**
+ * The specified job command has quiesced.
+ */
+ IStatus executionQuiesced(JobCommand command, IProgressMonitor monitor);
+ }
+
+
+ // ********** null singleton **********
+
+ /**
+ * Singleton implementation of the notifying repeating command interface that
+ * will do nothing when executed.
+ */
+ final class Null
+ implements NotifyingRepeatingJobCommand, Serializable
+ {
+ public static final NotifyingRepeatingJobCommand INSTANCE = new Null();
+ public static NotifyingRepeatingJobCommand instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Null() {
+ super();
+ }
+ public void start() {
+ // do nothing
+ }
+ public IStatus execute(IProgressMonitor monitor) {
+ return Status.OK_STATUS;
+ }
+ public void stop() {
+ // do nothing
+ }
+ public void addListener(Listener listener) {
+ // do nothing
+ }
+ public void removeListener(Listener listener) {
+ // do nothing
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildSingletonToString(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.core/src/org/eclipse/jpt/common/core/utility/command/RepeatingJobCommand.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/RepeatingJobCommand.java
new file mode 100644
index 0000000000..c9952b5b59
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/RepeatingJobCommand.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.core.utility.command;
+
+import java.io.Serializable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * This job command will execute repeatedly the minimum
+ * number of times. The assumption is the job command's effects are
+ * cumulative(?); i.e. the cumulative result of multiple executions of the
+ * job command is no different than the result of a single execution of the job
+ * command. Once the job command is executing, any further requests to execute
+ * simply trigger a re-execution of the job command once it has finished its
+ * current execution.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface RepeatingJobCommand
+ extends JobCommand
+{
+ /**
+ * Start the job command, allowing it to begin executing with the next call
+ * to {@link #execute(IProgressMonitor)}.
+ * @exception IllegalStateException when the command is not stopped
+ */
+ void start();
+
+ /**
+ * Stop the job command; ignore further calls to
+ * {@link #execute(IProgressMonitor)}.
+ * @exception IllegalStateException when the command executor is not started
+ */
+ void stop() throws InterruptedException;
+
+
+ /**
+ * Singleton implementation of the repeating job command interface that
+ * will do nothing when executed.
+ */
+ final class Null
+ implements RepeatingJobCommand, Serializable
+ {
+ public static final RepeatingJobCommand INSTANCE = new Null();
+ public static RepeatingJobCommand instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Null() {
+ super();
+ }
+ public void start() {
+ // do nothing
+ }
+ public IStatus execute(IProgressMonitor monitor) {
+ return Status.OK_STATUS;
+ }
+ public void stop() {
+ // do nothing
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildSingletonToString(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.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemExtendedLabelProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemExtendedLabelProvider.java
new file mode 100644
index 0000000000..affc4ca4ac
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemExtendedLabelProvider.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProvider;
+import org.eclipse.jpt.common.ui.jface.ItemLabelProvider;
+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.PropertyChangeAdapter;
+import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Abstract {@link ItemLabelProvider} that provides support for listening to an
+ * {@link #item} and notifying the
+ * {@link org.eclipse.jpt.common.ui.jface.ItemLabelProvider.Manager manager}
+ * whenever the item changes in a significant way.
+ * <p>
+ * Subclasses can implement the following methods if the corresponding aspects
+ * of the {@link #item} change:<ul>
+ * <li>{@link #buildImageModel()}<br>
+ * Return a {@link PropertyValueModel} that represents the item's image
+ * <li>{@link #buildTextModel()}<br>
+ * Return a {@link PropertyValueModel} that represents the item's text
+ * <li>{@link #buildDescriptionModel()}<br>
+ * Return a {@link PropertyValueModel} that represents the item's description
+ * </ul>
+ * Alternatively, subclasses can implement the following methods if the
+ * corresponding aspects of the {@link #item} do <em>not</em> change:<ul>
+ * <li>{@link #getImage()}<br>
+ * Return the item's image
+ * <li>{@link #getText()}<br>
+ * Return the item's text
+ * <li>{@link #getDescription()}<br>
+ * Return the item's description
+ * </ul>
+ * For each aspect (image, text, and description) one and only one of the two
+ * methods must be overridden.
+ *
+ * @see StaticItemExtendedLabelProvider
+ */
+public abstract class AbstractItemExtendedLabelProvider<I>
+ implements ItemExtendedLabelProvider
+{
+ protected final ItemLabelProvider.Manager manager;
+
+ protected final I item;
+
+ protected volatile PropertyChangeListener listener;
+
+ protected volatile PropertyValueModel<Image> imageModel;
+
+ protected volatile PropertyValueModel<String> textModel;
+
+ protected volatile PropertyValueModel<String> descriptionModel;
+
+
+ protected AbstractItemExtendedLabelProvider(I item, ItemLabelProvider.Manager manager) {
+ this.item = item;
+ this.manager = manager;
+ }
+
+
+ // ********** image **********
+
+ public Image getImage() {
+ return this.getImageModel().getValue();
+ }
+
+ /**
+ * Return the image model (lazy-initialized).
+ */
+ protected synchronized PropertyValueModel<Image> getImageModel() {
+ if (this.imageModel == null) {
+ this.imageModel = this.buildImageModel();
+ this.engageImageModel();
+ }
+ return this.imageModel;
+ }
+
+ /**
+ * Construct an image model.
+ */
+ protected PropertyValueModel<Image> buildImageModel() {
+ throw new UnsupportedOperationException();
+ }
+
+ protected void engageImageModel() {
+ this.imageModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.getListener());
+ }
+
+ protected void disengageImageModel() {
+ this.imageModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener);
+ }
+
+ protected void disposeImageModel() {
+ if (this.imageModel != null) {
+ this.disengageImageModel();
+ this.imageModel = null;
+ }
+ }
+
+
+ // ********** text **********
+
+ public String getText() {
+ return this.getTextModel().getValue();
+ }
+
+ /**
+ * Return the text model (lazy-initialized).
+ */
+ protected synchronized PropertyValueModel<String> getTextModel() {
+ if (this.textModel == null) {
+ this.textModel = this.buildTextModel();
+ this.engageTextModel();
+ }
+ return this.textModel;
+ }
+
+ /**
+ * Construct a text model.
+ */
+ protected PropertyValueModel<String> buildTextModel() {
+ throw new UnsupportedOperationException();
+ }
+
+ protected void engageTextModel() {
+ this.textModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.getListener());
+ }
+
+ protected void disengageTextModel() {
+ this.textModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener);
+ }
+
+ protected void disposeTextModel() {
+ if (this.textModel != null) {
+ this.disengageTextModel();
+ this.textModel = null;
+ }
+ }
+
+
+ // ********** description **********
+
+ public String getDescription() {
+ return this.getDescriptionModel().getValue();
+ }
+
+ /**
+ * Return the description model (lazy-initialized).
+ */
+ protected synchronized PropertyValueModel<String> getDescriptionModel() {
+ if (this.descriptionModel == null) {
+ this.descriptionModel = this.buildDescriptionModel();
+ this.engageDescriptionModel();
+ }
+ return this.descriptionModel;
+ }
+
+ /**
+ * Construct a description model.
+ */
+ protected PropertyValueModel<String> buildDescriptionModel() {
+ throw new UnsupportedOperationException();
+ }
+
+ protected void engageDescriptionModel() {
+ this.descriptionModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.getListener());
+ }
+
+ protected void disengageDescriptionModel() {
+ this.descriptionModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener);
+ }
+
+ protected void disposeDescriptionModel() {
+ if (this.descriptionModel != null) {
+ this.disengageDescriptionModel();
+ this.descriptionModel = null;
+ }
+ }
+
+
+ // ********** listener **********
+
+ protected synchronized PropertyChangeListener getListener() {
+ if (this.listener == null) {
+ this.listener = this.buildListener();
+ }
+ return this.listener;
+ }
+
+ /**
+ * Build a listener that will listen to the {@link #imageModel},
+ * {@link #textModel}, and {@link #descriptionModel}.
+ */
+ protected PropertyChangeListener buildListener() {
+ return new Listener();
+ }
+
+ /* CU private */ class Listener
+ extends PropertyChangeAdapter
+ {
+ @Override
+ public void propertyChanged(PropertyChangeEvent event) {
+ AbstractItemExtendedLabelProvider.this.itemChanged();
+ }
+ }
+
+ /* CU private */ void itemChanged() {
+ this.manager.updateLabel(this.item);
+ }
+
+
+ // ********** dispose **********
+
+ public synchronized void dispose() {
+ this.disposeImageModel();
+ this.disposeTextModel();
+ this.disposeDescriptionModel();
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.item);
+ }
+}
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 c351dddcd8..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, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this 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<Image> imageModel;
-
- private PropertyValueModel<String> textModel;
-
- private PropertyValueModel<String> 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) {
- getLabelProvider().updateLabel(getModel());
- }
- };
- }
-
- /**
- * Return the image value model
- * (lazy and just-in-time initialized)
- */
- protected synchronized PropertyValueModel<Image> getImageModel() {
- if (this.imageModel == null) {
- this.imageModel = buildImageModel();
- engageImageModel();
- }
- return this.imageModel;
- }
-
- /**
- * Construct an image model
- */
- protected abstract PropertyValueModel<Image> 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<String> getTextModel() {
- if (this.textModel == null) {
- this.textModel = buildTextModel();
- engageTextModel();
- }
- return this.textModel;
- }
-
- /**
- * Construct a text value model
- */
- protected abstract PropertyValueModel<String> 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<String> getDescriptionModel() {
- if (this.descriptionModel == null) {
- this.descriptionModel = buildDescriptionModel();
- engageDescriptionModel();
- }
- return this.descriptionModel;
- }
-
- /**
- * Construct a description value model
- */
- protected abstract PropertyValueModel<String> 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 getModel() {
- return this.model;
- }
-
- /**
- * Return the label provider that delegates to this item
- */
- public DelegatingContentAndLabelProvider getLabelProvider() {
- return this.labelProvider;
- }
-
- public Image getImage() {
- return getImageModel().getValue();
- }
-
- public String getText() {
- return getTextModel().getValue();
- }
-
- public String getDescription() {
- return getDescriptionModel().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/AbstractItemStructuredStateProviderManager.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemStructuredStateProviderManager.java
new file mode 100644
index 0000000000..0bf4676761
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemStructuredStateProviderManager.java
@@ -0,0 +1,280 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import java.util.HashMap;
+import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProvider;
+import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProviderFactory;
+import org.eclipse.jpt.common.ui.jface.ItemLabelProvider;
+import org.eclipse.jpt.common.ui.jface.ItemStructuredContentProvider;
+import org.eclipse.jpt.common.ui.jface.StructuredStateProvider;
+import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * This provider maintains caches of item content and label providers, each
+ * keyed by item. This allows the providers to listen to the items and update
+ * the viewer as necessary.
+ * <p>
+ * <strong>NB:</strong> This class, if used as a label provider should typically
+ * be used also as a content provider for the same viewer. Otherwise, the item
+ * label providers will not be disposed until the viewer is disposed; because
+ * the item label providers are disposed (here) as their associated items are
+ * disposed by their item content providers, which are listening to the items.
+ * This is only a problem if the items in the tree can be removed, thus leaking
+ * stale item label providers in the manager's cache. The default behavior is
+ * to disallow using the manager as only a label provider (see
+ * {@link #checkViewer()}).
+ *
+ * @see ItemStructuredContentProvider
+ * @see ItemExtendedLabelProvider
+ */
+public abstract class AbstractItemStructuredStateProviderManager<V extends StructuredViewer, CP extends ItemStructuredContentProvider>
+ extends BaseLabelProvider
+ implements StructuredStateProvider, ItemStructuredContentProvider.Manager, ItemExtendedLabelProvider.Manager
+{
+ /**
+ * May be <code>null</code>.
+ */
+ protected final ItemExtendedLabelProviderFactory itemLabelProviderFactory;
+
+ protected final HashMap<Object, CP> itemContentProviders = new HashMap<Object, CP>();
+
+ protected final HashMap<Object, ItemExtendedLabelProvider> itemLabelProviders = new HashMap<Object, ItemExtendedLabelProvider>();
+
+ protected volatile V viewer;
+
+
+ protected AbstractItemStructuredStateProviderManager(ItemExtendedLabelProviderFactory itemLabelProviderFactory) {
+ super();
+ this.itemLabelProviderFactory = itemLabelProviderFactory;
+ }
+
+
+ // ********** content provider **********
+
+ @SuppressWarnings("unchecked")
+ public synchronized void inputChanged(Viewer v, Object oldInput, Object newInput) {
+ if (oldInput != newInput) {
+ this.disposeProviders();
+ }
+ this.viewer = (V) v;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ CP provider = this.getItemContentProvider(inputElement);
+ return (provider == null) ? EMPTY_ARRAY : provider.getElements();
+ }
+
+
+ // ********** label provider **********
+
+ public Image getImage(Object element) {
+ ItemLabelProvider provider = this.getItemLabelProvider(element);
+ return (provider == null) ? null :provider.getImage();
+ }
+
+ public String getText(Object element) {
+ ItemLabelProvider provider = this.getItemLabelProvider(element);
+ return (provider == null) ? null : provider.getText();
+ }
+
+ public String getDescription(Object element) {
+ ItemExtendedLabelProvider provider = this.getItemLabelProvider(element);
+ return (provider == null) ? null : provider.getDescription();
+ }
+
+
+ // ********** item provider caches **********
+
+ protected synchronized CP getItemContentProvider(Object item) {
+ CP provider = this.itemContentProviders.get(item);
+ if (provider == null) {
+ if ( ! this.itemContentProviders.containsKey(item)) { // null is an allowed value
+ provider = this.buildItemContentProvider(item);
+ this.itemContentProviders.put(item, provider);
+ }
+ }
+ return provider;
+ }
+
+ protected abstract CP buildItemContentProvider(Object item);
+
+ protected synchronized ItemExtendedLabelProvider getItemLabelProvider(Object item) {
+ ItemExtendedLabelProvider provider = this.itemLabelProviders.get(item);
+ if (provider == null) {
+ if ( ! this.itemLabelProviders.containsKey(item)) { // null is an allowed value
+ provider = this.buildItemLabelProvider(item);
+ this.itemLabelProviders.put(item, provider);
+ }
+ }
+ return provider;
+ }
+
+ protected ItemExtendedLabelProvider buildItemLabelProvider(Object item) {
+ this.checkViewer();
+ return (this.itemLabelProviderFactory == null) ? null : this.itemLabelProviderFactory.buildProvider(item, this);
+ }
+
+ /**
+ * The viewer passes itself to its content provider; so it will be
+ * initialized by the time we get here if this provider is the
+ * viewer's content provider.
+ */
+ protected void checkViewer() {
+ if (this.viewer == null) {
+ throw new IllegalStateException("This provider must be used as a content provider *as well as* a label provider."); //$NON-NLS-1$
+ }
+ }
+
+
+ // ********** update elements **********
+
+ /**
+ * Dispatch to the UI thread.
+ */
+ public void updateElements(Object inputElement) {
+ this.execute(new UpdateElementsRunnable(inputElement));
+ }
+
+ /* CU private */ class UpdateElementsRunnable
+ extends RunnableAdapter
+ {
+ private final Object inputElement;
+ UpdateElementsRunnable(Object inputElement) {
+ super();
+ this.inputElement = inputElement;
+ }
+ @Override
+ public void run() {
+ AbstractItemStructuredStateProviderManager.this.updateElements_(this.inputElement);
+ }
+ }
+
+ /**
+ * Update the specified item's elements.
+ */
+ /* CU private */ void updateElements_(Object inputElement) {
+ if (this.viewerIsAlive()) {
+ this.viewer.refresh(inputElement);
+ }
+ }
+
+
+ // ********** update label **********
+
+ /**
+ * Dispatch to the UI thread.
+ */
+ public void updateLabel(Object item) {
+ this.execute(new UpdateLabelRunnable(item));
+ }
+
+ /* CU private */ class UpdateLabelRunnable
+ extends RunnableAdapter
+ {
+ private final Object item;
+ UpdateLabelRunnable(Object item) {
+ super();
+ this.item = item;
+ }
+ @Override
+ public void run() {
+ AbstractItemStructuredStateProviderManager.this.updateLabel_(this.item);
+ }
+ }
+
+ /**
+ * Update the specified item's label.
+ */
+ /* CU private */ void updateLabel_(Object item) {
+ if (this.viewerIsAlive()) {
+ this.fireLabelProviderChanged(new LabelProviderChangedEvent(this, item));
+ }
+ }
+
+
+ // ********** update description **********
+
+ public void updateDescription(Object item) {
+ // NOP - currently there is no way affect the status bar;
+ // it is updated when the viewer's selection changes
+ }
+
+
+ // ********** misc **********
+
+ protected void execute(Runnable runnable) {
+ SWTUtil.execute(this.viewer, runnable);
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+
+ protected boolean viewerIsAlive() {
+ Control control = (this.viewer == null) ? null : this.viewer.getControl();
+ return (control != null) && ! control.isDisposed();
+ }
+
+
+ // ********** dispose **********
+
+ /**
+ * Disposes all items
+ */
+ @Override
+ public synchronized void dispose() {
+ this.disposeProviders();
+ super.dispose();
+ }
+
+ protected synchronized void disposeProviders() {
+ // coded this way because the item providers will call back to this
+ // manager to dispose their children when they are disposed
+ while ( ! this.itemContentProviders.isEmpty()) {
+ this.dispose_(this.itemContentProviders.keySet().iterator().next());
+ }
+ // dispose the label providers for any items that did not have a content provider;
+ // although that is most likely a bug, it is allowed and handled
+ while (! this.itemLabelProviders.isEmpty()) {
+ this.dispose_(this.itemLabelProviders.keySet().iterator().next());
+ }
+ }
+
+ /**
+ * Dispose the specified item's content and label providers.
+ */
+ public synchronized void dispose(Object item) {
+ this.dispose_(item);
+ }
+
+ /**
+ * Pre-condition: synchronized
+ */
+ private void dispose_(Object item) {
+ ItemStructuredContentProvider icp = this.itemContentProviders.remove(item);
+ if (icp != null) {
+ icp.dispose();
+ }
+ ItemLabelProvider ilp = this.itemLabelProviders.remove(item);
+ if (ilp != null) {
+ ilp.dispose();
+ }
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemTreeContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemTreeContentProvider.java
new file mode 100644
index 0000000000..c79b5a61f6
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemTreeContentProvider.java
@@ -0,0 +1,187 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import java.util.ConcurrentModificationException;
+import org.eclipse.jpt.common.ui.jface.ItemTreeContentProvider;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+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.CollectionChangeAdapter;
+import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener;
+import org.eclipse.jpt.common.utility.model.value.CollectionValueModel;
+
+/**
+ * Abstract {@link ItemTreeContentProvider} that provides support for listening to an
+ * {@link #item} and notifying the
+ * {@link org.eclipse.jpt.common.ui.jface.ItemTreeContentProvider.Manager manager}
+ * whenever the item's children change in a significant way.
+ * <p>
+ * Subclasses must implement the following method:<ul>
+ * <li>{@link #buildChildrenModel()}<br>
+ * Return a {@link CollectionValueModel} that represents the item's children
+ * </ul>
+ *
+ * @see StaticItemTreeContentProvider
+ */
+public abstract class AbstractItemTreeContentProvider<I, C>
+ implements ItemTreeContentProvider
+{
+ protected final Manager manager;
+
+ protected final I item;
+
+ protected volatile CollectionValueModel<C> childrenModel;
+
+ protected volatile CollectionChangeListener childrenListener;
+
+
+ protected AbstractItemTreeContentProvider(I item, Manager manager) {
+ this.item = item;
+ this.manager = manager;
+ }
+
+
+ // ********** children **********
+
+ /**
+ * Typical implementation for a tree.
+ */
+ public Object[] getElements() {
+ return this.getChildren();
+ }
+
+ // TODO bjv
+ public Object[] getChildren() {
+ while (true) {
+ try {
+ return ArrayTools.array(this.getChildrenModel());
+ } catch (ConcurrentModificationException ex) {
+ // try again - hack: need to make value model stuff thread-safe...
+ }
+ }
+ }
+
+ /**
+ * Return the children model (lazy-initialized).
+ */
+ protected synchronized CollectionValueModel<C> getChildrenModel() {
+ if (this.childrenModel == null) {
+ this.childrenModel = this.buildChildrenModel();
+ this.childrenListener = this.buildChildrenListener();
+ this.engageChildrenModel();
+ }
+ return this.childrenModel;
+ }
+
+ /**
+ * Construct a children model.
+ */
+ protected abstract CollectionValueModel<C> buildChildrenModel();
+
+ /**
+ * Override with potentially more efficient logic.
+ */
+ public boolean hasChildren() {
+ return this.getChildrenModel().iterator().hasNext();
+ }
+
+ protected void engageChildrenModel() {
+ this.childrenModel.addCollectionChangeListener(CollectionValueModel.VALUES, this.childrenListener);
+ }
+
+ protected void disengageChildrenModel() {
+ this.childrenModel.removeCollectionChangeListener(CollectionValueModel.VALUES, this.childrenListener);
+ }
+
+
+ // ********** listener **********
+
+ protected CollectionChangeListener buildChildrenListener() {
+ return new ChildrenListener();
+ }
+
+ protected class ChildrenListener
+ extends CollectionChangeAdapter
+ {
+ @Override
+ @SuppressWarnings("unchecked")
+ public void itemsAdded(CollectionAddEvent event) {
+ AbstractItemTreeContentProvider.this.childrenAdded((Iterable<C>) event.getItems());
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void itemsRemoved(CollectionRemoveEvent event) {
+ AbstractItemTreeContentProvider.this.childrenRemoved((Iterable<C>) event.getItems());
+ }
+
+ /**
+ * <strong>NB:</strong> Any removed children will malinger until the
+ * manager itself is disposed.
+ */
+ @Override
+ public void collectionChanged(CollectionChangeEvent event) {
+ AbstractItemTreeContentProvider.this.childrenChanged();
+ }
+
+ /**
+ * <strong>NB:</strong> Any removed children will malinger until the
+ * manager itself is disposed.
+ */
+ @Override
+ public void collectionCleared(CollectionClearEvent event) {
+ AbstractItemTreeContentProvider.this.childrenChanged();
+ }
+ }
+
+ protected void childrenAdded(@SuppressWarnings("unused") Iterable<C> children) {
+ this.manager.updateChildren(this.item);
+ }
+
+ protected void childrenRemoved(Iterable<C> children) {
+ this.manager.updateChildren(this.item);
+ for (Object child : children) {
+ this.manager.dispose(child);
+ }
+ }
+
+ protected void childrenChanged() {
+ this.manager.updateChildren(this.item);
+ }
+
+
+ // ********** dispose **********
+
+ public synchronized void dispose() {
+ if (this.childrenModel != null) {
+ this.dispose_();
+ }
+ }
+
+ /**
+ * Pre-condition: {@link #childrenModel} is not <code>null</code>.
+ */
+ protected void dispose_() {
+ for (Object child : this.childrenModel) {
+ this.manager.dispose(child);
+ }
+ this.disengageChildrenModel();
+ this.childrenModel = null;
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.item);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractSelectionProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractSelectionProvider.java
new file mode 100644
index 0000000000..cd7e6ed8d1
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractSelectionProvider.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.core.commands.common.EventManager;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * Provide support for {@link ISelectionChangedListener selection change
+ * listeners} and {@link #fireSelectionChanged(ISelection) the safe firing of
+ * events}.
+ */
+public abstract class AbstractSelectionProvider
+ extends EventManager
+ implements ISelectionProvider
+{
+ protected AbstractSelectionProvider() {
+ super();
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ this.addListenerObject(listener);
+ }
+
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ this.removeListenerObject(listener);
+ }
+
+ protected void fireSelectionChanged(ISelection selection) {
+ SelectionChangedEvent event = new SelectionChangedEvent(this, selection);
+ for (Object listener : this.getListeners()) {
+ SafeRunner.run(new ListenerNotifier(listener, event));
+ }
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+
+
+ // ********** listener notifier **********
+
+ /**
+ * A runnable that forwards an event to a listener and handles any
+ * exceptions thrown by the listener by notifying the user via a dialog.
+ */
+ /* CU private */ class ListenerNotifier
+ extends SafeRunnable
+ {
+ private final ISelectionChangedListener listener;
+ private final SelectionChangedEvent event;
+
+ ListenerNotifier(Object listener, SelectionChangedEvent event) {
+ super();
+ this.listener = (ISelectionChangedListener) listener;
+ this.event = event;
+ }
+
+ public void run() {
+ this.listener.selectionChanged(this.event);
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.listener);
+ }
+ }
+}
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<E>
- implements TreeItemContentProvider
-{
- private DelegatingTreeContentAndLabelProvider treeContentProvider;
-
- private Model model;
-
- private CollectionValueModel<E> 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<E> childrenModel() {
- if (this.childrenModel == null) {
- this.childrenModel = buildChildrenModel();
- engageChildren();
- }
- return this.childrenModel.iterator();
- }
-
- /**
- * Construct a children model
- */
- protected CollectionValueModel<E> buildChildrenModel() {
- return new NullCollectionValueModel<E>();
- }
-
- /**
- * 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<E> buildChildrenModel(ListValueModel<E> lvm) {
- return new ListCollectionValueModelAdapter<E>(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<E> buildChildrenModel(PropertyValueModel<E> lvm) {
- return new PropertyListValueModelAdapter<E>(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/ContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ContentProvider.java
new file mode 100644
index 0000000000..176f774443
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ContentProvider.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * Convenience implementation of {@link IContentProvider}.
+ */
+public class ContentProvider
+ implements IContentProvider
+{
+ private static final IContentProvider NULL_PROVIDER = new ContentProvider();
+
+ public static IContentProvider nullProvider() {
+ return NULL_PROVIDER;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // do nothing
+ }
+
+ public void dispose() {
+ // do nothing
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/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/EmptySelection.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/EmptySelection.java
new file mode 100644
index 0000000000..089d0f78b1
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/EmptySelection.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * Empty implementation of {@link ISelection}.
+ * Implemented as a singleton.
+ */
+public class EmptySelection
+ implements ISelection
+{
+ public static final ISelection INSTANCE = new EmptySelection();
+
+ public static ISelection instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure a single instance.
+ */
+ private EmptySelection() {
+ super();
+ }
+
+ public boolean isEmpty() {
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildSingletonToString(this);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ItemStructuredStateProviderManager.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ItemStructuredStateProviderManager.java
new file mode 100644
index 0000000000..677c1d526f
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ItemStructuredStateProviderManager.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProviderFactory;
+import org.eclipse.jpt.common.ui.jface.ItemStructuredContentProvider;
+import org.eclipse.jpt.common.ui.jface.ItemStructuredContentProviderFactory;
+
+/**
+ * @see AbstractItemStructuredStateProviderManager
+ */
+public class ItemStructuredStateProviderManager
+ extends AbstractItemStructuredStateProviderManager<StructuredViewer, ItemStructuredContentProvider>
+{
+ /**
+ * Never <code>null</code>.
+ */
+ protected final ItemStructuredContentProviderFactory itemContentProviderFactory;
+
+
+ public ItemStructuredStateProviderManager(ItemStructuredContentProviderFactory itemContentProviderFactory) {
+ this(itemContentProviderFactory, null);
+ }
+
+ public ItemStructuredStateProviderManager(ItemStructuredContentProviderFactory itemContentProviderFactory, ItemExtendedLabelProviderFactory itemLabelProviderFactory) {
+ super(itemLabelProviderFactory);
+ if (itemContentProviderFactory == null) {
+ throw new NullPointerException();
+ }
+ this.itemContentProviderFactory = itemContentProviderFactory;
+ }
+
+ @Override
+ protected ItemStructuredContentProvider buildItemContentProvider(Object item) {
+ return this.itemContentProviderFactory.buildProvider(item, this);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ItemTreeStateProviderManager.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ItemTreeStateProviderManager.java
new file mode 100644
index 0000000000..b5d40efa54
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ItemTreeStateProviderManager.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProviderFactory;
+import org.eclipse.jpt.common.ui.jface.ItemTreeContentProvider;
+import org.eclipse.jpt.common.ui.jface.ItemTreeContentProviderFactory;
+import org.eclipse.jpt.common.ui.jface.TreeStateProvider;
+import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
+
+/**
+ * @see AbstractItemStructuredStateProviderManager
+ * @see ItemTreeContentProvider
+ */
+public class ItemTreeStateProviderManager
+ extends AbstractItemStructuredStateProviderManager<TreeViewer, ItemTreeContentProvider>
+ implements TreeStateProvider, ItemTreeContentProvider.Manager
+{
+ /**
+ * Never <code>null</code>.
+ */
+ protected final ItemTreeContentProviderFactory itemContentProviderFactory;
+
+
+ public ItemTreeStateProviderManager(ItemTreeContentProviderFactory itemContentProviderFactory) {
+ this(itemContentProviderFactory, null);
+ }
+
+ public ItemTreeStateProviderManager(ItemTreeContentProviderFactory itemContentProviderFactory, ItemExtendedLabelProviderFactory itemLabelProviderFactory) {
+ super(itemLabelProviderFactory);
+ if (itemContentProviderFactory == null) {
+ throw new NullPointerException();
+ }
+ this.itemContentProviderFactory = itemContentProviderFactory;
+ }
+
+
+ // ********** tree content provider **********
+
+ public boolean hasChildren(Object element) {
+ ItemTreeContentProvider provider = this.getItemContentProvider(element);
+ return (provider != null) && provider.hasChildren();
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ ItemTreeContentProvider provider = this.getItemContentProvider(parentElement);
+ return (provider == null) ? EMPTY_ARRAY : provider.getChildren();
+ }
+
+ public Object getParent(Object element) {
+ ItemTreeContentProvider provider = this.getItemContentProvider(element);
+ return (provider == null) ? null : provider.getParent();
+ }
+
+ @Override
+ protected ItemTreeContentProvider buildItemContentProvider(Object item) {
+ return this.itemContentProviderFactory.buildProvider(item, this);
+ }
+
+
+ // ********** update children **********
+
+ /**
+ * Dispatch to the UI thread.
+ */
+ public void updateChildren(Object inputElement) {
+ SWTUtil.execute(this.viewer, new UpdateChildrenRunnable(inputElement));
+ }
+
+ /* CU private */ class UpdateChildrenRunnable
+ extends RunnableAdapter
+ {
+ private final Object element;
+ UpdateChildrenRunnable(Object element) {
+ super();
+ this.element = element;
+ }
+ @Override
+ public void run() {
+ ItemTreeStateProviderManager.this.updateChildren_(this.element);
+ }
+ }
+
+ /**
+ * Update the specified item's children.
+ */
+ /* CU private */ void updateChildren_(Object element) {
+ if (this.viewerIsAlive()) {
+ this.viewer.refresh(element, false);
+ }
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/LabelProviderAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/LabelProviderAdapter.java
new file mode 100644
index 0000000000..e5e7ac18f2
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/LabelProviderAdapter.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * Convenience implementation of {@link ILabelProviderListener}.
+ */
+public class LabelProviderAdapter
+ implements ILabelProviderListener
+{
+ public void labelProviderChanged(LabelProviderChangedEvent event) {
+ // do nothing
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NavigatorContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NavigatorContentProvider.java
new file mode 100644
index 0000000000..17ba135212
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NavigatorContentProvider.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProviderFactory;
+import org.eclipse.jpt.common.ui.jface.ItemTreeContentProviderFactory;
+import org.eclipse.jpt.common.ui.jface.TreeStateProvider;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+
+/**
+ * This content provider delegates to a {@link TreeStateProvider} that is
+ * shared with a partner {@link NavigatorLabelProvider label provider}.
+ * <p>
+ * Concrete subclasses of this provider can be used as the content provider
+ * in extensions of <code>org.eclipse.ui.navigator.navigatorContent</code>.
+ */
+public abstract class NavigatorContentProvider
+ implements ICommonContentProvider
+{
+ protected TreeStateProvider delegate;
+
+
+ /**
+ * Must use zero-argument constructor because the provider is instantiated
+ * by the Navigator Content extension point
+ * (<code>org.eclipse.ui.navigator.navigatorContent</code>).
+ */
+ protected NavigatorContentProvider() {
+ super();
+ }
+
+ /**
+ * The content provider is initialized first; so we build the delegate
+ * here.
+ */
+ public void init(ICommonContentExtensionSite config) {
+ this.delegate = this.buildDelegate();
+ }
+
+ protected TreeStateProvider buildDelegate() {
+ return new ItemTreeStateProviderManager(
+ this.buildItemContentProviderFactory(),
+ this.buildItemLabelProviderFactory()
+ );
+ }
+
+ /**
+ * Return a factory that will build item content providers for the
+ * appropriate items in the navigator.
+ */
+ protected abstract ItemTreeContentProviderFactory buildItemContentProviderFactory();
+
+ /**
+ * Return a factory that will build item label providers for the
+ * appropriate items in the navigator.
+ */
+ protected abstract ItemExtendedLabelProviderFactory buildItemLabelProviderFactory();
+
+ public void inputChanged(Viewer commonViewer, Object oldInput, Object newInput) {
+ this.delegate.inputChanged(commonViewer, oldInput, newInput);
+ }
+
+ public Object[] getElements(Object inputElement) {
+ // never called?
+ return this.delegate.getElements(inputElement);
+ }
+
+ public Object getParent(Object element) {
+ return this.delegate.getParent(element);
+ }
+
+ public boolean hasChildren(Object element) {
+ return this.hasChildren_(element) || this.delegate.hasChildren(element);
+ }
+
+ /**
+ * Return whether the specified element has children. This method handles
+ * any element that is <em>not</em> handled by the {@link #delegate} but is
+ * the parent of element(s) that <em>are</em> handled by the
+ * {@link #delegate} (i.e. any third-party element that is to hold the
+ * provider's elements; e.g. a project). Return <code>false</code> if the
+ * element is to be handled by the {@link #delegate}.
+ */
+ protected abstract boolean hasChildren_(Object element);
+
+ public Object[] getChildren(Object element) {
+ Object[] children = this.getChildren_(element);
+ return (children != null) ? children : this.delegate.getChildren(element);
+ }
+
+ /**
+ * Return the specified element's children. This method handles
+ * any element that is <em>not</em> handled by the {@link #delegate} but is
+ * the parent of element(s) that <em>are</em> handled by the
+ * {@link #delegate} (i.e. any third-party element that is to hold the
+ * provider's elements; e.g. a project). Return <code>null</code> if the
+ * element is to be handled by the {@link #delegate}.
+ */
+ protected abstract Object[] getChildren_(Object element);
+
+ public void saveState(IMemento memento) {
+ // TODO
+ }
+
+ public void restoreState(IMemento memento) {
+ // TODO
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+
+ public void dispose() {
+ this.delegate.dispose();
+ }
+
+ /**
+ * @see NavigatorLabelProvider#getDelegate()
+ */
+ TreeStateProvider getDelegate() {
+ return this.delegate;
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NavigatorLabelProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NavigatorLabelProvider.java
new file mode 100644
index 0000000000..d85ae97b22
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NavigatorLabelProvider.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jpt.common.ui.internal.jface.LabelProviderAdapter;
+import org.eclipse.jpt.common.ui.jface.TreeStateProvider;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
+
+/**
+ * @see NavigatorContentProvider
+ * <p>
+ * This provider can be used as the label provider
+ * in extensions of <code>org.eclipse.ui.navigator.navigatorContent</code>.
+ */
+public class NavigatorLabelProvider
+ extends BaseLabelProvider
+ implements ICommonLabelProvider
+{
+ /**
+ * "Partner" content provider that holds the tree
+ * state provider.
+ */
+ private NavigatorContentProvider contentProvider;
+
+ /**
+ * Listen to the delegate provider and forward any events.
+ */
+ private DelegateListener delegateListener;
+
+
+ public NavigatorLabelProvider() {
+ super();
+ }
+
+ /**
+ * @see #dispose()
+ */
+ public void init(ICommonContentExtensionSite config) {
+ this.contentProvider = (NavigatorContentProvider) config.getExtension().getContentProvider();
+ this.delegateListener = new DelegateListener();
+ this.getDelegate().addListener(this.delegateListener);
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return this.getDelegate().isLabelProperty(element, property);
+ }
+
+ public Image getImage(Object element) {
+ return this.getDelegate().getImage(element);
+ }
+
+ public String getText(Object element) {
+ return this.getDelegate().getText(element);
+ }
+
+ public String getDescription(Object element) {
+ return this.getDelegate().getDescription(element);
+ }
+
+ public void saveState(IMemento memento) {
+ // TODO
+ }
+
+ public void restoreState(IMemento memento) {
+ // TODO
+ }
+
+ private TreeStateProvider getDelegate() {
+ return this.contentProvider.getDelegate();
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+
+ /**
+ * NB: The delegate will remove our listener when it is disposed
+ * in {@link NavigatorContentProvider#dispose()}. :-(
+ * @see BaseLabelProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+
+ // ********** delegate listener **********
+
+ /* CU private */ class DelegateListener
+ extends LabelProviderAdapter
+ {
+ @Override
+ public void labelProviderChanged(LabelProviderChangedEvent event) {
+ NavigatorLabelProvider.this.labelProviderChanged(event);
+ }
+ }
+
+ /* CU private */ void labelProviderChanged(LabelProviderChangedEvent event) {
+ // forward the event with *this* provider as the source
+ this.fireLabelProviderChanged(new LabelProviderChangedEvent(this, event.getElements()));
+ }
+}
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/SelectionChangedAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SelectionChangedAdapter.java
new file mode 100644
index 0000000000..165ac1c850
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SelectionChangedAdapter.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * Convenience implementation of {@link ISelectionChangedListener}.
+ */
+public class SelectionChangedAdapter
+ implements ISelectionChangedListener
+{
+ public void selectionChanged(SelectionChangedEvent event) {
+ // do nothing
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SimpleItemTreeStateProviderFactoryProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SimpleItemTreeStateProviderFactoryProvider.java
new file mode 100644
index 0000000000..454e7040f4
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SimpleItemTreeStateProviderFactoryProvider.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProviderFactory;
+import org.eclipse.jpt.common.ui.jface.ItemTreeContentProviderFactory;
+import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * Straightforward implementation of {@link ItemTreeStateProviderFactoryProvider}.
+ */
+public class SimpleItemTreeStateProviderFactoryProvider
+ implements ItemTreeStateProviderFactoryProvider
+{
+ private final ItemTreeContentProviderFactory contentProviderFactory;
+ private final ItemExtendedLabelProviderFactory labelProviderFactory;
+
+
+ public SimpleItemTreeStateProviderFactoryProvider(
+ ItemTreeContentProviderFactory contentProviderFactory,
+ ItemExtendedLabelProviderFactory labelProviderFactory
+ ) {
+ super();
+ this.contentProviderFactory = contentProviderFactory;
+ this.labelProviderFactory = labelProviderFactory;
+ }
+
+ public ItemTreeContentProviderFactory getItemContentProviderFactory() {
+ return this.contentProviderFactory;
+ }
+
+ public ItemExtendedLabelProviderFactory getItemLabelProviderFactory() {
+ return this.labelProviderFactory;
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SimpleMessageTreeContent.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SimpleMessageTreeContent.java
new file mode 100644
index 0000000000..ca019ef46e
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SimpleMessageTreeContent.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * Tree content with a root with a single child, the message that will be
+ * displayed in the tree widget.
+ * <p>
+ * To display a message in a {@link org.eclipse.jface.viewers.TreeViewer}:
+ * <pre>
+ * TreeViewer treeViewer = ...;
+ * treeViewer.setInput(null);
+ * treeViewer.setContentProvider(SimpleMessageTreeContent.contentProvider());
+ * treeViewer.setLabelProvider(SimpleMessageTreeContent.labelProvider());
+ * treeViewer.setInput(new SimpleMessageTreeContent("message"));
+ * </pre>
+ */
+public class SimpleMessageTreeContent {
+ private final String message;
+
+ public SimpleMessageTreeContent(String message) {
+ super();
+ this.message = message;
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.message);
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+
+
+ // ********** tree content provider **********
+
+ public static ITreeContentProvider contentProvider() {
+ return CONTENT_PROVIDER;
+ }
+
+ private static final ITreeContentProvider CONTENT_PROVIDER = new ContentProvider();
+
+ /**
+ * Content provider for message tree content.
+ */
+ /* CU private */ static class ContentProvider
+ extends TreeContentProvider
+ {
+ @Override
+ public boolean hasChildren(Object element) {
+ return (element instanceof SimpleMessageTreeContent);
+ }
+
+ @Override
+ public Object[] getChildren(Object element) {
+ if (element instanceof SimpleMessageTreeContent) {
+ String msg = ((SimpleMessageTreeContent) element).getMessage();
+ return new Object[] { msg };
+ }
+ return EMPTY_ARRAY;
+ }
+ }
+
+
+ // ********** label provider **********
+
+ public static ILabelProvider labelProvider() {
+ return LABEL_PROVIDER;
+ }
+
+ private static final ILabelProvider LABEL_PROVIDER = new LabelProvider();
+
+ /**
+ * Label provider for message tree content.
+ */
+ /* CU private */ static class LabelProvider
+ extends org.eclipse.jface.viewers.LabelProvider
+ {
+ @Override
+ public String getText(Object element) {
+ return (element instanceof String) ? (String) element : null;
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemExtendedLabelProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemExtendedLabelProvider.java
new file mode 100644
index 0000000000..5033a00292
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemExtendedLabelProvider.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Item label provider that contains unchanging image, text, and description.
+ */
+public class StaticItemExtendedLabelProvider
+ extends StaticItemLabelProvider
+ implements ItemExtendedLabelProvider
+{
+ protected final String description;
+
+ /**
+ * Construct an item label provider that returns the specified text
+ * but no image. The provider will also return the specified text as the
+ * description.
+ */
+ public StaticItemExtendedLabelProvider(String text) {
+ this(null, text);
+ }
+
+ /**
+ * Construct an item label provider that returns the specified image
+ * and text. The provider will also return the specified text as the
+ * description.
+ */
+ public StaticItemExtendedLabelProvider(Image image, String text) {
+ this(image, text, text);
+ }
+
+ /**
+ * Construct an item label provider that returns the specified image, text,
+ * and description.
+ */
+ public StaticItemExtendedLabelProvider(Image image, String text, String description) {
+ super(image, text);
+ this.description = description;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemLabelProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemLabelProvider.java
new file mode 100644
index 0000000000..29415f13b3
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemLabelProvider.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jpt.common.ui.jface.ItemLabelProvider;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Item label provider that contains unchanging image and text.
+ */
+public class StaticItemLabelProvider
+ implements ItemLabelProvider
+{
+ protected final Image image;
+ protected final String text;
+
+ /**
+ * Construct an item label provider that returns the specified text but
+ * no image.
+ */
+ public StaticItemLabelProvider(String text) {
+ this(null, text);
+ }
+
+ /**
+ * Construct an item label provider that returns the specified image
+ * and text.
+ */
+ public StaticItemLabelProvider(Image image, String text) {
+ super();
+ this.image = image;
+ this.text = text;
+ }
+
+ public Image getImage() {
+ return this.image;
+ }
+
+ public String getText() {
+ return this.text;
+ }
+
+ public void dispose() {
+ // NOP
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.text);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemTreeContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemTreeContentProvider.java
new file mode 100644
index 0000000000..4eddce1fa0
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemTreeContentProvider.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jpt.common.ui.jface.ItemTreeContentProvider;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * Item tree content provider that contains unchanging parent and children.
+ *
+ * @see org.eclipse.jpt.common.ui.jface.ItemTreeContentProvider.Null
+ */
+public class StaticItemTreeContentProvider
+ implements ItemTreeContentProvider
+{
+ protected final Object parent;
+ protected final Object[] children;
+
+ /**
+ * Construct an item tree content provider for an item with neither
+ * a parent nor children.
+ */
+ public StaticItemTreeContentProvider() {
+ this(null);
+ }
+
+ /**
+ * Construct an item tree content provider for an item with the specified
+ * parent but no children.
+ */
+ public StaticItemTreeContentProvider(Object parent) {
+ this(parent, EMPTY_ARRAY);
+ }
+
+ /**
+ * Construct an item tree content provider for an item with the specified
+ * parent and children.
+ */
+ public StaticItemTreeContentProvider(Object parent, Object[] children) {
+ super();
+ if (children == null) {
+ throw new NullPointerException();
+ }
+ this.parent = parent;
+ this.children = children;
+ }
+
+ public Object[] getElements() {
+ return this.children;
+ }
+
+ public Object getParent() {
+ return this.parent;
+ }
+
+ public Object[] getChildren() {
+ return this.children;
+ }
+
+ public boolean hasChildren() {
+ return this.children.length > 0;
+ }
+
+ public void dispose() {
+ // NOP
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StructuredContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StructuredContentProvider.java
new file mode 100644
index 0000000000..891c15309b
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StructuredContentProvider.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+
+/**
+ * Convenience implementation of {@link IStructuredContentProvider}.
+ */
+public class StructuredContentProvider
+ extends ContentProvider
+ implements IStructuredContentProvider
+{
+ private static final IStructuredContentProvider NULL_PROVIDER = new StructuredContentProvider();
+
+ public static IStructuredContentProvider nullProvider() {
+ return NULL_PROVIDER;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return EMPTY_ARRAY;
+ }
+
+ protected static final Object[] EMPTY_ARRAY = new Object[0];
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/TreeContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/TreeContentProvider.java
new file mode 100644
index 0000000000..86fcbcd311
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/TreeContentProvider.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.jface;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+
+/**
+ * Convenience implementation of {@link ITreeContentProvider}.
+ */
+public class TreeContentProvider
+ extends StructuredContentProvider
+ implements ITreeContentProvider
+{
+ private static final ITreeContentProvider NULL_PROVIDER = new TreeContentProvider();
+
+ public static ITreeContentProvider nullProvider() {
+ return NULL_PROVIDER;
+ }
+
+ @Override
+ public Object[] getElements(Object input) {
+ // typical tree implementation
+ return this.getChildren(input);
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+
+ public Object[] getChildren(Object element) {
+ return EMPTY_ARRAY;
+ }
+}
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
index 8918708bbf..8c94238d76 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,16 +9,19 @@
******************************************************************************/
package org.eclipse.jpt.common.ui.internal.listeners;
+import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
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.
+ *
+ * @see SWTPropertyChangeListenerWrapper
*/
public class SWTCollectionChangeListenerWrapper
implements CollectionChangeListener
@@ -34,118 +37,105 @@ public class SWTCollectionChangeListenerWrapper
}
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));
- }
+ this.execute(new ItemsAddedRunnable(event));
}
- public void collectionCleared(CollectionClearEvent event) {
- if (this.isExecutingOnUIThread()) {
- this.collectionCleared_(event);
- } else {
- this.executeOnUIThread(this.buildCollectionClearedRunnable(event));
+ /* CU private */ class ItemsAddedRunnable
+ extends RunnableAdapter
+ {
+ private final CollectionAddEvent event;
+ ItemsAddedRunnable(CollectionAddEvent event) {
+ super();
+ this.event = event;
}
- }
-
- public void collectionChanged(CollectionChangeEvent event) {
- if (this.isExecutingOnUIThread()) {
- this.collectionChanged_(event);
- } else {
- this.executeOnUIThread(this.buildCollectionChangedRunnable(event));
+ @Override
+ public void run() {
+ SWTCollectionChangeListenerWrapper.this.itemsAdded_(this.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$
- }
- };
+ void itemsAdded_(CollectionAddEvent event) {
+ this.listener.itemsAdded(event);
}
- 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$
- }
- };
+ public void itemsRemoved(CollectionRemoveEvent event) {
+ this.execute(new ItemsRemovedRunnable(event));
}
- 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$
- }
- };
+ /* CU private */ class ItemsRemovedRunnable
+ extends RunnableAdapter
+ {
+ private final CollectionRemoveEvent event;
+ ItemsRemovedRunnable(CollectionRemoveEvent event) {
+ super();
+ this.event = event;
+ }
+ @Override
+ public void run() {
+ SWTCollectionChangeListenerWrapper.this.itemsRemoved_(this.event);
+ }
}
- 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$
- }
- };
+ void itemsRemoved_(CollectionRemoveEvent event) {
+ this.listener.itemsRemoved(event);
}
- private boolean isExecutingOnUIThread() {
- return Display.getCurrent() != null;
+ public void collectionCleared(CollectionClearEvent event) {
+ this.execute(new CollectionClearedRunnable(event));
}
- /**
- * {@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);
+ /* CU private */ class CollectionClearedRunnable
+ extends RunnableAdapter
+ {
+ private final CollectionClearEvent event;
+ CollectionClearedRunnable(CollectionClearEvent event) {
+ super();
+ this.event = event;
+ }
+ @Override
+ public void run() {
+ SWTCollectionChangeListenerWrapper.this.collectionCleared_(this.event);
+ }
}
- void itemsAdded_(CollectionAddEvent event) {
- this.listener.itemsAdded(event);
+ void collectionCleared_(CollectionClearEvent event) {
+ this.listener.collectionCleared(event);
}
- void itemsRemoved_(CollectionRemoveEvent event) {
- this.listener.itemsRemoved(event);
+ public void collectionChanged(CollectionChangeEvent event) {
+ this.execute(new CollectionChangedRunnable(event));
}
- void collectionCleared_(CollectionClearEvent event) {
- this.listener.collectionCleared(event);
+ /* CU private */ class CollectionChangedRunnable
+ extends RunnableAdapter
+ {
+ private final CollectionChangeEvent event;
+ CollectionChangedRunnable(CollectionChangeEvent event) {
+ super();
+ this.event = event;
+ }
+ @Override
+ public void run() {
+ SWTCollectionChangeListenerWrapper.this.collectionChanged_(this.event);
+ }
}
void collectionChanged_(CollectionChangeEvent event) {
this.listener.collectionChanged(event);
}
+ /**
+ * {@link SWTUtil#execute(Runnable)} seems to work OK;
+ * but using {@link SWTUtil#syncExec(Runnable)} can somtimes make things
+ * more predictable when debugging, at the risk of deadlocks.
+ */
+ private void execute(Runnable r) {
+ SWTUtil.execute(r);
+// SWTUtil.syncExec(r);
+ }
+
@Override
public String toString() {
- return "SWT(" + this.listener.toString() + ')'; //$NON-NLS-1$
+ return "SWT(" + this.listener + ')'; //$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
index 321080dfc5..3037b60e79 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.common.ui.internal.listeners;
+import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
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;
@@ -16,11 +18,12 @@ 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.
+ *
+ * @see SWTPropertyChangeListenerWrapper
*/
public class SWTListChangeListenerWrapper
implements ListChangeListener
@@ -36,166 +39,149 @@ public class SWTListChangeListenerWrapper
}
public void itemsAdded(ListAddEvent event) {
- if (this.isExecutingOnUIThread()) {
- this.itemsAdded_(event);
- } else {
- this.executeOnUIThread(this.buildItemsAddedRunnable(event));
- }
+ this.execute(new ItemsAddedRunnable(event));
}
- public void itemsRemoved(ListRemoveEvent event) {
- if (this.isExecutingOnUIThread()) {
- this.itemsRemoved_(event);
- } else {
- this.executeOnUIThread(this.buildItemsRemovedRunnable(event));
+ /* CU private */ class ItemsAddedRunnable
+ extends RunnableAdapter
+ {
+ private final ListAddEvent event;
+ ItemsAddedRunnable(ListAddEvent event) {
+ super();
+ this.event = event;
+ }
+ @Override
+ public void run() {
+ SWTListChangeListenerWrapper.this.itemsAdded_(this.event);
}
}
- public void itemsMoved(ListMoveEvent event) {
- if (this.isExecutingOnUIThread()) {
- this.itemsMoved_(event);
- } else {
- this.executeOnUIThread(this.buildItemsMovedRunnable(event));
- }
+ void itemsAdded_(ListAddEvent event) {
+ this.listener.itemsAdded(event);
}
- public void itemsReplaced(ListReplaceEvent event) {
- if (this.isExecutingOnUIThread()) {
- this.itemsReplaced_(event);
- } else {
- this.executeOnUIThread(this.buildItemsReplacedRunnable(event));
- }
+ public void itemsRemoved(ListRemoveEvent event) {
+ this.execute(new ItemsRemovedRunnable(event));
}
- public void listCleared(ListClearEvent event) {
- if (this.isExecutingOnUIThread()) {
- this.listCleared_(event);
- } else {
- this.executeOnUIThread(this.buildListClearedRunnable(event));
+ /* CU private */ class ItemsRemovedRunnable
+ extends RunnableAdapter
+ {
+ private final ListRemoveEvent event;
+ ItemsRemovedRunnable(ListRemoveEvent event) {
+ super();
+ this.event = event;
+ }
+ @Override
+ public void run() {
+ SWTListChangeListenerWrapper.this.itemsRemoved_(this.event);
}
}
- public void listChanged(ListChangeEvent event) {
- if (this.isExecutingOnUIThread()) {
- this.listChanged_(event);
- } else {
- this.executeOnUIThread(this.buildListChangedRunnable(event));
- }
+ void itemsRemoved_(ListRemoveEvent event) {
+ this.listener.itemsRemoved(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;
+ public void itemsMoved(ListMoveEvent event) {
+ this.execute(new ItemsMovedRunnable(event));
}
- /**
- * {@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);
+ /* CU private */ class ItemsMovedRunnable
+ extends RunnableAdapter
+ {
+ private final ListMoveEvent event;
+ ItemsMovedRunnable(ListMoveEvent event) {
+ super();
+ this.event = event;
+ }
+ @Override
+ public void run() {
+ SWTListChangeListenerWrapper.this.itemsMoved_(this.event);
+ }
}
- void itemsAdded_(ListAddEvent event) {
- this.listener.itemsAdded(event);
+ void itemsMoved_(ListMoveEvent event) {
+ this.listener.itemsMoved(event);
}
- void itemsRemoved_(ListRemoveEvent event) {
- this.listener.itemsRemoved(event);
+ public void itemsReplaced(ListReplaceEvent event) {
+ this.execute(new ItemsReplacedRunnable(event));
}
- void itemsMoved_(ListMoveEvent event) {
- this.listener.itemsMoved(event);
+ /* CU private */ class ItemsReplacedRunnable
+ extends RunnableAdapter
+ {
+ private final ListReplaceEvent event;
+ ItemsReplacedRunnable(ListReplaceEvent event) {
+ super();
+ this.event = event;
+ }
+ @Override
+ public void run() {
+ SWTListChangeListenerWrapper.this.itemsReplaced_(this.event);
+ }
+ }
+
+ public void listCleared(ListClearEvent event) {
+ this.execute(new ListClearedRunnable(event));
}
void itemsReplaced_(ListReplaceEvent event) {
this.listener.itemsReplaced(event);
}
+ /* CU private */ class ListClearedRunnable
+ extends RunnableAdapter
+ {
+ private final ListClearEvent event;
+ ListClearedRunnable(ListClearEvent event) {
+ super();
+ this.event = event;
+ }
+ @Override
+ public void run() {
+ SWTListChangeListenerWrapper.this.listCleared_(this.event);
+ }
+ }
+
void listCleared_(ListClearEvent event) {
this.listener.listCleared(event);
}
+ public void listChanged(ListChangeEvent event) {
+ this.execute(new ListChangedRunnable(event));
+ }
+
+ /* CU private */ class ListChangedRunnable
+ extends RunnableAdapter
+ {
+ private final ListChangeEvent event;
+ ListChangedRunnable(ListChangeEvent event) {
+ super();
+ this.event = event;
+ }
+ @Override
+ public void run() {
+ SWTListChangeListenerWrapper.this.listChanged_(this.event);
+ }
+ }
+
void listChanged_(ListChangeEvent event) {
this.listener.listChanged(event);
}
+ /**
+ * {@link SWTUtil#execute(Runnable)} seems to work OK;
+ * but using {@link SWTUtil#syncExec(Runnable)} can somtimes make things
+ * more predictable when debugging, at the risk of deadlocks.
+ */
+ private void execute(Runnable r) {
+ SWTUtil.execute(r);
+// SWTUtil.syncExec(r);
+ }
+
@Override
public String toString() {
- return "SWT(" + this.listener.toString() + ')'; //$NON-NLS-1$
+ return "SWT(" + this.listener + ')'; //$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
index f95fbe6005..a12e215685 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,9 +9,10 @@
******************************************************************************/
package org.eclipse.jpt.common.ui.internal.listeners;
+import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
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
@@ -37,46 +38,39 @@ public class SWTPropertyChangeListenerWrapper
}
public void propertyChanged(PropertyChangeEvent event) {
- if (this.isExecutingOnUIThread()) {
- this.propertyChanged_(event);
- } else {
- this.executeOnUIThread(this.buildPropertyChangedRunnable(event));
- }
+ this.execute(new PropertyChangedRunnable(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$
- }
- };
+ /* CU private */ class PropertyChangedRunnable
+ extends RunnableAdapter
+ {
+ private final PropertyChangeEvent event;
+ PropertyChangedRunnable(PropertyChangeEvent event) {
+ super();
+ this.event = event;
+ }
+ @Override
+ public void run() {
+ SWTPropertyChangeListenerWrapper.this.propertyChanged_(this.event);
+ }
}
- private boolean isExecutingOnUIThread() {
- return Display.getCurrent() != null;
+ void propertyChanged_(PropertyChangeEvent event) {
+ this.listener.propertyChanged(event);
}
/**
- * {@link Display#asyncExec(Runnable)} seems to work OK;
- * but using {@link Display#syncExec(Runnable)} can somtimes make things
+ * {@link SWTUtil#execute(Runnable)} seems to work OK;
+ * but using {@link SWTUtil#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);
+ private void execute(Runnable r) {
+ SWTUtil.execute(r);
+// SWTUtil.syncExec(r);
}
@Override
public String toString() {
- return "SWT(" + this.listener.toString() + ')'; //$NON-NLS-1$
+ return "SWT(" + this.listener + ')'; //$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
index 16bf1194db..7437bf48b2 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,16 +9,16 @@
******************************************************************************/
package org.eclipse.jpt.common.ui.internal.listeners;
+import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
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.
+ * UI thread, asynchronously if necessary.
+ *
+ * @see SWTPropertyChangeListenerWrapper
*/
public class SWTStateChangeListenerWrapper
implements StateChangeListener
@@ -34,46 +34,39 @@ public class SWTStateChangeListenerWrapper
}
public void stateChanged(StateChangeEvent event) {
- if (this.isExecutingOnUIThread()) {
- this.stateChanged_(event);
- } else {
- this.executeOnUIThread(this.buildStateChangedRunnable(event));
- }
+ this.execute(new StateChangedRunnable(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$
- }
- };
+ /* CU private */ class StateChangedRunnable
+ extends RunnableAdapter
+ {
+ private final StateChangeEvent event;
+ StateChangedRunnable(StateChangeEvent event) {
+ super();
+ this.event = event;
+ }
+ @Override
+ public void run() {
+ SWTStateChangeListenerWrapper.this.stateChanged_(this.event);
+ }
}
- private boolean isExecutingOnUIThread() {
- return Display.getCurrent() != null;
+ void stateChanged_(StateChangeEvent event) {
+ this.listener.stateChanged(event);
}
/**
- * {@link Display#asyncExec(Runnable)} seems to work OK;
- * but using {@link Display#syncExec(Runnable)} can somtimes make things
+ * {@link SWTUtil#execute(Runnable)} seems to work OK;
+ * but using {@link SWTUtil#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);
+ private void execute(Runnable r) {
+ SWTUtil.execute(r);
+// SWTUtil.syncExec(r);
}
@Override
public String toString() {
- return "SWT(" + this.listener.toString() + ')'; //$NON-NLS-1$
+ return "SWT(" + this.listener + ')'; //$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
index 05e5bd5767..b338393dc4 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/properties/JptProjectPropertiesPage.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/properties/JptProjectPropertiesPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
+ * Copyright (c) 2011, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -28,12 +28,12 @@ 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.StringTools;
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.listener.AbstractChangeListener;
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;
@@ -42,7 +42,6 @@ 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;
@@ -53,128 +52,132 @@ 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<IProject> projectModel;
protected final BufferedWritablePropertyValueModel.Trigger trigger;
-
+
protected final ChangeListener validationListener;
-
-
+
+
public JptProjectPropertiesPage() {
super();
this.projectModel = new SimplePropertyValueModel<IProject>();
this.trigger = new BufferedWritablePropertyValueModel.Trigger();
-
- buildModels();
-
+
+ this.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<Boolean> flagModel) {
+
+ public static boolean flagIsSet(PropertyValueModel<Boolean> flagModel) {
Boolean flag = flagModel.getValue();
return (flag != null) && flag.booleanValue();
}
-
-
+
+
// ********** LibraryFacetPropertyPage implementation **********
-
-
protected IPropertyChangeListener buildLibraryProviderListener() {
- return new IPropertyChangeListener() {
- public void propertyChanged(String property, Object oldValue, Object newValue ) {
- if (LibraryInstallDelegate.PROP_AVAILABLE_PROVIDERS.equals(property)) {
- adjustLibraryProviders();
- }
- }
- };
- }
-
+ return new LibraryProviderListener();
+ }
+
+ protected class LibraryProviderListener
+ implements IPropertyChangeListener
+ {
+ public void propertyChanged(String property, Object oldValue, Object newValue ) {
+ if (LibraryInstallDelegate.PROP_AVAILABLE_PROVIDERS.equals(property)) {
+ JptProjectPropertiesPage.this.adjustLibraryProviders();
+ }
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+ }
+
protected abstract void adjustLibraryProviders();
-
-
+
+
// ********** page **********
@Override
protected Control createPageContents(Composite parent) {
if (this.projectModel.getValue() != null) {
- disengageListeners();
+ this.disengageListeners();
}
-
- this.projectModel.setValue(getProject());
-
+
+ this.projectModel.setValue(this.getProject());
+
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
composite.setLayout(layout);
-
- createWidgets(composite);
-
+
+ this.createWidgets(composite);
+
Dialog.applyDialogFont(composite);
-
- adjustLibraryProviders();
-
- engageListeners();
- updateValidation();
+
+ this.adjustLibraryProviders();
+
+ this.engageListeners();
+ this.updateValidation();
return composite;
}
-
+
/**
* Build specific widgets. Layout and validation will be taken care of.
*/
protected abstract void createWidgets(Composite parent);
-
+
protected void engageListeners() {
- engageValidationListener();
+ this.engageValidationListener();
}
-
+
protected void disengageListeners() {
- disengageValidationListener();
+ this.disengageValidationListener();
}
-
+
protected Link buildFacetsPageLink(Composite parent, String text) {
- Link facetsPageLink = buildLink(parent, text);
- facetsPageLink.addSelectionListener(buildFacetsPageLinkListener()); // the link will be GCed
+ Link facetsPageLink = this.buildLink(parent, text);
+ facetsPageLink.addSelectionListener(new FacetsPageLinkListener()); // 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$
- }
- };
+
+ /* CU private */ class FacetsPageLinkListener
+ extends SelectionAdapter
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ JptProjectPropertiesPage.this.openProjectFacetsPage();
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
}
-
+
protected void openProjectFacetsPage() {
- ((IWorkbenchPreferenceContainer)getContainer()).openPage(FacetsPropertyPage.ID, null);
+ ((IWorkbenchPreferenceContainer)this.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
@@ -184,18 +187,18 @@ public abstract class JptProjectPropertiesPage
public Point computeSize() {
return this.doComputeSize();
}
-
-
+
+
// ********** widgets **********
-
+
protected Button buildCheckBox(Composite parent, int horizontalSpan, String text) {
- return buildButton(parent, horizontalSpan, text, SWT.CHECK);
+ return this.buildButton(parent, horizontalSpan, text, SWT.CHECK);
}
-
+
protected Button buildRadioButton(Composite parent, int horizontalSpan, String text) {
- return buildButton(parent, horizontalSpan, text, SWT.RADIO);
+ return this.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);
@@ -204,11 +207,11 @@ public abstract class JptProjectPropertiesPage
button.setLayoutData(gd);
return button;
}
-
+
protected Combo buildDropDown(Composite parent) {
- return buildDropDown(parent, 1);
+ return this.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);
@@ -216,7 +219,7 @@ public abstract class JptProjectPropertiesPage
combo.setLayoutData(gd);
return combo;
}
-
+
protected Label buildLabel(Composite parent, String text) {
Label label = new Label(parent, SWT.LEFT);
label.setText(text);
@@ -225,7 +228,7 @@ public abstract class JptProjectPropertiesPage
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);
@@ -234,8 +237,8 @@ public abstract class JptProjectPropertiesPage
link.setText(text);
return link;
}
-
-
+
+
// ********** OK/Revert/Apply behavior **********
@Override
@@ -247,8 +250,10 @@ public abstract class JptProjectPropertiesPage
this.buildOkProgressMonitorDialog().run(true, false, this.buildOkRunnableWithProgress());
}
catch (InterruptedException ex) {
+ // should *not* happen...
+ Thread.currentThread().interrupt();
return false;
- }
+ }
catch (InvocationTargetException ex) {
throw new RuntimeException(ex.getTargetException());
}
@@ -256,172 +261,189 @@ public abstract class JptProjectPropertiesPage
return true;
}
- private IRunnableContext buildOkProgressMonitorDialog() {
+ protected 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);
- }
- }
- };
+ protected IRunnableWithProgress buildOkRunnableWithProgress() {
+ return new OkRunnableWithProgress();
}
-
- /* private */ IWorkspaceRunnable buildOkWorkspaceRunnable() {
- return new IWorkspaceRunnable() {
+
+ protected class OkRunnableWithProgress
+ implements 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(
+ new OkWorkspaceRunnable(),
+ ws.getRoot(),
+ IWorkspace.AVOID_UPDATE,
+ monitor
+ );
+ } catch (CoreException ex) {
+ throw new InvocationTargetException(ex);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+
+ /* class private */ class OkWorkspaceRunnable
+ implements IWorkspaceRunnable
+ {
public void run(IProgressMonitor monitor) throws CoreException {
- performOk_(monitor);
+ JptProjectPropertiesPage.this.performOk_(monitor);
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
}
- };
+ }
}
-
+
+
// ********** OK/Revert/Apply behavior **********
-
- void performOk_(IProgressMonitor monitor) throws CoreException {
- if (isBuffering()) {
- boolean rebuild = projectRebuildRequired();
+
+ /* CU private */ void performOk_(IProgressMonitor monitor) throws CoreException {
+ if (this.isBuffering()) {
+ boolean rebuild = this.projectRebuildRequired();
this.trigger.accept();
if (rebuild) {
- rebuildProject();
+ this.rebuildProject();
}
this.getProject().build(IncrementalProjectBuilder.FULL_BUILD, monitor);
}
}
-
+
protected abstract boolean projectRebuildRequired();
-
- protected abstract void rebuildProject();
-
+
+ protected abstract void rebuildProject() throws CoreException;
+
/**
* Return whether any of the models are buffering a change.
*/
private boolean isBuffering() {
- for (BufferedWritablePropertyValueModel<?> model : buildBufferedModels()) {
+ for (BufferedWritablePropertyValueModel<?> model : this.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();
+ this.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$
- }
- };
+ return new ValidationListener();
}
-
+
+ /* CU private */ class ValidationListener
+ extends AbstractChangeListener
+ {
+ @Override
+ protected void modelChanged() {
+ JptProjectPropertiesPage.this.validate();
+ }
+ }
+
protected void validate() {
- if ( ! getControl().isDisposed()) {
- updateValidation();
+ if ( ! this.getControl().isDisposed()) {
+ this.updateValidation();
}
}
private void engageValidationListener() {
- for (Model model : buildValidationModels()) {
+ for (Model model : this.buildValidationModels()) {
model.addChangeListener(this.validationListener);
}
}
-
+
protected abstract Model[] buildValidationModels();
-
+
private void disengageValidationListener() {
- for (Model model : buildReverseValidationModels()) {
+ for (Model model : this.buildReverseValidationModels()) {
model.removeChangeListener(this.validationListener);
}
}
-
+
protected Model[] buildReverseValidationModels() {
- return ArrayTools.reverse(buildValidationModels());
+ return ArrayTools.reverse(this.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<Integer, ArrayList<IStatus>> statuses = new HashMap<Integer, ArrayList<IStatus>>();
statuses.put(ERROR_STATUS, new ArrayList<IStatus>());
statuses.put(WARNING_STATUS, new ArrayList<IStatus>());
statuses.put(INFO_STATUS, new ArrayList<IStatus>());
- 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);
+ statuses.put(OK_STATUS, new ArrayList<IStatus>());
+
+ /* library provider */
+ this.addStatus(super.performValidation(), statuses);
+ this.performValidation(statuses);
+
+ ArrayList<IStatus> list = statuses.get(ERROR_STATUS);
+ if ( ! list.isEmpty()) {
+ return list.get(0);
}
- else if ( ! statuses.get(INFO_STATUS).isEmpty()) {
- return statuses.get(INFO_STATUS).get(0);
+ list = statuses.get(WARNING_STATUS);
+ if ( ! list.isEmpty()) {
+ return list.get(0);
}
- else {
- return statuses.get(OK_STATUS).get(0);
+ list = statuses.get(INFO_STATUS);
+ if ( ! list.isEmpty()) {
+ return list.get(0);
}
+ return Status.OK_STATUS;
}
-
- protected void performValidation(Map<Integer, ArrayList<IStatus>> statuses) {
- /* library provider */
- IStatus lpStatus = super.performValidation();
- statuses.get(Integer.valueOf(lpStatus.getSeverity())).add(lpStatus);
+
+ protected abstract void performValidation(Map<Integer, ArrayList<IStatus>> statuses);
+
+ protected void addStatus(IStatus status, Map<Integer, ArrayList<IStatus>> statuses) {
+ statuses.get(Integer.valueOf(status.getSeverity())).add(status);
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/DisposeAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/DisposeAdapter.java
new file mode 100644
index 0000000000..a765a55feb
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/DisposeAdapter.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.swt;
+
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+
+/**
+ * Convenience SWT dispose listener.
+ */
+public class DisposeAdapter
+ implements DisposeListener
+{
+ public void widgetDisposed(DisposeEvent e) {
+ // NOP
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java
index fe2063799f..743d8745e4 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java
@@ -18,6 +18,7 @@ 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.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
@@ -35,23 +36,97 @@ import org.eclipse.ui.forms.widgets.ScrolledForm;
public class SWTUtil {
/**
- * Causes the <code>run()</code> 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
- * <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- * @see #syncExec
+ * @see Display#asyncExec(Runnable)
+ * @see #syncExec(Runnable)
+ * @see #execute(Runnable)
*/
public static void asyncExec(Runnable runnable) {
getStandardDisplay().asyncExec(runnable);
}
/**
+ * @see Display#syncExec(Runnable)
+ * @see #asyncExec(Runnable)
+ * @see #execute(Runnable)
+ */
+ public static void syncExec(Runnable runnable) {
+ getStandardDisplay().syncExec(runnable);
+ }
+
+ /**
+ * Execute the specified runnable if the current thread is the UI thread;
+ * otherwise asynchrounously dispatch the runnable to the UI thread,
+ * returning immediately. This is useful for event handlers when it is not
+ * obviously whether the events are fired on the UI thread.
+ *
+ * @see Display#asyncExec(Runnable)
+ * @see #asyncExec(Runnable)
+ * @see #syncExec(Runnable)
+ */
+ public static void execute(Runnable runnable) {
+ Display display = Display.getCurrent();
+ if (display != null) {
+ // the current thread is the UI thread
+ runnable.run();
+ } else {
+ Display.getDefault().asyncExec(runnable);
+ }
+ }
+
+ /**
+ * Execute the specified runnable if the current thread is the specified
+ * viewer's thread;
+ * otherwise asynchrounously dispatch the runnable to the viewer's thread,
+ * returning immediately. This is useful for event handlers when it is not
+ * obviously whether the events are fired on the viewer's thread.
+ *
+ * @see #execute(Runnable)
+ * @see Display#asyncExec(Runnable)
+ * @see #asyncExec(Runnable)
+ * @see #syncExec(Runnable)
+ */
+ public static void execute(Viewer viewer, Runnable runnable) {
+ execute(viewer.getControl(), runnable);
+ }
+
+ /**
+ * Execute the specified runnable if the current thread is the specified
+ * control's thread;
+ * otherwise asynchrounously dispatch the runnable to the control's thread,
+ * returning immediately. This is useful for event handlers when it is not
+ * obviously whether the events are fired on the control's thread.
+ *
+ * @see #execute(Runnable)
+ * @see Display#asyncExec(Runnable)
+ * @see #asyncExec(Runnable)
+ * @see #syncExec(Runnable)
+ */
+ public static void execute(Control control, Runnable runnable) {
+ execute(control.getDisplay(), runnable);
+ }
+
+ /**
+ * Execute the specified runnable if the current thread is the specified
+ * display's thread;
+ * otherwise asynchrounously dispatch the runnable to the display's thread,
+ * returning immediately. This is useful for event handlers when it is not
+ * obviously whether the events are fired on the display's thread.
+ *
+ * @see #execute(Runnable)
+ * @see Display#asyncExec(Runnable)
+ * @see #asyncExec(Runnable)
+ * @see #syncExec(Runnable)
+ */
+ public static void execute(Display display, Runnable runnable) {
+ if (display.getThread() == Thread.currentThread()) {
+ // the current thread is the display's thread
+ runnable.run();
+ } else {
+ display.asyncExec(runnable);
+ }
+ }
+
+ /**
* Tweaks the given <code>Combo</code> to remove the default value when the
* widget receives the focus and to show the default when the widget loses
* the focus.
@@ -73,40 +148,26 @@ public class SWTUtil {
* @return The shell, never <code>null</code>
*/
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());
+ if (shell != null) {
+ return shell;
}
- return shell;
+ // No shell could be found, revert back to the active workbench window
+ shell = getWorkbench().getActiveWorkbenchWindow().getShell();
+ return (shell != null) ? shell : new 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 <code>null</code> otherwise the default
- * display is returned
+ * Return the "standard" {@link Display display}. Return the
+ * {@link Display#getCurrent() display associated with the current thread}
+ * if it is present; otherwise return the
+ * {@link Display#getDefault() default display}.
*/
- public static Display getStandardDisplay()
- {
+ public static Display getStandardDisplay() {
Display display = Display.getCurrent();
-
- if (display == null) {
- display = Display.getDefault();
- }
-
- return display;
+ return (display != null) ? display : Display.getDefault();
}
public static int getTableHeightHint(Table table, int rows) {
@@ -166,25 +227,13 @@ public class SWTUtil {
/**
- * Causes the <code>run()</code> 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 <code>true</code> if it's the UI event thread, <code>false</code>
* otherwise
*/
public static boolean uiThread() {
- return getStandardDisplay().getThread() == Thread.currentThread();
+ return Display.getCurrent() != null;
}
/**
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AbstractUiCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AbstractUiCommandExecutor.java
new file mode 100644
index 0000000000..ec8ffd6dcb
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AbstractUiCommandExecutor.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.utility;
+
+import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.utility.command.Command;
+import org.eclipse.jpt.common.utility.command.ExtendedCommandExecutor;
+import org.eclipse.jpt.common.utility.internal.command.CommandRunnable;
+import org.eclipse.jpt.common.utility.internal.command.SynchronizingCommand;
+
+/**
+ * Gather the tiny bit of common behavior.
+ */
+abstract class AbstractUiCommandExecutor
+ implements ExtendedCommandExecutor
+{
+ AbstractUiCommandExecutor() {
+ super();
+ }
+
+ Runnable buildRunnable(Command command) {
+ return new CommandRunnable(command);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+
+ /**
+ * A common way to put a time constraint on a command dispatched
+ * to the UI thread.
+ */
+ public boolean waitToExecute(Command command, long timeout) throws InterruptedException {
+ if (timeout == 0L) {
+ this.waitToExecute(command);
+ return true;
+ }
+
+ // configure the sync command to execute the client command
+ SynchronizingCommand syncCommand = new SynchronizingCommand(command);
+
+ // dispatch the sync command to the UI thread...
+ SWTUtil.asyncExec(this.buildRunnable(syncCommand));
+
+ // ...and wait for it to execute
+ try {
+ return syncCommand.waitForExecution(timeout);
+ } finally {
+ syncCommand.release();
+ }
+ }
+}
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
index 9a8b3aa0d8..d905f53b5d 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,22 +9,23 @@
******************************************************************************/
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;
+import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.utility.command.Command;
+import org.eclipse.jpt.common.utility.command.ExtendedCommandExecutor;
/**
- * 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.
+ * This command executor asynchronously executes a {@link Command command}
+ * on the UI thread.
+ * <p>
+ * This command executor allows a non-UI process to modify any objects
+ * associated with documents that are currently displayed in the UI.
*/
public final class AsynchronousUiCommandExecutor
- implements CommandExecutor
+ extends AbstractUiCommandExecutor
{
- public static final CommandExecutor INSTANCE = new AsynchronousUiCommandExecutor();
+ public static final ExtendedCommandExecutor INSTANCE = new AsynchronousUiCommandExecutor();
- public static CommandExecutor instance() {
+ public static ExtendedCommandExecutor instance() {
return INSTANCE;
}
@@ -34,16 +35,10 @@ public final class AsynchronousUiCommandExecutor
}
public void execute(Command command) {
- this.getDisplay().asyncExec(this.buildRunnable(command));
+ SWTUtil.asyncExec(this.buildRunnable(command));
}
- private Runnable buildRunnable(Command command) {
- return new CommandRunnable(command);
+ public void waitToExecute(Command command) {
+ SWTUtil.syncExec(this.buildRunnable(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/PageAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/PageAdapter.java
new file mode 100644
index 0000000000..ff7494bf92
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/PageAdapter.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.utility;
+
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.ui.IPageListener;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * Convenience implementation of {@link IPageListener}.
+ */
+public class PageAdapter
+ implements IPageListener
+{
+ public void pageOpened(IWorkbenchPage page) {
+ // do nothing
+ }
+ public void pageActivated(IWorkbenchPage page) {
+ // do nothing
+ }
+ public void pageClosed(IWorkbenchPage page) {
+ // do nothing
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/PartAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/PartAdapter.java
new file mode 100644
index 0000000000..527bea9abe
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/PartAdapter.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.utility;
+
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Convenience implementation of {@link IPartListener}.
+ */
+public class PartAdapter
+ implements IPartListener
+{
+ public void partOpened(IWorkbenchPart part) {
+ // do nothing
+ }
+ public void partBroughtToTop(IWorkbenchPart part) {
+ // do nothing
+ }
+ public void partActivated(IWorkbenchPart part) {
+ // do nothing
+ }
+ public void partDeactivated(IWorkbenchPart part) {
+ // do nothing
+ }
+ public void partClosed(IWorkbenchPart part) {
+ // do nothing
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/PartAdapter2.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/PartAdapter2.java
new file mode 100644
index 0000000000..25176a909d
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/PartAdapter2.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.utility;
+
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.IWorkbenchPartReference;
+
+/**
+ * Convenience implementation of {@link IPartListener2}.
+ */
+public class PartAdapter2
+ implements IPartListener2
+{
+ public void partOpened(IWorkbenchPartReference partRef) {
+ // do nothing
+ }
+ public void partActivated(IWorkbenchPartReference partRef) {
+ // do nothing
+ }
+ public void partBroughtToTop(IWorkbenchPartReference partRef) {
+ // do nothing
+ }
+ public void partVisible(IWorkbenchPartReference partRef) {
+ // do nothing
+ }
+ public void partInputChanged(IWorkbenchPartReference partRef) {
+ // do nothing
+ }
+ public void partHidden(IWorkbenchPartReference partRef) {
+ // do nothing
+ }
+ public void partDeactivated(IWorkbenchPartReference partRef) {
+ // do nothing
+ }
+ public void partClosed(IWorkbenchPartReference partRef) {
+ // do nothing
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/PropertyAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/PropertyAdapter.java
new file mode 100644
index 0000000000..039808a373
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/PropertyAdapter.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.utility;
+
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.ui.IPropertyListener;
+
+/**
+ * Convenience implementation of {@link IPropertyListener}.
+ */
+public class PropertyAdapter
+ implements IPropertyListener
+{
+ public void propertyChanged(Object source, int propId) {
+ // do nothing
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/SynchronousUiCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/SynchronousUiCommandExecutor.java
index 895dd212f3..d3be8f3190 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,22 +9,23 @@
******************************************************************************/
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;
+import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.utility.command.Command;
+import org.eclipse.jpt.common.utility.command.ExtendedCommandExecutor;
/**
- * 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.
+ * This command executor synchronously executes a {@link Command command}
+ * on the UI thread.
+ * <p>
+ * This command executor allows a non-UI process to modify any objects
+ * associated with documents that are currently displayed in the UI.
*/
public final class SynchronousUiCommandExecutor
- implements CommandExecutor
+ extends AbstractUiCommandExecutor
{
- public static final CommandExecutor INSTANCE = new SynchronousUiCommandExecutor();
+ public static final ExtendedCommandExecutor INSTANCE = new SynchronousUiCommandExecutor();
- public static CommandExecutor instance() {
+ public static ExtendedCommandExecutor instance() {
return INSTANCE;
}
@@ -34,16 +35,10 @@ public final class SynchronousUiCommandExecutor
}
public void execute(Command command) {
- this.getDisplay().syncExec(this.buildRunnable(command));
+ SWTUtil.syncExec(this.buildRunnable(command));
}
- private Runnable buildRunnable(Command command) {
- return new CommandRunnable(command);
+ public void waitToExecute(Command command) {
+ this.execute(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/WindowAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/WindowAdapter.java
new file mode 100644
index 0000000000..8a8e08a36c
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/WindowAdapter.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.utility;
+
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.ui.IWindowListener;
+import org.eclipse.ui.IWorkbenchWindow;
+
+/**
+ * Convenience implementation of {@link IWindowListener}.
+ */
+public class WindowAdapter
+ implements IWindowListener
+{
+ public void windowOpened(IWorkbenchWindow window) {
+ // do nothing
+ }
+ public void windowActivated(IWorkbenchWindow window) {
+ // do nothing
+ }
+ public void windowDeactivated(IWorkbenchWindow window) {
+ // do nothing
+ }
+ public void windowClosed(IWorkbenchWindow window) {
+ // do nothing
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/BooleanStateController.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/BooleanStateController.java
index 5ea988de7c..c8c5800cc4 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,12 @@
package org.eclipse.jpt.common.ui.internal.utility.swt;
import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.common.ui.internal.swt.DisposeAdapter;
+import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
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.PropertyChangeAdapter;
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.swt.events.DisposeEvent;
@@ -89,29 +93,31 @@ abstract class BooleanStateController {
}
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$
- }
- };
+ return new BooleanChangeListener();
+ }
+
+ /* CU private */ class BooleanChangeListener
+ extends PropertyChangeAdapter
+ {
+ @Override
+ public void propertyChanged(PropertyChangeEvent event) {
+ BooleanStateController.this.booleanChanged(event);
+ }
}
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$
- }
- };
+ return new ControlDisposeListener();
+ }
+
+ /* CU private */ class ControlDisposeListener
+ extends DisposeAdapter
+ {
+ @Override
+ 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);
+ }
}
@@ -154,15 +160,35 @@ abstract class BooleanStateController {
control.removeDisposeListener(this.controlDisposeListener);
}
- private void setControlState(Boolean b) {
- this.setControlState(this.booleanValue(b));
+ private void setControlState(Boolean controlState) {
+ this.setControlState(this.booleanValue(controlState));
}
- abstract void setControlState(boolean b);
+ abstract void setControlState(boolean controlState);
- void setControlState(Control control, boolean b) {
+ void setControlState(Control control, boolean controlState) {
+ SWTUtil.execute(new SetControlStateRunnable(control, controlState));
+ }
+
+ /* CU private */ class SetControlStateRunnable
+ extends RunnableAdapter
+ {
+ private final Control control;
+ private final boolean controlState;
+ SetControlStateRunnable(Control control, boolean controlState) {
+ super();
+ this.control = control;
+ this.controlState = controlState;
+ }
+ @Override
+ public void run() {
+ BooleanStateController.this.setControlState_(this.control, this.controlState);
+ }
+ }
+
+ /* CU private */ void setControlState_(Control control, boolean controlState) {
if ( ! control.isDisposed()) {
- this.adapter.setState(control, b);
+ this.adapter.setState(control, controlState);
}
}
@@ -182,7 +208,6 @@ abstract class BooleanStateController {
// ********** adapter interface **********
interface Adapter {
- void setState(Control control, boolean b);
+ void setState(Control control, boolean controlState);
}
-
}
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
index aa52a80af1..0c48ad96b5 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,12 +10,12 @@
package org.eclipse.jpt.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.CollectionChangeAdapter;
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;
@@ -75,55 +75,59 @@ final class MultiControlBooleanStateController
// ********** initialization **********
private CollectionChangeListener buildControlsListener() {
- return new CollectionChangeListener() {
- @SuppressWarnings("unchecked")
- public void itemsAdded(CollectionAddEvent event) {
- MultiControlBooleanStateController.this.addControls((Iterable<? extends Control>) event.getItems());
- }
- @SuppressWarnings("unchecked")
- public void itemsRemoved(CollectionRemoveEvent event) {
- MultiControlBooleanStateController.this.removeControls((Iterable<? extends Control>) event.getItems());
- }
- public void collectionCleared(CollectionClearEvent event) {
- MultiControlBooleanStateController.this.clearControls();
- }
- @SuppressWarnings("unchecked")
- public void collectionChanged(CollectionChangeEvent event) {
- MultiControlBooleanStateController.this.clearControls();
- MultiControlBooleanStateController.this.addControls((Iterable<? extends Control>) event.getCollection());
- }
- @Override
- public String toString() {
- return "controls listener"; //$NON-NLS-1$
- }
- };
+ return new ControlsListener();
+ }
+
+ /* CU private */ class ControlsListener
+ extends CollectionChangeAdapter
+ {
+ @Override
+ @SuppressWarnings("unchecked")
+ public void itemsAdded(CollectionAddEvent event) {
+ MultiControlBooleanStateController.this.addControls((Iterable<? extends Control>) event.getItems());
+ }
+ @Override
+ @SuppressWarnings("unchecked")
+ public void itemsRemoved(CollectionRemoveEvent event) {
+ MultiControlBooleanStateController.this.removeControls((Iterable<? extends Control>) event.getItems());
+ }
+ @Override
+ public void collectionCleared(CollectionClearEvent event) {
+ MultiControlBooleanStateController.this.clearControls();
+ }
+ @Override
+ @SuppressWarnings("unchecked")
+ public void collectionChanged(CollectionChangeEvent event) {
+ MultiControlBooleanStateController.this.clearControls();
+ MultiControlBooleanStateController.this.addControls((Iterable<? extends Control>) event.getCollection());
+ }
}
// ********** controls **********
@Override
- void setControlState(boolean b) {
+ void setControlState(boolean controlState) {
for (Control control : this.controls) {
- this.setControlState(control, b);
+ this.setControlState(control, controlState);
}
}
/* CU private */ void addControls(Iterable<? extends Control> controls_) {
- boolean b = this.getBooleanValue();
for (Control control : controls_) {
- this.addControl(control, b);
+ this.addControl(control);
}
}
- private void addControl(Control control, boolean b) {
+ private void addControl(Control control) {
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);
+ // wait until the models are engaged to get the boolean value... :-)
+ this.setControlState(control, this.getBooleanValue());
} else {
throw new IllegalArgumentException("duplicate control: " + control); //$NON-NLS-1$
}
@@ -153,5 +157,4 @@ final class MultiControlBooleanStateController
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/SimpleBooleanStateController.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SimpleBooleanStateController.java
index 0b38bb3c1d..ea036488b5 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -55,8 +55,8 @@ final class SimpleBooleanStateController
// ********** controls **********
@Override
- void setControlState(boolean b) {
- this.setControlState(this.control, b);
+ void setControlState(boolean controlState) {
+ this.setControlState(this.control, controlState);
}
@Override
@@ -64,5 +64,4 @@ final class SimpleBooleanStateController
super.controlDisposed(c);
this.disengageBooleanModel();
}
-
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java
index 6703d6a3a0..f09d1075bb 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -127,31 +127,25 @@ public abstract class IntegerCombo<T extends Model>
);
}
- private String getDefaultValueString() {
+ /* CU private */ String getDefaultValueString() {
return this.defaultValueHolder.getValue();
}
protected WritablePropertyValueModel<String> buildSelectedItemStringHolder() {
return new TransformationWritablePropertyValueModel<Integer, String>(buildSelectedItemHolder()) {
@Override
- protected String transform(Integer value) {
- return value == null ?
- getDefaultValueString()
- :
- value.toString();
+ protected String transform(Integer v) {
+ return (v == null) ? getDefaultValueString() : v.toString();
}
@Override
- protected Integer reverseTransform_(String value) {
- int intLength;
+ protected Integer reverseTransform_(String v) {
try {
- intLength = Integer.parseInt(value);
- }
- catch (NumberFormatException e) {
- //if the default is selected from the combo, set length to null
+ return Integer.valueOf(v);
+ } catch (NumberFormatException ex) {
+ // if the default is selected from the combo, set length to null
return null;
}
- return Integer.valueOf(intLength);
}
};
}
@@ -184,5 +178,4 @@ public abstract class IntegerCombo<T extends Model>
e.doit = false;
}
}
-
}
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
index c841976fc0..82313fb8fa 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -23,13 +23,18 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
* @version 2.0
* @since 2.0
*/
-public class PropertySheetWidgetFactory extends FormWidgetFactory {
+public class PropertySheetWidgetFactory
+ extends FormWidgetFactory
+{
+ /**
+ * Creates a new <code>PropertySheetWidgetFactory</code>.
+ */
+ public PropertySheetWidgetFactory() {
+ this(new TabbedPropertySheetWidgetFactory());
+ }
/**
* Creates a new <code>PropertySheetWidgetFactory</code>.
- *
- * @param widgetFactory The actual factory responsible for creating the new
- * widgets
*/
public PropertySheetWidgetFactory(TabbedPropertySheetWidgetFactory widgetFactory) {
super(widgetFactory);
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<Object, ItemContentProvider> itemContentProviders;
-
- private final Map<Object, ItemLabelProvider> 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<Object, ItemContentProvider>();
- this.itemLabelProviders = new HashMap<Object, ItemLabelProvider>();
- }
-
-
- 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/ExtendedLabelProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ExtendedLabelProvider.java
new file mode 100644
index 0000000000..6a96068edf
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ExtendedLabelProvider.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.jface;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.ui.navigator.IDescriptionProvider;
+
+/**
+ * Combine provider interfaces to be implemented by a single provider that can
+ * be used as both a label and description provider for a tree.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ExtendedLabelProvider
+ extends ILabelProvider, IDescriptionProvider
+{
+ // combine interfaces
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemExtendedLabelProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemExtendedLabelProvider.java
new file mode 100644
index 0000000000..ef9445953b
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemExtendedLabelProvider.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.jface;
+
+/**
+ * Implementations of this interface can be used to maintain the label (image
+ * and text) and description of a specific item. The implementation will monitor
+ * the item for any changes that affect the description and forward them
+ * appropriately to the {@link Manager}.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider
+ * @see org.eclipse.ui.navigator.IDescriptionProvider
+ */
+public interface ItemExtendedLabelProvider
+ extends ItemLabelProvider
+{
+ /**
+ * Return the description for the provider's item.
+ *
+ * @see org.eclipse.ui.navigator.IDescriptionProvider#getDescription(Object)
+ */
+ String getDescription();
+
+ /**
+ * An item extended label provider's manager is notified whenever the item's
+ * description has changed.
+ */
+ interface Manager
+ extends ItemLabelProvider.Manager
+ {
+ /**
+ * The description for the specified item has changed. Update appropriately.
+ */
+ void updateDescription(Object item);
+ }
+}
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/ItemExtendedLabelProviderFactory.java
index a9c951d816..ad675de6f8 100644
--- 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/ItemExtendedLabelProviderFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,17 +10,17 @@
package org.eclipse.jpt.common.ui.jface;
/**
- * Factory interface used to describe how to build {@link ItemContentProvider}s
- * for a {@link DelegatingContentAndLabelProvider}
- *
+ * Factory interface for constructing item extended label providers.
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*/
-public interface ItemContentProviderFactory
-{
- ItemContentProvider buildItemContentProvider(Object item,
- DelegatingContentAndLabelProvider contentAndLabelProvider);
+public interface ItemExtendedLabelProviderFactory {
+ /**
+ * Build an extended label provider for the specified item.
+ */
+ ItemExtendedLabelProvider buildProvider(Object item, ItemExtendedLabelProvider.Manager manager);
}
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
index 592a8a6bbe..921a8e5712 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -12,36 +12,50 @@ 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
- *
+ * Implementations of this interface can be used to maintain the label (image,
+ * and text) of a specific item. The implementation will monitor
+ * the item for any changes that affect the label and forward them appropriately
+ * to the {@link Manager}.
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider
*/
-public interface ItemLabelProvider
-{
+public interface ItemLabelProvider {
/**
- * Return the image for the item
+ * Return the image for the provider's item.
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(Object)
*/
Image getImage();
/**
- * Return the text for the item
+ * Return the text for the provider's item.
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(Object)
*/
public String getText();
/**
- * Return the description for the item
+ * Dispose the item label provider.
+ * Remove any item listeners as appropriate.
*/
- public String getDescription();
-
+ void dispose();
+
+
/**
- * Dispose of this label provider, cleaning up all references, listeners, etc.
+ * An item label provider's manager is notified whenever the item's
+ * label has changed.
*/
- void dispose();
+ interface Manager {
+ /**
+ * The label (image and/or text) for the specified item has changed.
+ * Update appropriately.
+ */
+ void updateLabel(Object item);
+ }
}
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
index db61b3905f..36c25d38a4 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,17 +10,17 @@
package org.eclipse.jpt.common.ui.jface;
/**
- * Factory interface used to describe how to build IItemLabelProviders
- * for a DelegatingContentAndLabelProvider
- *
+ * Factory interface for constructing item label providers.
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*/
-public interface ItemLabelProviderFactory
-{
- ItemLabelProvider buildItemLabelProvider(Object item,
- DelegatingContentAndLabelProvider contentAndLabelProvider);
+public interface ItemLabelProviderFactory {
+ /**
+ * Build a label provider for the specified item.
+ */
+ ItemLabelProvider buildProvider(Object item, ItemLabelProvider.Manager manager);
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemStructuredContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemStructuredContentProvider.java
new file mode 100644
index 0000000000..0ddbfe980c
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemStructuredContentProvider.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.jface;
+
+import java.io.Serializable;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+/**
+ * Implementations of this interface can be used to maintain the elements
+ * of a specific input element. The implementation will monitor
+ * the item for any changes that affect the elements and forward them
+ * appropriately to the {@link Manager}.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider
+ */
+public interface ItemStructuredContentProvider {
+ /**
+ * Return the input element's elements.
+ * <strong>NB:</strong>
+ * When this method is called, the item is an <em>input</em> element.
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, Object, Object)
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(Object)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(Object)
+ */
+ Object[] getElements();
+
+ /**
+ * Dispose the item content provider.
+ * Remove any item listeners as appropriate.
+ */
+ void dispose();
+
+
+ /**
+ * Convenience constant for when no children are present.
+ */
+ Object[] EMPTY_ARRAY = new Object[0];
+
+
+ /**
+ * An item structured content provider's manager is notified whenever the
+ * input element's elements have changed.
+ */
+ interface Manager {
+ /**
+ * The elements for the specified input element have changed.
+ * Update appropriately.
+ */
+ void updateElements(Object inputElement);
+
+ /**
+ * The specified element has been removed from the input element.
+ * Dispose of the element's providers, if necessary.
+ */
+ void dispose(Object element);
+ }
+
+
+ /**
+ * A "null" item structured content provider that has no elements.
+ */
+ final class Null
+ implements ItemStructuredContentProvider, Serializable
+ {
+ public static final ItemStructuredContentProvider INSTANCE = new Null();
+ public static ItemStructuredContentProvider instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Null() {
+ super();
+ }
+ public Object[] getElements() {
+ return EMPTY_ARRAY;
+ }
+ public void dispose() {
+ // NOP
+ }
+ @Override
+ public String toString() {</