This commit was manufactured by cvs2svn to create branch 'perf_34x'.
Sprout from master 2008-04-04 20:21:20 UTC DJ Houghton <dj> 'Bug 206227 - Cannot debug session tests using wiki instructions'
Delete:
bundles/org.eclipse.core.boot/.classpath
bundles/org.eclipse.core.boot/.cvsignore
bundles/org.eclipse.core.boot/.project
bundles/org.eclipse.core.boot/.settings/org.eclipse.jdt.core.prefs
bundles/org.eclipse.core.boot/META-INF/MANIFEST.MF
bundles/org.eclipse.core.boot/about.html
bundles/org.eclipse.core.boot/build.properties
bundles/org.eclipse.core.boot/plugin.properties
bundles/org.eclipse.core.boot/readme.txt
bundles/org.eclipse.core.contenttype/.classpath
bundles/org.eclipse.core.contenttype/.cvsignore
bundles/org.eclipse.core.contenttype/.options
bundles/org.eclipse.core.contenttype/.project
bundles/org.eclipse.core.contenttype/.settings/org.eclipse.core.resources.prefs
bundles/org.eclipse.core.contenttype/.settings/org.eclipse.jdt.core.prefs
bundles/org.eclipse.core.contenttype/.settings/org.eclipse.jdt.ui.prefs
bundles/org.eclipse.core.contenttype/META-INF/MANIFEST.MF
bundles/org.eclipse.core.contenttype/about.html
bundles/org.eclipse.core.contenttype/build.properties
bundles/org.eclipse.core.contenttype/plugin.properties
bundles/org.eclipse.core.contenttype/plugin.xml
bundles/org.eclipse.core.contenttype/schema/contentTypes.exsd
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/Activator.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/BasicDescription.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentDescription.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentMessages.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentType.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeBuilder.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeCatalog.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeHandler.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeManager.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeMatcher.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeSettings.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeVisitor.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/DefaultDescription.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/FileSpec.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/IContentConstants.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/IContentTypeInfo.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ILazySource.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/LazyInputStream.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/LazyReader.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/LowLevelIOException.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/TextContentDescriber.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/Util.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/XMLContentDescriber.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/XMLRootHandler.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/messages.properties
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/BinarySignatureDescriber.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentDescriber.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentDescription.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentType.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentTypeManager.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentTypeMatcher.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentTypeSettings.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/ITextContentDescriber.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/XMLRootElementContentDescriber.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/XMLRootElementContentDescriber2.java
bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/package.html
bundles/org.eclipse.core.expressions/.classpath
bundles/org.eclipse.core.expressions/.cvsignore
bundles/org.eclipse.core.expressions/.options
bundles/org.eclipse.core.expressions/.project
bundles/org.eclipse.core.expressions/.settings/org.eclipse.jdt.core.prefs
bundles/org.eclipse.core.expressions/.settings/org.eclipse.jdt.ui.prefs
bundles/org.eclipse.core.expressions/.settings/org.eclipse.pde.prefs
bundles/org.eclipse.core.expressions/.template
bundles/org.eclipse.core.expressions/META-INF/MANIFEST.MF
bundles/org.eclipse.core.expressions/about.html
bundles/org.eclipse.core.expressions/apichanges_core-expressions.html
bundles/org.eclipse.core.expressions/build.properties
bundles/org.eclipse.core.expressions/buildnotes_core-expressions.html
bundles/org.eclipse.core.expressions/component.xml
bundles/org.eclipse.core.expressions/notes/r3.3/apichanges_core-expressions.html
bundles/org.eclipse.core.expressions/old_build_notes.html
bundles/org.eclipse.core.expressions/plugin.properties
bundles/org.eclipse.core.expressions/plugin.xml
bundles/org.eclipse.core.expressions/schema/definitions.exsd
bundles/org.eclipse.core.expressions/schema/expressionLanguage.exsd
bundles/org.eclipse.core.expressions/schema/propertyTesters.exsd
bundles/org.eclipse.core.expressions/scripts/exportplugin.xml
bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ElementHandler.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationContext.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationResult.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/Expression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionConverter.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionInfo.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionTagNames.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ICountable.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IEvaluationContext.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IIterable.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IPropertyTester.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IVariableResolver.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/PropertyTester.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/package.html
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AdaptExpression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AndExpression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CompositeExpression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CountExpression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefaultVariable.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefinitionRegistry.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EnablementExpression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EqualsExpression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.properties
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionPlugin.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionStatus.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Expressions.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/InstanceofExpression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/IterateExpression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Messages.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/NotExpression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/OrExpression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Property.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyCache.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyTesterDescriptor.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ReferenceExpression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ResolveExpression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/StandardElementHandler.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/SystemTestExpression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TestExpression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtension.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtensionManager.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/WithExpression.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/propertytester/PlatformPropertyTester.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/LRUCache.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/ToStringSorter.java
bundles/org.eclipse.core.jobs/.classpath
bundles/org.eclipse.core.jobs/.cvsignore
bundles/org.eclipse.core.jobs/.options
bundles/org.eclipse.core.jobs/.project
bundles/org.eclipse.core.jobs/.settings/org.eclipse.core.resources.prefs
bundles/org.eclipse.core.jobs/.settings/org.eclipse.jdt.core.prefs
bundles/org.eclipse.core.jobs/.settings/org.eclipse.jdt.ui.prefs
bundles/org.eclipse.core.jobs/META-INF/MANIFEST.MF
bundles/org.eclipse.core.jobs/about.html
bundles/org.eclipse.core.jobs/build.properties
bundles/org.eclipse.core.jobs/plugin.properties
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Deadlock.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/DeadlockDetector.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/ImplicitJobs.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/InternalJob.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobActivator.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobChangeEvent.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobListeners.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobManager.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobMessages.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobOSGiUtils.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobQueue.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobStatus.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/LockManager.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/ObjectMap.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/OrderedLock.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Queue.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Semaphore.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/StringPool.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/ThreadJob.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Worker.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/WorkerPool.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/messages.properties
bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobChangeEvent.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobChangeListener.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobManager.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobStatus.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/ILock.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/ISchedulingRule.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/Job.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/JobChangeAdapter.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/LockListener.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/MultiRule.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/ProgressProvider.java
bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/package.html
bundles/org.eclipse.core.runtime.compatibility.auth/.classpath
bundles/org.eclipse.core.runtime.compatibility.auth/.cvsignore
bundles/org.eclipse.core.runtime.compatibility.auth/.project
bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.core.resources.prefs
bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.jdt.core.prefs
bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.pde.core.prefs
bundles/org.eclipse.core.runtime.compatibility.auth/META-INF/MANIFEST.MF
bundles/org.eclipse.core.runtime.compatibility.auth/about.html
bundles/org.eclipse.core.runtime.compatibility.auth/build.properties
bundles/org.eclipse.core.runtime.compatibility.auth/plugin.properties
bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Activator.java
bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/AuthorizationDatabase.java
bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/AuthorizationHandler.java
bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Cipher.java
bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/CipherInputStream.java
bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/CipherOutputStream.java
bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Messages.java
bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/URLTool.java
bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/messages.properties
bundles/org.eclipse.core.runtime.compatibility.registry/.classpath
bundles/org.eclipse.core.runtime.compatibility.registry/.cvsignore
bundles/org.eclipse.core.runtime.compatibility.registry/.project
bundles/org.eclipse.core.runtime.compatibility.registry/.settings/org.eclipse.jdt.core.prefs
bundles/org.eclipse.core.runtime.compatibility.registry/.settings/org.eclipse.ltk.core.refactoring.prefs
bundles/org.eclipse.core.runtime.compatibility.registry/META-INF/MANIFEST.MF
bundles/org.eclipse.core.runtime.compatibility.registry/about.html
bundles/org.eclipse.core.runtime.compatibility.registry/build.properties
bundles/org.eclipse.core.runtime.compatibility.registry/classes/org/eclipse/core/runtime/IPluginDescriptor.class
bundles/org.eclipse.core.runtime.compatibility.registry/fragment.properties
bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/BundleHelper.java
bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionHandle.java
bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionPointHandle.java
bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/RegistryCompatibilityHelper.java
bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtension.java
bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtensionPoint.java
bundles/org.eclipse.core.runtime.compatibility/.classpath
bundles/org.eclipse.core.runtime.compatibility/.cvsignore
bundles/org.eclipse.core.runtime.compatibility/.project
bundles/org.eclipse.core.runtime.compatibility/.settings/org.eclipse.core.resources.prefs
bundles/org.eclipse.core.runtime.compatibility/.settings/org.eclipse.jdt.core.prefs
bundles/org.eclipse.core.runtime.compatibility/.settings/org.eclipse.jdt.ui.prefs
bundles/org.eclipse.core.runtime.compatibility/META-INF/MANIFEST.MF
bundles/org.eclipse.core.runtime.compatibility/about.html
bundles/org.eclipse.core.runtime.compatibility/build.properties
bundles/org.eclipse.core.runtime.compatibility/plugin.properties
bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/boot/BootLoader.java
bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/boot/IPlatformConfiguration.java
bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/boot/IPlatformRunnable.java
bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/FeatureEntry.java
bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/PlatformConfiguration.java
bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/SiteEntry.java
bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/SitePolicy.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/IModel.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/PluginMap.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/PluginParser.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/RegistryLoader.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/RegistryResolver.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ConfigurationElementModel.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ConfigurationPropertyModel.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ExtensionModel.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ExtensionPointModel.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/Factory.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/LibraryModel.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginDescriptorModel.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginFragmentModel.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginModel.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginModelObject.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginPrerequisiteModel.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginRegistryModel.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/URLModel.java
bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/package.html
bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/compatibility/PluginActivator.java
bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/CompatibilityActivator.java
bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/DefaultPlugin.java
bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/DevClassPathHelper.java
bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/InternalPlatform.java
bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/Library.java
bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginClassLoader.java
bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginDescriptor.java
bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginPrerequisite.java
bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginRegistry.java
bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/Policy.java
bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/messages.properties
bundles/org.eclipse.core.runtime/.classpath
bundles/org.eclipse.core.runtime/.cvsignore
bundles/org.eclipse.core.runtime/.options
bundles/org.eclipse.core.runtime/.project
bundles/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs
bundles/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs
bundles/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs
bundles/org.eclipse.core.runtime/META-INF/MANIFEST.MF
bundles/org.eclipse.core.runtime/about.html
bundles/org.eclipse.core.runtime/build.properties
bundles/org.eclipse.core.runtime/component.xml
bundles/org.eclipse.core.runtime/plugin.properties
bundles/org.eclipse.core.runtime/plugin.xml
bundles/org.eclipse.core.runtime/schema/contentTypes.exsd
bundles/org.eclipse.core.runtime/schema/preferences.exsd
bundles/org.eclipse.core.runtime/scripts/src-runtime.jardesc
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/legacy/InitLegacyPreferences.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/legacy/PreferenceForwarder.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/legacy/ProductPreferencesService.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/CompatibilityHelper.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Log.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Messages.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PerformanceStatsProcessor.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformActivator.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformLogWriter.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Product.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/messages.properties
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILibrary.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILog.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPlatformRunnable.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPluginDescriptor.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPluginPrerequisite.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPluginRegistry.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProduct.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProductProvider.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/PerformanceStats.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Platform.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Plugin.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Preferences.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/package.html
bundles/org.eclipse.core.tools/.classpath
bundles/org.eclipse.core.tools/.cvsignore
bundles/org.eclipse.core.tools/.options
bundles/org.eclipse.core.tools/.project
bundles/org.eclipse.core.tools/.settings/org.eclipse.core.resources.prefs
bundles/org.eclipse.core.tools/.settings/org.eclipse.jdt.core.prefs
bundles/org.eclipse.core.tools/.settings/org.eclipse.jdt.ui.prefs
bundles/org.eclipse.core.tools/META-INF/MANIFEST.MF
bundles/org.eclipse.core.tools/about.html
bundles/org.eclipse.core.tools/about.ini
bundles/org.eclipse.core.tools/about.mappings
bundles/org.eclipse.core.tools/about.properties
bundles/org.eclipse.core.tools/build.properties
bundles/org.eclipse.core.tools/cpl-v10.html
bundles/org.eclipse.core.tools/doc/hglegal2002.htm
bundles/org.eclipse.core.tools/doc/ngibmcpy2002.gif
bundles/org.eclipse.core.tools/doc/readme.html
bundles/org.eclipse.core.tools/icons/classes.gif
bundles/org.eclipse.core.tools/icons/clear.gif
bundles/org.eclipse.core.tools/icons/collapseall.gif
bundles/org.eclipse.core.tools/icons/datasheet.gif
bundles/org.eclipse.core.tools/icons/plugin.gif
bundles/org.eclipse.core.tools/icons/refresh.gif
bundles/org.eclipse.core.tools/icons/req_plugins_obj.gif
bundles/org.eclipse.core.tools/icons/reset.gif
bundles/org.eclipse.core.tools/icons/spy.gif
bundles/org.eclipse.core.tools/icons/trace.gif
bundles/org.eclipse.core.tools/icons/zoom.gif
bundles/org.eclipse.core.tools/plugin.xml
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/AbstractCopySelectionAction.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/AbstractTreeContentProvider.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/BaseTextView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ByteUtil.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ClearTextAction.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CollapseAllAction.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CopyStructuredSelectionAction.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CopyTextSelectionAction.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CoreToolsPlugin.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/DeepSize.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ErrorUtil.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/GlobalAction.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/IFlattable.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ISorter.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ITreeNodeVisitor.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/Messages.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/SelectAllAction.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/SpyView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TableSelectionProviderDecorator.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TableWithTotalView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TreeContentProviderNode.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TreeSelectionProviderDecorator.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TreeTextOperationTarget.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/messages.properties
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/AbstractDumper.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/Dump.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpContentsView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpException.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpSummaryView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpTool.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumperFactory.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/IDump.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/IDumper.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/IStringDumpingStrategy.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataFileFilter.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataPerspective.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataTreeContentProvider.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataTreeView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MeteredInputStream.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MultiStrategyDumper.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/PartialDumpException.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/StateDumper.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/ConvertMessageBundleAction.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/GotoResourceAction.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/IntegerMap.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/MessageBundleRefactoring.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/NLSFileChange.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/PropertyFileConverter.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/RemoveUnusedMessages.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/RemoveUnusedMessagesAction.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsViewContentProvider.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsViewLabelProvider.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsViewSorter.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ContentTypePropertySource.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ContentTypeView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/EclipsePreferencesView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/EventsSorter.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/EventsView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesViewContentProvider.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesViewLabelProvider.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesViewSorter.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDataSheetView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyGraphNode.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyPerspective.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginListView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PreferenceStatsView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/RuntimeSpyPerspective.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/StackTraceView.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/VMClassInfo.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/VMClassloaderInfo.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnreferencedFilesAction.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedMembers.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedMembersAction.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedSearchQuery.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedSearchResult.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedSearchResultPage.java
features/org.eclipse.core.tools-feature/.project
features/org.eclipse.core.tools-feature/build.properties
features/org.eclipse.core.tools-feature/cpl-v10.html
features/org.eclipse.core.tools-feature/eclipse_update_120.jpg
features/org.eclipse.core.tools-feature/feature.properties
features/org.eclipse.core.tools-feature/feature.xml
features/org.eclipse.core.tools-feature/license.html
tests/org.eclipse.core.expressions.tests/.classpath
tests/org.eclipse.core.expressions.tests/.cvsignore
tests/org.eclipse.core.expressions.tests/.project
tests/org.eclipse.core.expressions.tests/.settings/org.eclipse.jdt.core.prefs
tests/org.eclipse.core.expressions.tests/.settings/org.eclipse.jdt.ui.prefs
tests/org.eclipse.core.expressions.tests/.settings/org.eclipse.pde.prefs
tests/org.eclipse.core.expressions.tests/.template
tests/org.eclipse.core.expressions.tests/META-INF/MANIFEST.MF
tests/org.eclipse.core.expressions.tests/about.html
tests/org.eclipse.core.expressions.tests/build.properties
tests/org.eclipse.core.expressions.tests/plugin.properties
tests/org.eclipse.core.expressions.tests/plugin.xml
tests/org.eclipse.core.expressions.tests/schema/testParticipants.exsd
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender2.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender3.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/Adaptee.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/Adapter.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/AllTests.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/B.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/B_TypeExtender.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/CollectionAdapterFactory.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionInfoTests.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTestPlugin.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTests.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/I.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/I_TypeExtender.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/PropertyTesterTests.java
tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/TestAdapterFactory.java
tests/org.eclipse.core.expressions.tests/test.xml
tests/org.eclipse.core.tests.runtime/.classpath
tests/org.eclipse.core.tests.runtime/.cvsignore
tests/org.eclipse.core.tests.runtime/.project
tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.core.resources.prefs
tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.jdt.core.prefs
tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.jdt.ui.prefs
tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.pde.prefs
tests/org.eclipse.core.tests.runtime/All Runtime Tests.launch
tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/A/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/A/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/B/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/B/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/src/testAdapter/testUnknown.java
tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/testAdapter/testUnknown.class
tests/org.eclipse.core.tests.runtime/Plugin_Testing/compatibility/bundle01/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle01/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle02/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle03/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle04/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator.nl/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator.nl/nl/aa/BB/intro/messages.properties
tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator.nl/nl/aa/intro/messages.properties
tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/intro/messages.properties
tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/nl/aa/BB/intro/messages.properties
tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/nl/aa/intro/messages.properties
tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocatorGetRootFile/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/71826/fragmentF/fragment.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/71826/pluginA/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/71826/pluginB/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/contributors/A/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/contributors/B/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/contributors/B/fragment.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/A/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/Afragment/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/Afragment/fragment.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/B/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/bad/extension/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/bad/point/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/good/extension/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/good/point/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/fragmentToNonSingleton/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/fragmentToNonSingleton/fragment.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingleton/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingleton/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingletonFragment/fragment/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingletonFragment/fragment/fragment.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingletonFragment/plugin/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testA/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testB/1/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testB/2/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testC/1/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testC/2/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testD/1/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testD/2/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testE/1/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testE/2/fragment.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testF/1/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testF/2/fragment.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testG/1/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testG/2/fragment.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testH/1/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testH/2/fragment.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testH/3/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testI/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/1/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/2/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DuplicatePoints1.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DuplicatePoints2.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DuplicatePointsSame.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DynamicExtension.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/ExecutableExtension.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/Extension.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/ExtensionPoint.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/MergeDynamic.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/MergeStatic.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/RemovalTest.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testStale1/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testStale2/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle01/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle01/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle02/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle02/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle01/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle01/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle02/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle02/plugin.xml
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundleMultiple/META-INF/MANIFEST.MF
tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundleMultiple/plugin.xml
tests/org.eclipse.core.tests.runtime/about.html
tests/org.eclipse.core.tests.runtime/build.properties
tests/org.eclipse.core.tests.runtime/plugin.xml
tests/org.eclipse.core.tests.runtime/schema/factoryLoaderTest.exsd
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/AllTests.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/EclipsePreferencesTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/IScopeContextTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/ListenerRegistryTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/PreferencesServiceTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestScope.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/AllTests.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ContributorsTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryDynamicTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryStaticTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/InputErrorTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/NamespaceTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/RegistryListenerTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/StaleObjects.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/WaitingRegistryListener.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/AllSimpleRegistryTests.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/BaseExtensionRegistryRun.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DirectExtensionCreate.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DirectExtensionCreateTwoRegistries.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DirectExtensionRemove.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DuplicatePoints.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/MergeContribution.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/TokenAccess.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/XMLExecutableExtension.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/XMLExtensionCreate.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/XMLExtensionCreateEclipse.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/ExeExtensionStrategy.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/ExecutableRegistryObject.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/HiddenLogRegistryStrategy.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/SimpleRegistryListener.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/AllTests.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/AuthorizationDatabaseTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/CipherStreamsTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/CipherTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/FileLocatorTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/LogSerializationTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformLogReader.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLLocalTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLSessionTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AdapterManagerDynamicTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AllTests.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AutomatedTests.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/CoreExceptionTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/IAdapterManagerServiceTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/IAdapterManagerTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/OperationCanceledExceptionTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PathTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PlatformTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PluginVersionIdentifierTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceExportTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceForwarderTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferencesTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/ProgressMonitorWrapperTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/QualifiedNameTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/RuntimeTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/RuntimeTestsPlugin.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/StatusTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorSmallTicksTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubProgressSubclass.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubProgressTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdaptable.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdapter.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdapterFactory.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdapterFactoryLoader.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestProgressMonitor.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/URLTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/compatibility/AllTests.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/compatibility/PluginCompatibilityTests.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/AllTests.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/ContentDescriptionTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/IContentTypeManagerTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/LazyInputStreamTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/LazyReaderTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/LocalSelectionPolicy.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/MyContentDescriber.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/NaySayerContentDescriber.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/SpecificContextTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/SubsetSelectionPolicy.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/TestBug94498.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/XMLContentDescriberTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AbstractJobManagerTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AbstractJobTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AllTests.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AsynchExecThread.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AsynchTestJob.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/BeginEndRuleTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/Bug_129551.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/Bug_211799.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/DeadlockDetectionTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/FamilyTestJob.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/FussyProgressProvider.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/IJobManagerTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/IdentityRule.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobQueueTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobRuleRunner.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/LockAcquiringRunnable.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/OrderedLockTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/PathRule.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/RandomTestRunnable.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/ReadWriteMonitor.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/RepeatingJob.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/SimpleRuleRunner.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestBlockingMonitor.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestJobFamily.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestLockListener.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/VerboseJobListener.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/model/AllTests.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/model/ConfigurationElementModelTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/AllTests.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/BenchPath.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/ContentTypePerformanceTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/PreferencePerformanceTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/StartupTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/UIStartupTest.java
tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/session/AllTests.java
tests/org.eclipse.core.tests.runtime/test.xmldiff --git a/bundles/org.eclipse.core.boot/.classpath b/bundles/org.eclipse.core.boot/.classpath
deleted file mode 100644
index d7c7e85..0000000
--- a/bundles/org.eclipse.core.boot/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.0%Foundation-1.0"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.core.boot/.cvsignore b/bundles/org.eclipse.core.boot/.cvsignore
deleted file mode 100644
index ba077a4..0000000
--- a/bundles/org.eclipse.core.boot/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/bundles/org.eclipse.core.boot/.project b/bundles/org.eclipse.core.boot/.project
deleted file mode 100644
index cd0e722..0000000
--- a/bundles/org.eclipse.core.boot/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.boot</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.core.boot/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.boot/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index f2feaa1..0000000
--- a/bundles/org.eclipse.core.boot/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Thu May 11 16:56:08 EDT 2006
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
-org.eclipse.jdt.core.compiler.compliance=1.3
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
-org.eclipse.jdt.core.compiler.source=1.3
diff --git a/bundles/org.eclipse.core.boot/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.boot/META-INF/MANIFEST.MF
deleted file mode 100644
index 8f4f6df..0000000
--- a/bundles/org.eclipse.core.boot/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,10 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.core.boot
-Bundle-Version: 3.1.100.qualifier
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Eclipse-AutoStart: true
-Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,
- J2SE-1.3
diff --git a/bundles/org.eclipse.core.boot/about.html b/bundles/org.eclipse.core.boot/about.html
deleted file mode 100644
index 4602330..0000000
--- a/bundles/org.eclipse.core.boot/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.boot/build.properties b/bundles/org.eclipse.core.boot/build.properties
deleted file mode 100644
index 2fb941d..0000000
--- a/bundles/org.eclipse.core.boot/build.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2008 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = .,\
- plugin.properties,\
- about.html,\
- META-INF/,\
- readme.txt
-src.includes=about.html
-generateSourceBundle=false
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.boot/plugin.properties b/bundles/org.eclipse.core.boot/plugin.properties
deleted file mode 100644
index ff52947..0000000
--- a/bundles/org.eclipse.core.boot/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-# Boot strings
-pluginName = Core Boot
-providerName = Eclipse.org
diff --git a/bundles/org.eclipse.core.boot/readme.txt b/bundles/org.eclipse.core.boot/readme.txt
deleted file mode 100644
index 2d2cf7b..0000000
--- a/bundles/org.eclipse.core.boot/readme.txt
+++ /dev/null
@@ -1 +0,0 @@
-The features provided by this plug-in moved to org.eclipse.core.runtime, org.eclipse.core.runtime.compatiblilty or org.eclipse.update.configurator.
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.contenttype/.classpath b/bundles/org.eclipse.core.contenttype/.classpath
deleted file mode 100644
index ce73933..0000000
--- a/bundles/org.eclipse.core.contenttype/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.core.contenttype/.cvsignore b/bundles/org.eclipse.core.contenttype/.cvsignore
deleted file mode 100644
index ba077a4..0000000
--- a/bundles/org.eclipse.core.contenttype/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/bundles/org.eclipse.core.contenttype/.options b/bundles/org.eclipse.core.contenttype/.options
deleted file mode 100644
index c36e0d8..0000000
--- a/bundles/org.eclipse.core.contenttype/.options
+++ /dev/null
@@ -1,5 +0,0 @@
-# Debugging options for the org.eclipse.core.contenttype plugin
-
-# Turn on debugging for content types
-org.eclipse.core.contenttype/debug=false
-
diff --git a/bundles/org.eclipse.core.contenttype/.project b/bundles/org.eclipse.core.contenttype/.project
deleted file mode 100644
index 9c05d5c..0000000
--- a/bundles/org.eclipse.core.contenttype/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.contenttype</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.core.contenttype/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.core.contenttype/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 16532b2..0000000
--- a/bundles/org.eclipse.core.contenttype/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue May 25 15:00:03 EDT 2004
-encoding/<project>=ISO-8859-1
-eclipse.preferences.version=1
diff --git a/bundles/org.eclipse.core.contenttype/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.contenttype/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index df7da80..0000000
--- a/bundles/org.eclipse.core.contenttype/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,258 +0,0 @@
-#Mon Feb 26 10:42:54 EST 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.source=1.3
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=false
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=80
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=800
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/bundles/org.eclipse.core.contenttype/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.core.contenttype/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 288343d..0000000
--- a/bundles/org.eclipse.core.contenttype/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-#Mon Feb 26 10:42:03 EST 2007
-eclipse.preferences.version=1
-formatter_profile=_core
-formatter_settings_version=11
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=;
-org.eclipse.jdt.ui.ondemandthreshold=3
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return Returns the ${bare_field_name}.\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} The ${bare_field_name} to set.\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Copyright (c) ${year} IBM Corporation and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n ******************************************************************************/\r\n</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @since 3.2\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="New classes and interfaces" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) 2006 IBM Corporation and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n *******************************************************************************/\r\n${package_declaration}\r\n\r\n/**\r\n * \r\n */\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">fail("4.99", ${exception_var});</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/bundles/org.eclipse.core.contenttype/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.contenttype/META-INF/MANIFEST.MF
deleted file mode 100644
index 16cfadf..0000000
--- a/bundles/org.eclipse.core.contenttype/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,25 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.core.contenttype; singleton:=true
-Bundle-Version: 3.3.0.qualifier
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.equinox.preferences;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.equinox.registry;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.equinox.common;bundle-version="[3.2.0,4.0.0)"
-Export-Package: org.eclipse.core.internal.content;x-internal:=true,
- org.eclipse.core.runtime.content
-Bundle-Activator: org.eclipse.core.internal.content.Activator
-Eclipse-LazyStart: true
-Import-Package: javax.xml.parsers,
- org.eclipse.osgi.service.debug,
- org.eclipse.osgi.util;version="1.0.0",
- org.osgi.framework,
- org.osgi.util.tracker,
- org.xml.sax,
- org.xml.sax.ext,
- org.xml.sax.helpers
-Bundle-RequiredExecutionEnvironment: J2SE-1.4,
- CDC-1.0/Foundation-1.0,
- J2SE-1.3
diff --git a/bundles/org.eclipse.core.contenttype/about.html b/bundles/org.eclipse.core.contenttype/about.html
deleted file mode 100644
index 4602330..0000000
--- a/bundles/org.eclipse.core.contenttype/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.contenttype/build.properties b/bundles/org.eclipse.core.contenttype/build.properties
deleted file mode 100644
index 2ec89f4..0000000
--- a/bundles/org.eclipse.core.contenttype/build.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-###############################################################################
-# Copyright (c) 2005, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- .options,\
- plugin.properties,\
- about.html
-src.includes = about.html,\
- schema/
-jre.compilation.profile = J2SE-1.4
diff --git a/bundles/org.eclipse.core.contenttype/plugin.properties b/bundles/org.eclipse.core.contenttype/plugin.properties
deleted file mode 100644
index c54e7d8..0000000
--- a/bundles/org.eclipse.core.contenttype/plugin.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-pluginName = Eclipse Content Mechanism
-providerName = Eclipse.org
-textContentTypeName = Text
-xmlContentTypeName = XML
-propertiesContentTypeName = Properties
-contentTypesName = Content Types
diff --git a/bundles/org.eclipse.core.contenttype/plugin.xml b/bundles/org.eclipse.core.contenttype/plugin.xml
deleted file mode 100644
index 3a85336..0000000
--- a/bundles/org.eclipse.core.contenttype/plugin.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <extension-point id="contentTypes" name="%contentTypesName" schema="schema/contentTypes.exsd"/>
-
- <extension point="org.eclipse.core.contenttype.contentTypes">
- <content-type id="org.eclipse.core.runtime.text" name="%textContentTypeName"
- priority="high"
- file-extensions="txt">
- <describer class="org.eclipse.core.internal.content.TextContentDescriber"/>
- <property name="org.eclipse.core.runtime.bom"/>
- <property name="org.eclipse.core.runtime.charset"/>
- </content-type>
- <content-type id="org.eclipse.core.runtime.xml" name="%xmlContentTypeName"
- base-type="org.eclipse.core.runtime.text"
- priority="high"
- file-extensions="xml">
- <property name="org.eclipse.core.runtime.charset" default="UTF-8"/>
- <describer class="org.eclipse.core.internal.content.XMLContentDescriber"/>
- </content-type>
- <!-- a placeholder for setups where JDT's official type is not available -->
- <content-type id="org.eclipse.core.runtime.properties" name="%propertiesContentTypeName"
- base-type="org.eclipse.core.runtime.text"
- alias-for="org.eclipse.jdt.core.javaProperties"
- file-extensions="properties">
- <property name="org.eclipse.core.runtime.charset" default="ISO-8859-1"/>
- </content-type>
- </extension>
-</plugin>
diff --git a/bundles/org.eclipse.core.contenttype/schema/contentTypes.exsd b/bundles/org.eclipse.core.contenttype/schema/contentTypes.exsd
deleted file mode 100644
index 5c01ad4..0000000
--- a/bundles/org.eclipse.core.contenttype/schema/contentTypes.exsd
+++ /dev/null
@@ -1,361 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.core.runtime" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.eclipse.core.runtime" id="contentTypes" name="Content Types"/>
- </appinfo>
- <documentation>
- The content types extension point allows plug-ins to contribute to the platform content type catalog. There are two forms of contributions: <cite>content types</cite> and <cite>file associations</cite>.
-<ul>
-<li>
-a content type represents a file format and its naming conventions. Content types can be defined from scratch, or can inherit from existing ones, specializing them. Also, a content type can be made into an alias for another content type (see the <code>alias-for</code> attribute). When this feature is used:
- <ul><li>if the target is absent, the alias content type is processed
- as a normal content type;</li>
- <li>if the target is present, all references to the alias type are automatically
- transformed into references to the target type, and the alias type cannot be
- accessed nor is exposed through the API.</li></ul>
-</li>
-<li>
-a file association extends an existing content type by associating new file names and/or extensions to it</li>
-</ul>
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="content-type" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="file-association" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="content-type">
- <complexType>
- <sequence>
- <element ref="describer" minOccurs="0" maxOccurs="1"/>
- <element ref="property" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- the identifier for this content type (either a simple id unique for content types within the extension namespace, or a fully qualified id). The token cannot contain whitespace
- </documentation>
- </annotation>
- </attribute>
- <attribute name="base-type" type="string">
- <annotation>
- <documentation>
- the fully qualified identifier of this content type's base type. This content type will inherit its base type's file associations, content describer and default charset, unless they are redefined
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- the human-readable name of this content type
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="file-extensions" type="string">
- <annotation>
- <documentation>
- a comma-separated list of file extensions to be associated with this content type
- </documentation>
- </annotation>
- </attribute>
- <attribute name="file-names" type="string">
- <annotation>
- <documentation>
- a comma-separated list of file names to be associated with this content type
- </documentation>
- </annotation>
- </attribute>
- <attribute name="priority" use="default" value="normal">
- <annotation>
- <documentation>
- the priority for this content type. Priorities are used to solve conflicts (when two content types are associated to the same file name/extension)
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="low">
- </enumeration>
- <enumeration value="normal">
- </enumeration>
- <enumeration value="high">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- <attribute name="default-charset" type="string">
- <annotation>
- <documentation>
- the default charset for this content type, or an empty string, if this content type should not have a default charset even if the parent has one. This is a convenience attribute, equivalent to specifying:
-<pre>
- <content-type>
- <property name="org.eclipse.core.runtime.charset" default="charset-name"/>
- </content-type>
-</pre>
- </documentation>
- </annotation>
- </attribute>
- <attribute name="describer" type="string">
- <annotation>
- <documentation>
- the fully qualified name of a class that implements <samp>org.eclipse.core.runtime.content.IContentDescriber</samp> or <samp>org.eclipse.core.runtime.content.ITextContentDescriber</samp>, or an empty string, if this content type should not have a describer even if the parent has one
- </documentation>
- <appinfo>
- <meta.attribute kind="java"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="alias-for" type="string">
- <annotation>
- <documentation>
- the fully qualified identifier of the content type this content type is an alias for
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="describer">
- <annotation>
- <documentation>
- If the describer attribute is used in the content-type element, this element is ignored.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- the fully qualified name of a class that implements <samp>org.eclipse.core.runtime.content.IContentDescriber</samp> or <samp>org.eclipse.core.runtime.content.ITextContentDescriber</samp>, or an empty string, if this content type should not have a describer even if the parent has one
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn="org.eclipse.core.runtime.content.IContentDescriber"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="plugin" type="string">
- <annotation>
- <documentation>
- the id for the plug-in providing the describer class
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="file-association">
- <complexType>
- <attribute name="content-type" type="string" use="required">
- <annotation>
- <documentation>
- the fully qualified identifier for the content type this file association contributes to
- </documentation>
- </annotation>
- </attribute>
- <attribute name="file-names" type="string">
- <annotation>
- <documentation>
- a comma-separated list of file names to be associated with the target content type
- </documentation>
- </annotation>
- </attribute>
- <attribute name="file-extensions" type="string">
- <annotation>
- <documentation>
- a comma-separated list of file extensions to be associated with the target content type
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="parameter">
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- the name of this parameter made available to instances of the specified content describer class
- </documentation>
- </annotation>
- </attribute>
- <attribute name="value" type="string" use="required">
- <annotation>
- <documentation>
- an arbitrary value associated with the given name and made available to instances of the specified content describer class
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="property">
- <annotation>
- <documentation>
- Declares a property related to this content type, optionally assigning a default value. See <samp>org.eclipse.core.runtime.content.IContentDescription</samp> for more information on properties.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- the name of the property. If the property is being overriden and has been originally defined in a different namespace, a fully qualified property name must be used
- </documentation>
- </annotation>
- </attribute>
- <attribute name="default" type="string">
- <annotation>
- <documentation>
- the default value of the property, or an empty string, if this content type should not have a default value for this property even if a parent has one
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="examples"/>
- </appinfo>
- <documentation>
- Following is an example of a XML-based content type declaration using <code>org.eclipse.core.runtime.content.XMLRootElementContentDescriber2</code>,
-a built-in describer:
-<p>
-<pre>
- <extension point="org.eclipse.core.runtime.contentTypes">
- <content-type id="ABC"
- base-type="org.eclipse.core.runtime.xml"
- file-extensions="a,b,c">
- <describer class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber2">
- <parameter name="element" value="abc"/>
- </describer>
- </content-type>
- </extension>
-</pre>
-</p>
-Here is an example of a simple text-based content type that has a specific file extension:
-<p>
-<pre>
- <extension point="org.eclipse.core.runtime.contentTypes">
- <content-type id="MyText"
- base-type="org.eclipse.core.runtime.text"
- file-extensions="mytxt"/>
- </extension>
-</pre>
-</p>
-When there is need to associate new file names/extensions to an existing content type (as opposed to defining a new content type), a plug-in can contribute a file association as seen below. This has the effect of enhancing the definition of the text content type to include files with names following the "*.mytxt" pattern.
-<p>
-<pre>
- <extension point="org.eclipse.core.runtime.contentTypes">
- <file-association
- content-type="org.eclipse.core.runtime.text"
- file-extensions="mytxt"/>
- </extension>
-</pre>
-</p>
-Here is an example of a content type that defines properties:
-<pre>
- <extension point="org.eclipse.core.runtime.contentTypes">
- <content-type id="MyContentType"
- file-extensions="dat">
- <property name="file-format" value="1"/>
- </content-type>
- </extension>
-</pre>
-</p>
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="apiInfo"/>
- </appinfo>
- <documentation>
- The value of the class attribute in the describer element must represent an
-implementor of
-<samp>org.eclipse.core.runtime.content.IContentDescriber</samp> or <samp>org.eclipse.core.runtime.content.ITextContentDescriber</samp>.
-
-<samp>org.eclipse.core.runtime.content.IContentDescription</samp> objects returned by the <samp>org.eclipse.core.runtime.content</samp> API
- </documentation>
- </annotation>
-
-
- <annotation>
- <appinfo>
- <meta.section type="implementation"/>
- </appinfo>
- <documentation>
- <p>The org.eclipse.core.runtime plug-in provides the following content types:<ul>
-<li>org.eclipse.core.runtime.text</li>
-<li>org.eclipse.core.runtime.xml</li>
-</ul>
-Other plug-ins in the platform contribute other content types.
-</p>
-<p>
-Also, the org.eclipse.core.runtime plug-in provides ready-to-use implementations of content describers:<ul>
-<li>org.eclipse.core.runtime.content.XMLRootElementContentDescriber2</li>
-<li>org.eclipse.core.runtime.content.BinarySignatureDescriber</li>
-</ul>
-</p>
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="copyright"/>
- </appinfo>
- <documentation>
- Copyright (c) 2004, 2005 IBM Corporation and others.<br>
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which
-accompanies
-this distribution, and is available at
-<a
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/Activator.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/Activator.java
deleted file mode 100644
index 2e1a0d1..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/Activator.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.util.Hashtable;
-import javax.xml.parsers.SAXParserFactory;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.osgi.service.debug.DebugOptions;
-import org.osgi.framework.*;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-
-/**
- * The bundle activator for the runtime content manager plug-in.
- */
-public class Activator implements BundleActivator, ServiceTrackerCustomizer {
-
- private static Activator singleton;
- private static BundleContext bundleContext;
- private ServiceRegistration contentManagerService = null;
- private ServiceTracker parserTracker = null;
- private ServiceTracker debugTracker = null;
- private ServiceTracker registryTracker = null;
-
- /*
- * Return this activator's singleton instance or null if it has not been started.
- */
- public static Activator getDefault() {
- return singleton;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- bundleContext = context;
- singleton = this;
- // ContentTypeManager should be started first
- ContentTypeManager.startup();
- contentManagerService = bundleContext.registerService(IContentTypeManager.class.getName(), ContentTypeManager.getInstance(), new Hashtable());
- registryTracker = new ServiceTracker(context, IExtensionRegistry.class.getName(), this);
- registryTracker.open();
- }
-
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- if (contentManagerService != null) {
- contentManagerService.unregister();
- contentManagerService = null;
- }
- if (parserTracker != null) {
- parserTracker.close();
- parserTracker = null;
- }
- if (debugTracker != null) {
- debugTracker.close();
- debugTracker = null;
- }
- if (registryTracker != null) {
- registryTracker.close();
- registryTracker = null;
- }
- ContentTypeManager.shutdown();
- bundleContext = null;
- }
-
- /*
- * Return this plug-in's bundle context.
- */
- static BundleContext getContext() {
- return bundleContext;
- }
-
- /*
- * Return the registered SAX parser factory or null if one
- * does not exist.
- */
- public SAXParserFactory getFactory() {
- if (parserTracker == null) {
- parserTracker = new ServiceTracker(bundleContext, SAXParserFactory.class.getName(), null);
- parserTracker.open();
- }
- SAXParserFactory theFactory = (SAXParserFactory) parserTracker.getService();
- if (theFactory != null)
- theFactory.setNamespaceAware(true);
- return theFactory;
- }
-
- /*
- * Return the boolean value in the debug options for the given key, or
- * return the default value if there is none.
- */
- public boolean getBooleanDebugOption(String option, boolean defaultValue) {
- if (debugTracker == null) {
- debugTracker = new ServiceTracker(bundleContext, DebugOptions.class.getName(), null);
- debugTracker.open();
- }
- DebugOptions options = (DebugOptions) debugTracker.getService();
- if (options != null) {
- String value = options.getOption(option);
- if (value != null)
- return "true".equalsIgnoreCase(value); //$NON-NLS-1$
- }
- return defaultValue;
- }
-
- public Object addingService(ServiceReference reference) {
- IExtensionRegistry registry = (IExtensionRegistry) bundleContext.getService(reference);
- // registry is available; add the change listener
- ContentTypeManager.addRegistryChangeListener(registry);
- return registry;
- }
-
- public void modifiedService(ServiceReference reference, Object service) {
- // do nothing
- }
-
- public void removedService(ServiceReference reference, Object service) {
- // registry is unavailable; remove the change listener
- ContentTypeManager.removeRegistryChangeListener((IExtensionRegistry) service);
- bundleContext.ungetService(reference);
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/BasicDescription.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/BasicDescription.java
deleted file mode 100644
index cbcbc8d..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/BasicDescription.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.IContentType;
-
-public abstract class BasicDescription implements IContentDescription {
-
- protected IContentTypeInfo contentTypeInfo;
-
- public BasicDescription(IContentTypeInfo contentTypeInfo) {
- this.contentTypeInfo = contentTypeInfo;
- }
-
- /**
- * @see IContentDescription
- */
- public IContentType getContentType() {
- ContentType contentType = contentTypeInfo.getContentType();
- //TODO performance: potential creation of garbage
- return new ContentTypeHandler(contentType, contentType.getCatalog().getGeneration());
- }
-
- public IContentTypeInfo getContentTypeInfo() {
- return contentTypeInfo;
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentDescription.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentDescription.java
deleted file mode 100644
index 14f6109..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentDescription.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.IContentDescription;
-
-public final class ContentDescription extends BasicDescription {
-
- private static final String CHARSET_UTF_16 = "UTF-16"; //$NON-NLS-1$
- private static final String CHARSET_UTF_8 = "UTF-8"; //$NON-NLS-1$
- private static final byte FLAG_ALL_OPTIONS = 0x01;
- private static final byte FLAG_IMMUTABLE = 0x02;
- private byte flags;
- private Object keys;
- private Object values;
-
- public ContentDescription(QualifiedName[] requested, IContentTypeInfo contentTypeInfo) {
- super(contentTypeInfo);
- if (requested == IContentDescription.ALL) {
- flags |= FLAG_ALL_OPTIONS;
- return;
- }
- if (requested.length > 1) {
- keys = requested;
- values = new Object[requested.length];
- } else if (requested.length == 1)
- keys = requested[0];
- // if requested.length == 0 then keys == null (no options to describe!)
- }
-
- private void assertMutable() {
- if ((flags & FLAG_IMMUTABLE) != 0)
- throw new IllegalStateException("Content description is immutable"); //$NON-NLS-1$
- }
-
- /**
- * @see IContentDescription
- */
- public String getCharset() {
- byte[] bom = (byte[]) getProperty(BYTE_ORDER_MARK);
- if (bom == BOM_UTF_8)
- return CHARSET_UTF_8;
- else if (bom == BOM_UTF_16BE || bom == BOM_UTF_16LE)
- // UTF-16 will properly recognize the BOM
- return CHARSET_UTF_16;
- return (String) getProperty(CHARSET);
- }
-
- private Object getDescribedProperty(QualifiedName key) {
- // no values have been set
- if (values == null)
- return null;
- // a single property may have been set
- if (keys instanceof QualifiedName)
- return keys.equals(key) ? values : null;
- // multiple properties may have been set
- QualifiedName[] tmpKeys = (QualifiedName[]) this.keys;
- for (int i = 0; i < tmpKeys.length; i++)
- if (tmpKeys[i].equals(key))
- return ((Object[]) values)[i];
- return null;
- }
-
- /**
- * @see IContentDescription
- */
- public Object getProperty(QualifiedName key) {
- Object describedProperty = getDescribedProperty(key);
- if (describedProperty != null)
- return describedProperty;
- return contentTypeInfo.getDefaultProperty(key);
- }
-
- /**
- * @see IContentDescription
- */
- public boolean isRequested(QualifiedName propertyKey) {
- // all options requested
- if ((flags & FLAG_ALL_OPTIONS) != 0)
- return true;
- // no options requested
- if (keys == null)
- return false;
- // a single option requested
- if (keys instanceof QualifiedName)
- return keys.equals(propertyKey);
- // some (but not all) options requested
- QualifiedName[] tmpKeys = (QualifiedName[]) this.keys;
- for (int i = 0; i < tmpKeys.length; i++)
- if (tmpKeys[i].equals(propertyKey))
- return true;
- return false;
- }
-
- boolean isSet() {
- if (keys == null || values == null)
- return false;
- if (keys instanceof QualifiedName)
- return true;
- Object[] tmpValues = (Object[]) this.values;
- for (int i = 0; i < tmpValues.length; i++)
- if (tmpValues[i] != null)
- return true;
- return false;
- }
-
- public void markImmutable() {
- assertMutable();
- flags |= FLAG_IMMUTABLE;
- }
-
- /** Overrides content type info object. */
- void setContentTypeInfo(IContentTypeInfo info) {
- this.contentTypeInfo = info;
- }
-
- /**
- * @see IContentDescription
- */
- public void setProperty(QualifiedName newKey, Object newValue) {
- assertMutable();
- if (keys == null) {
- if ((flags & FLAG_ALL_OPTIONS) != 0) {
- keys = newKey;
- values = newValue;
- }
- return;
- }
- if (keys.equals(newKey)) {
- values = newValue;
- return;
- }
- if (keys instanceof QualifiedName) {
- if ((flags & FLAG_ALL_OPTIONS) != 0) {
- keys = new QualifiedName[] {(QualifiedName) keys, newKey};
- values = new Object[] {values, newValue};
- }
- return;
- }
- QualifiedName[] tmpKeys = (QualifiedName[]) this.keys;
- for (int i = 0; i < tmpKeys.length; i++)
- if (tmpKeys[i].equals(newKey)) {
- ((Object[]) values)[i] = newValue;
- return;
- }
- if ((flags & FLAG_ALL_OPTIONS) == 0)
- return;
- // need to resize arrays
- int currentSize = tmpKeys.length;
- tmpKeys = new QualifiedName[currentSize + 1];
- System.arraycopy(keys, 0, tmpKeys, 0, currentSize);
- Object[] tmpValues = new Object[currentSize + 1];
- System.arraycopy(values, 0, tmpValues, 0, currentSize);
- tmpKeys[tmpKeys.length - 1] = newKey;
- tmpValues[tmpValues.length - 1] = newValue;
- keys = tmpKeys;
- values = tmpValues;
- }
-
- public String toString() {
- StringBuffer result = new StringBuffer("{"); //$NON-NLS-1$
- if (keys != null)
- if (keys instanceof QualifiedName) {
- if (values != null)
- result.append(keys + "=" + values); //$NON-NLS-1$
- } else {
- QualifiedName[] tmpKeys = (QualifiedName[]) keys;
- Object[] tmpValues = (Object[]) values;
- boolean any = false;
- for (int i = 0; i < tmpKeys.length; i++)
- if (tmpValues[i] != null) {
- result.append(tmpKeys[i] + "=" + tmpValues[i] + ","); //$NON-NLS-1$ //$NON-NLS-2$
- any = true;
- }
- if (any)
- result.deleteCharAt(result.length() - 1);
- }
- result.append("} : "); //$NON-NLS-1$
- result.append(contentTypeInfo.getContentType());
- return result.toString();
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentMessages.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentMessages.java
deleted file mode 100644
index 19a4775..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentMessages.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.util.Date;
-import org.eclipse.osgi.util.NLS;
-
-// Runtime plugin message catalog
-public class ContentMessages extends NLS {
-
- /**
- * The unique identifier constant of this plug-in.
- */
- public static final String OWNER_NAME = "org.eclipse.core.contenttype"; //$NON-NLS-1$
-
- private static final String BUNDLE_NAME = "org.eclipse.core.internal.content.messages"; //$NON-NLS-1$
-
- // Content type manager
- public static String content_badInitializationData;
- public static String content_errorReadingContents;
- public static String content_errorLoadingSettings;
- public static String content_errorSavingSettings;
- public static String content_invalidContentDescriber;
- public static String content_invalidProperty;
- public static String content_missingIdentifier;
- public static String content_missingName;
- public static String content_parserConfiguration;
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, ContentMessages.class);
- }
-
- /**
- * Print a debug message to the console.
- * Pre-pend the message with the current date and the name of the current thread.
- */
- public static void message(String message) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(new Date(System.currentTimeMillis()));
- buffer.append(" - ["); //$NON-NLS-1$
- buffer.append(Thread.currentThread().getName());
- buffer.append("] "); //$NON-NLS-1$
- buffer.append(message);
- System.out.println(buffer.toString());
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentType.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentType.java
deleted file mode 100644
index 5932ef5..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentType.java
+++ /dev/null
@@ -1,632 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.io.*;
-import java.util.*;
-import org.eclipse.core.internal.runtime.RuntimeLog;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.content.*;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * @see IContentType
- */
-public final class ContentType implements IContentType, IContentTypeInfo {
-
- /* A placeholder for missing/invalid binary/text describers. */
- private class InvalidDescriber implements IContentDescriber, ITextContentDescriber {
- public int describe(InputStream contents, IContentDescription description) {
- return INVALID;
- }
-
- public int describe(Reader contents, IContentDescription description) {
- return INVALID;
- }
-
- public QualifiedName[] getSupportedOptions() {
- return new QualifiedName[0];
- }
- }
-
- final static byte ASSOCIATED_BY_EXTENSION = 2;
- final static byte ASSOCIATED_BY_NAME = 1;
- private static final String DESCRIBER_ELEMENT = "describer"; //$NON-NLS-1$
- private static ArrayList EMPTY_LIST = new ArrayList(0);
- private static final Object INHERITED_DESCRIBER = "INHERITED DESCRIBER"; //$NON-NLS-1$
-
- private static final Object NO_DESCRIBER = "NO DESCRIBER"; //$NON-NLS-1$
- final static byte NOT_ASSOCIATED = 0;
- public final static String PREF_DEFAULT_CHARSET = "charset"; //$NON-NLS-1$
- public final static String PREF_FILE_EXTENSIONS = "file-extensions"; //$NON-NLS-1$
- public final static String PREF_FILE_NAMES = "file-names"; //$NON-NLS-1$
- final static byte PRIORITY_HIGH = 1;
- final static byte PRIORITY_LOW = -1;
- final static byte PRIORITY_NORMAL = 0;
- final static int SPEC_PRE_DEFINED = IGNORE_PRE_DEFINED;
- final static int SPEC_USER_DEFINED = IGNORE_USER_DEFINED;
- final static byte STATUS_INVALID = 2;
- final static byte STATUS_UNKNOWN = 0;
- final static byte STATUS_VALID = 1;
- private String aliasTargetId;
- private String baseTypeId;
- private boolean builtInAssociations = false;
- private ContentTypeCatalog catalog;
- private IConfigurationElement contentTypeElement;
- private DefaultDescription defaultDescription;
- private Map defaultProperties;
- private Object describer;
- // we need a Cloneable list
- private ArrayList fileSpecs = EMPTY_LIST;
- String id;
- private ContentTypeManager manager;
- private String name;
- private byte priority;
- private ContentType target;
- private String userCharset;
- private byte validation = STATUS_UNKNOWN;
- private ContentType baseType;
- // -1 means unknown
- private byte depth = -1;
-
- public static ContentType createContentType(ContentTypeCatalog catalog, String uniqueId, String name, byte priority, String[] fileExtensions, String[] fileNames, String baseTypeId, String aliasTargetId, Map defaultProperties, IConfigurationElement contentTypeElement) {
- ContentType contentType = new ContentType(catalog.getManager());
- contentType.catalog = catalog;
- contentType.defaultDescription = new DefaultDescription(contentType);
- contentType.id = uniqueId;
- contentType.name = name;
- contentType.priority = priority;
- if ((fileExtensions != null && fileExtensions.length > 0) || (fileNames != null && fileNames.length > 0)) {
- contentType.builtInAssociations = true;
- contentType.fileSpecs = new ArrayList(fileExtensions.length + fileNames.length);
- for (int i = 0; i < fileNames.length; i++)
- contentType.internalAddFileSpec(fileNames[i], FILE_NAME_SPEC | SPEC_PRE_DEFINED);
- for (int i = 0; i < fileExtensions.length; i++)
- contentType.internalAddFileSpec(fileExtensions[i], FILE_EXTENSION_SPEC | SPEC_PRE_DEFINED);
- }
- contentType.defaultProperties = defaultProperties;
- contentType.contentTypeElement = contentTypeElement;
- contentType.baseTypeId = baseTypeId;
- contentType.aliasTargetId = aliasTargetId;
- return contentType;
- }
-
- static FileSpec createFileSpec(String fileSpec, int type) {
- return new FileSpec(fileSpec, type);
- }
-
- static String getPreferenceKey(int flags) {
- if ((flags & FILE_EXTENSION_SPEC) != 0)
- return PREF_FILE_EXTENSIONS;
- if ((flags & FILE_NAME_SPEC) != 0)
- return PREF_FILE_NAMES;
- throw new IllegalArgumentException("Unknown type: " + flags); //$NON-NLS-1$
- }
-
- private static String getValidationString(byte validation) {
- return validation == STATUS_VALID ? "VALID" : (validation == STATUS_INVALID ? "INVALID" : "UNKNOWN"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public static void log(String message, Throwable reason) {
- // don't log CoreExceptions again
- IStatus status = new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, reason instanceof CoreException ? null : reason);
- RuntimeLog.log(status);
- }
-
- public ContentType(ContentTypeManager manager) {
- this.manager = manager;
- }
-
- /**
- * @see IContentType
- */
- public void addFileSpec(String fileSpec, int type) throws CoreException {
- Assert.isLegal(type == FILE_EXTENSION_SPEC || type == FILE_NAME_SPEC, "Unknown type: " + type); //$NON-NLS-1$
- String[] userSet;
- synchronized (this) {
- if (!internalAddFileSpec(fileSpec, type | SPEC_USER_DEFINED))
- return;
- userSet = getFileSpecs(type | IGNORE_PRE_DEFINED);
- }
- // persist using preferences
- Preferences contentTypeNode = manager.getPreferences().node(id);
- String newValue = Util.toListString(userSet);
- // we are adding stuff, newValue must be non-null
- Assert.isNotNull(newValue);
- setPreference(contentTypeNode, getPreferenceKey(type), newValue);
- try {
- contentTypeNode.flush();
- } catch (BackingStoreException bse) {
- String message = NLS.bind(ContentMessages.content_errorSavingSettings, id);
- IStatus status = new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, bse);
- throw new CoreException(status);
- }
- // notify listeners
- manager.fireContentTypeChangeEvent(this);
- }
-
- int describe(IContentDescriber selectedDescriber, ILazySource contents, ContentDescription description) throws IOException {
- try {
- return contents.isText() ? ((ITextContentDescriber) selectedDescriber).describe((Reader) contents, description) : selectedDescriber.describe((InputStream) contents, description);
- } catch (RuntimeException re) {
- // describer seems to be buggy. just disable it (logging the reason)
- invalidateDescriber(re);
- } catch (Error e) {
- // describer got some serious problem. disable it (logging the reason) and throw the error again
- invalidateDescriber(e);
- throw e;
- } catch (LowLevelIOException llioe) {
- // throw the actual exception
- throw llioe.getActualException();
- } catch (IOException ioe) {
- // bugs 67841/ 62443 - non-low level IOException should be "ignored"
- if (ContentTypeManager.DEBUGGING) {
- String message = NLS.bind(ContentMessages.content_errorReadingContents, id);
- ContentType.log(message, ioe);
- }
- // we don't know what the describer would say if the exception didn't occur
- return IContentDescriber.INDETERMINATE;
- } finally {
- contents.rewind();
- }
- return IContentDescriber.INVALID;
- }
-
- public boolean equals(Object another) {
- if (another instanceof ContentType)
- return id.equals(((ContentType) another).id);
- if (another instanceof ContentTypeHandler)
- return id.equals(((ContentTypeHandler) another).id);
- return false;
- }
-
- public String getAliasTargetId() {
- return aliasTargetId;
- }
-
- /**
- * @see IContentType
- */
-
- public IContentType getBaseType() {
- return baseType;
- }
-
- String getBaseTypeId() {
- return baseTypeId;
- }
-
- public ContentTypeCatalog getCatalog() {
- return catalog;
- }
-
- public ContentType getContentType() {
- return this;
- }
-
- /**
- * @see IContentType
- */
- public String getDefaultCharset() {
- return getDefaultProperty(IContentDescription.CHARSET);
- }
-
- /**
- * @see IContentType
- */
- public IContentDescription getDefaultDescription() {
- return defaultDescription;
- }
-
- /**
- * Returns the default value for the given property in this content type, or <code>null</code>.
- */
- public String getDefaultProperty(QualifiedName key) {
- String propertyValue = internalGetDefaultProperty(key);
- if ("".equals(propertyValue)) //$NON-NLS-1$
- return null;
- return propertyValue;
- }
-
- byte getDepth() {
- byte tmpDepth = depth;
- if (tmpDepth >= 0)
- return tmpDepth;
- // depth was never computed - do it now
- if (baseType == null)
- return depth = 0;
- return depth = (byte) (baseType == null ? 0 : (1 + baseType.getDepth()));
- }
-
- /**
- * Public for tests only, should not be called by anyone else.
- */
- public IContentDescriber getDescriber() {
- try {
- // thread safety
- Object tmpDescriber = describer;
- if (tmpDescriber != null) {
- if (INHERITED_DESCRIBER == tmpDescriber)
- return baseType.getDescriber();
- return (NO_DESCRIBER == tmpDescriber) ? null : (IContentDescriber) tmpDescriber;
- }
- final String describerValue = contentTypeElement.getAttributeAsIs(DESCRIBER_ELEMENT);
- if (describerValue != null || contentTypeElement.getChildren(DESCRIBER_ELEMENT).length > 0)
- try {
- if ("".equals(describerValue)) { //$NON-NLS-1$
- describer = NO_DESCRIBER;
- return null;
- }
- describer = tmpDescriber = contentTypeElement.createExecutableExtension(DESCRIBER_ELEMENT);
- return (IContentDescriber) tmpDescriber;
- } catch (CoreException ce) {
- // the content type definition was invalid. Ensure we don't
- // try again, and this content type does not accept any
- // contents
- return invalidateDescriber(ce);
- }
- } catch (InvalidRegistryObjectException e) {
- /*
- * This should only happen if an API call is made after the registry has changed and before
- * the corresponding registry change event has been broadcast.
- */
- // the configuration element is stale - need to rebuild the catalog
- manager.invalidate();
- // bad timing - next time the client asks for a describer, s/he will have better luck
- return null;
- }
- if (baseType == null) {
- describer = NO_DESCRIBER;
- return null;
- }
- // remember so we don't have to come all the way down here next time
- describer = INHERITED_DESCRIBER;
- return baseType.getDescriber();
- }
-
- /**
- * @see IContentType
- */
- public IContentDescription getDescriptionFor(InputStream contents, QualifiedName[] options) throws IOException {
- return internalGetDescriptionFor(ContentTypeManager.readBuffer(contents), options);
- }
-
- /**
- * @see IContentType
- */
- public IContentDescription getDescriptionFor(Reader contents, QualifiedName[] options) throws IOException {
- return internalGetDescriptionFor(ContentTypeManager.readBuffer(contents), options);
- }
-
- /**
- * @see IContentType
- */
- public String[] getFileSpecs(int typeMask) {
- if (fileSpecs.isEmpty())
- return new String[0];
- // invert the last two bits so it is easier to compare
- typeMask ^= (IGNORE_PRE_DEFINED | IGNORE_USER_DEFINED);
- List result = new ArrayList(fileSpecs.size());
- for (Iterator i = fileSpecs.iterator(); i.hasNext();) {
- FileSpec spec = (FileSpec) i.next();
- if ((spec.getType() & typeMask) == spec.getType())
- result.add(spec.getText());
- }
- return (String[]) result.toArray(new String[result.size()]);
- }
-
- /**
- * @see IContentType
- */
- public String getId() {
- return id;
- }
-
- /**
- * @see IContentType
- */
- public String getName() {
- return name;
- }
-
- byte getPriority() {
- return priority;
- }
-
- public IContentTypeSettings getSettings(IScopeContext context) {
- if (context == null || context.equals(manager.getContext()))
- return this;
- return new ContentTypeSettings(this, context);
- }
-
- /*
- * Returns the alias target, if one is found, or this object otherwise.
- */
- ContentType getAliasTarget(boolean self) {
- return (self && target == null) ? this : target;
- }
-
- byte getValidation() {
- return validation;
- }
-
- boolean hasBuiltInAssociations() {
- return builtInAssociations;
- }
-
- boolean hasFileSpec(IScopeContext context, String text, int typeMask) {
- if (context.equals(manager.getContext()) || (typeMask & IGNORE_USER_DEFINED) != 0)
- return hasFileSpec(text, typeMask, false);
- String[] fileSpecs = ContentTypeSettings.getFileSpecs(context, id, typeMask);
- for (int i = 0; i < fileSpecs.length; i++)
- if (text.equalsIgnoreCase(fileSpecs[i]))
- return true;
- // no user defined association... try built-in
- return hasFileSpec(text, typeMask | IGNORE_PRE_DEFINED, false);
- }
-
- /**
- * Returns whether this content type has the given file spec.
- *
- * @param text the file spec string
- * @param typeMask FILE_NAME_SPEC or FILE_EXTENSION_SPEC
- * @param strict
- * @return true if this file spec has already been added, false otherwise
- */
- boolean hasFileSpec(String text, int typeMask, boolean strict) {
- if (fileSpecs.isEmpty())
- return false;
- for (Iterator i = fileSpecs.iterator(); i.hasNext();) {
- FileSpec spec = (FileSpec) i.next();
- if (spec.equals(text, typeMask, strict))
- return true;
- }
- return false;
- }
-
- public int hashCode() {
- return id.hashCode();
- }
-
- /**
- * Adds a user-defined or pre-defined file spec.
- */
- boolean internalAddFileSpec(String fileSpec, int typeMask) {
- if (hasFileSpec(fileSpec, typeMask, false))
- return false;
- FileSpec newFileSpec = createFileSpec(fileSpec, typeMask);
- if ((typeMask & ContentType.SPEC_USER_DEFINED) == 0) {
- // plug-in defined - all that is left to be done is to add it to the list
- if (fileSpecs.isEmpty())
- fileSpecs = new ArrayList(3);
- fileSpecs.add(newFileSpec);
- return true;
- }
- // update file specs atomically so threads traversing the list of file specs don't have to synchronize
- ArrayList tmpFileSpecs = (ArrayList) fileSpecs.clone();
- tmpFileSpecs.add(newFileSpec);
- catalog.associate(this, newFileSpec.getText(), newFileSpec.getType());
- // set the new file specs atomically
- fileSpecs = tmpFileSpecs;
- return true;
- }
-
- /**
- * Returns the default value for a property, recursively if necessary.
- */
- String internalGetDefaultProperty(QualifiedName key) {
- // a special case for charset - users can override
- if (userCharset != null && key.equals(IContentDescription.CHARSET))
- return userCharset;
- String defaultValue = basicGetDefaultProperty(key);
- if (defaultValue != null)
- return defaultValue;
- // not defined here, try base type
- return baseType == null ? null : baseType.internalGetDefaultProperty(key);
- }
-
- /**
- * Returns the value of a built-in property defined for this content type.
- */
- String basicGetDefaultProperty(QualifiedName key) {
- return defaultProperties == null ? null : (String) defaultProperties.get(key);
- }
-
- BasicDescription internalGetDescriptionFor(ILazySource buffer, QualifiedName[] options) throws IOException {
- if (buffer == null)
- return defaultDescription;
- // use temporary local var to avoid sync'ing
- IContentDescriber tmpDescriber = this.getDescriber();
- // no describer - return default description
- if (tmpDescriber == null)
- return defaultDescription;
- if (buffer.isText() && !(tmpDescriber instanceof ITextContentDescriber))
- // it is an error to provide a Reader to a non-text content type
- throw new UnsupportedOperationException();
- ContentDescription description = new ContentDescription(options, this);
- if (describe(tmpDescriber, buffer, description) == IContentDescriber.INVALID)
- // the contents were actually invalid for the content type
- return null;
- // the describer didn't add any details, return default description
- if (!description.isSet())
- return defaultDescription;
- // description cannot be changed afterwards
- description.markImmutable();
- return description;
- }
-
- byte internalIsAssociatedWith(String fileName, IScopeContext context) {
- if (hasFileSpec(context, fileName, FILE_NAME_SPEC))
- return ASSOCIATED_BY_NAME;
- String fileExtension = ContentTypeManager.getFileExtension(fileName);
- if (hasFileSpec(context, fileExtension, FILE_EXTENSION_SPEC))
- return ASSOCIATED_BY_EXTENSION;
- // if does not have built-in file specs, delegate to parent (if any)
- if (!hasBuiltInAssociations() && baseType != null)
- return baseType.internalIsAssociatedWith(fileName, context);
- return NOT_ASSOCIATED;
- }
-
- boolean internalRemoveFileSpec(String fileSpec, int typeMask) {
- if (fileSpecs.isEmpty())
- return false;
- // we modify the list of file specs atomically so we don't interfere with threads doing traversals
- ArrayList tmpFileSpecs = (ArrayList) fileSpecs.clone();
- for (Iterator i = tmpFileSpecs.iterator(); i.hasNext();) {
- FileSpec spec = (FileSpec) i.next();
- if ((spec.getType() == typeMask) && fileSpec.equals(spec.getText())) {
- i.remove();
- catalog.dissociate(this, spec.getText(), spec.getType());
- // update the list of file specs
- fileSpecs = tmpFileSpecs;
- return true;
- }
- }
- return false;
- }
-
- private IContentDescriber invalidateDescriber(Throwable reason) {
- String message = NLS.bind(ContentMessages.content_invalidContentDescriber, id);
- log(message, reason);
- return (IContentDescriber) (describer = new InvalidDescriber());
- }
-
- boolean isAlias() {
- return target != null;
- }
-
- /**
- * @see IContentType
- */
- public boolean isAssociatedWith(String fileName) {
- return isAssociatedWith(fileName, manager.getContext());
- }
-
- /**
- * @see IContentType
- */
- public boolean isAssociatedWith(String fileName, IScopeContext context) {
- return internalIsAssociatedWith(fileName, context) != NOT_ASSOCIATED;
- }
-
- /**
- * @see IContentType
- */
- public boolean isKindOf(IContentType another) {
- if (another == null)
- return false;
- if (this == another)
- return true;
- return baseType != null && baseType.isKindOf(another);
- }
-
- boolean isValid() {
- return validation == STATUS_VALID;
- }
-
- void processPreferences(Preferences contentTypeNode) {
- // user set default charset
- this.userCharset = contentTypeNode.get(PREF_DEFAULT_CHARSET, null);
- // user set file names
- String userSetFileNames = contentTypeNode.get(PREF_FILE_NAMES, null);
- String[] fileNames = Util.parseItems(userSetFileNames);
- for (int i = 0; i < fileNames.length; i++)
- internalAddFileSpec(fileNames[i], FILE_NAME_SPEC | SPEC_USER_DEFINED);
- // user set file extensions
- String userSetFileExtensions = contentTypeNode.get(PREF_FILE_EXTENSIONS, null);
- String[] fileExtensions = Util.parseItems(userSetFileExtensions);
- for (int i = 0; i < fileExtensions.length; i++)
- internalAddFileSpec(fileExtensions[i], FILE_EXTENSION_SPEC | SPEC_USER_DEFINED);
- }
-
- /**
- * @see IContentType
- */
- public void removeFileSpec(String fileSpec, int type) throws CoreException {
- Assert.isLegal(type == FILE_EXTENSION_SPEC || type == FILE_NAME_SPEC, "Unknown type: " + type); //$NON-NLS-1$
- synchronized (this) {
- if (!internalRemoveFileSpec(fileSpec, type | SPEC_USER_DEFINED))
- return;
- }
- // persist the change
- Preferences contentTypeNode = manager.getPreferences().node(id);
- final String[] userSet = getFileSpecs(type | IGNORE_PRE_DEFINED);
- String preferenceKey = getPreferenceKey(type);
- String newValue = Util.toListString(userSet);
- setPreference(contentTypeNode, preferenceKey, newValue);
- try {
- contentTypeNode.flush();
- } catch (BackingStoreException bse) {
- String message = NLS.bind(ContentMessages.content_errorSavingSettings, id);
- IStatus status = new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, bse);
- throw new CoreException(status);
- }
- // notify listeners
- manager.fireContentTypeChangeEvent(this);
- }
-
- void setAliasTarget(ContentType newTarget) {
- target = newTarget;
- }
-
- /**
- * @see IContentType
- */
- public void setDefaultCharset(String newCharset) throws CoreException {
- synchronized (this) {
- // don't do anything if there is no actual change
- if (userCharset == null) {
- if (newCharset == null)
- return;
- } else if (userCharset.equals(newCharset))
- return;
- // apply change in memory
- userCharset = newCharset;
- }
- // persist the change
- Preferences contentTypeNode = manager.getPreferences().node(id);
- setPreference(contentTypeNode, PREF_DEFAULT_CHARSET, userCharset);
- try {
- contentTypeNode.flush();
- } catch (BackingStoreException bse) {
- String message = NLS.bind(ContentMessages.content_errorSavingSettings, id);
- IStatus status = new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, bse);
- throw new CoreException(status);
- }
- // notify listeners
- manager.fireContentTypeChangeEvent(this);
- }
-
- static void setPreference(Preferences node, String key, String value) {
- if (value == null)
- node.remove(key);
- else
- node.put(key, value);
- }
-
- void setValidation(byte validation) {
- this.validation = validation;
- if (ContentTypeManager.DEBUGGING)
- ContentMessages.message("Validating " + this + ": " + getValidationString(validation)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public String toString() {
- return id;
- }
-
- void setBaseType(ContentType baseType) {
- this.baseType = baseType;
- }
-
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeBuilder.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeBuilder.java
deleted file mode 100644
index 1ab61c6..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeBuilder.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.util.*;
-import org.eclipse.core.internal.runtime.RuntimeLog;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IPreferenceNodeVisitor;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * This class is a sidekick for ContentTypeManager that provides mechanisms for
- * creating content types from the extension registry (which ContentTypeManager
- * is oblivious to).
- */
-public class ContentTypeBuilder {
- public static final String PT_CONTENTTYPES = "contentTypes"; //$NON-NLS-1$
- private ContentTypeCatalog catalog;
-
- private static String getUniqueId(String namespace, String baseTypeId) {
- if (baseTypeId == null)
- return null;
- int separatorPosition = baseTypeId.lastIndexOf('.');
- // base type is defined in the same namespace
- if (separatorPosition == -1)
- baseTypeId = namespace + '.' + baseTypeId;
- return baseTypeId;
- }
-
- private static QualifiedName parseQualifiedName(String namespace, String value) {
- if (value == null)
- return null;
- int separatorPosition = value.lastIndexOf('.');
- // base type is defined in the same namespace
- if (separatorPosition == -1)
- return new QualifiedName(namespace, value);
- if (separatorPosition == 0 || separatorPosition == value.length() - 1)
- // invalid value specified
- return null;
- namespace = value.substring(0, separatorPosition);
- String simpleValue = value.substring(separatorPosition + 1);
- return new QualifiedName(namespace, simpleValue);
- }
-
- private static byte parsePriority(String priority) {
- if (priority == null)
- return ContentType.PRIORITY_NORMAL;
- if (priority.equals("high")) //$NON-NLS-1$
- return ContentType.PRIORITY_HIGH;
- if (priority.equals("low")) //$NON-NLS-1$
- return ContentType.PRIORITY_LOW;
- if (!priority.equals("normal")) //$NON-NLS-1$
- return ContentType.PRIORITY_NORMAL;
- //TODO: should log - INVALID PRIORITY
- return ContentType.PRIORITY_NORMAL;
- }
-
- protected ContentTypeBuilder(ContentTypeCatalog catalog) {
- this.catalog = catalog;
- }
-
- private void addFileAssociation(IConfigurationElement fileAssociationElement, ContentType target) {
- String[] fileNames = Util.parseItems(fileAssociationElement.getAttributeAsIs("file-names")); //$NON-NLS-1$
- for (int i = 0; i < fileNames.length; i++)
- target.internalAddFileSpec(fileNames[i], IContentType.FILE_NAME_SPEC | ContentType.SPEC_PRE_DEFINED);
- String[] fileExtensions = Util.parseItems(fileAssociationElement.getAttributeAsIs("file-extensions")); //$NON-NLS-1$
- for (int i = 0; i < fileExtensions.length; i++)
- target.internalAddFileSpec(fileExtensions[i], IContentType.FILE_EXTENSION_SPEC | ContentType.SPEC_PRE_DEFINED);
- }
-
- /**
- * Builds all content types found in the extension registry.
- */
- public void buildCatalog() {
- IConfigurationElement[] allContentTypeCEs = getConfigurationElements();
- for (int i = 0; i < allContentTypeCEs.length; i++)
- if (allContentTypeCEs[i].getName().equals("content-type")) //$NON-NLS-1$
- registerContentType(allContentTypeCEs[i]);
- for (int i = 0; i < allContentTypeCEs.length; i++)
- if (allContentTypeCEs[i].getName().equals("file-association")) //$NON-NLS-1$
- registerFileAssociation(allContentTypeCEs[i]);
- applyPreferences();
- }
-
- /**
- * Applies any existing preferences to content types as a batch operation.
- */
- private void applyPreferences() {
- try {
- final ContentTypeCatalog localCatalog = catalog;
- final IEclipsePreferences root = localCatalog.getManager().getPreferences();
- root.accept(new IPreferenceNodeVisitor() {
- public boolean visit(IEclipsePreferences node) {
- if (node == root)
- return true;
- ContentType contentType = localCatalog.internalGetContentType(node.name());
- if (contentType != null)
- contentType.processPreferences(node);
- // content type nodes don't have any children anyway
- return false;
- }
- });
- } catch (BackingStoreException bse) {
- ContentType.log(ContentMessages.content_errorLoadingSettings, bse);
- }
- }
-
- /**
- * @throws CoreException if mandatory attributes are missing in the markup
- */
- private ContentType createContentType(IConfigurationElement contentTypeCE) throws CoreException {
- String namespace = contentTypeCE.getContributor().getName();
- String simpleId = contentTypeCE.getAttributeAsIs("id"); //$NON-NLS-1$
- String name = contentTypeCE.getAttribute("name"); //$NON-NLS-1$
-
- if (simpleId == null)
- missingMandatoryAttribute(ContentMessages.content_missingIdentifier, namespace);
- String uniqueId;
- if (simpleId.lastIndexOf('.') == -1)
- uniqueId = namespace + '.' + simpleId;
- else
- uniqueId = simpleId;
- if (name == null)
- missingMandatoryAttribute(ContentMessages.content_missingName, uniqueId);
-
- byte priority = parsePriority(contentTypeCE.getAttributeAsIs("priority")); //$NON-NLS-1$);
- String[] fileNames = Util.parseItems(contentTypeCE.getAttributeAsIs("file-names")); //$NON-NLS-1$
- String[] fileExtensions = Util.parseItems(contentTypeCE.getAttributeAsIs("file-extensions")); //$NON-NLS-1$
- String baseTypeId = getUniqueId(namespace, contentTypeCE.getAttributeAsIs("base-type")); //$NON-NLS-1$
- String aliasTargetTypeId = getUniqueId(namespace, contentTypeCE.getAttributeAsIs("alias-for")); //$NON-NLS-1$
- IConfigurationElement[] propertyCEs = null;
- Map defaultProperties = null;
- if ((propertyCEs = contentTypeCE.getChildren("property")).length > 0) { //$NON-NLS-1$
- defaultProperties = new HashMap();
- for (int i = 0; i < propertyCEs.length; i++) {
- String defaultValue = propertyCEs[i].getAttributeAsIs("default"); //$NON-NLS-1$
- if (defaultValue == null)
- // empty string means: default value is null
- defaultValue = ""; //$NON-NLS-1$
- String propertyKey = propertyCEs[i].getAttributeAsIs("name"); //$NON-NLS-1$
- QualifiedName qualifiedKey = parseQualifiedName(namespace, propertyKey);
- if (qualifiedKey == null) {
- if (ContentTypeManager.DEBUGGING) {
- String message = NLS.bind(ContentMessages.content_invalidProperty, propertyKey, getUniqueId(namespace, simpleId));
- ContentType.log(message, null);
- }
- continue;
- }
- defaultProperties.put(qualifiedKey, defaultValue);
- }
- }
- String defaultCharset = contentTypeCE.getAttributeAsIs("default-charset"); //$NON-NLS-1$
- if (defaultCharset != null)
- if (defaultProperties == null)
- defaultProperties = Collections.singletonMap(IContentDescription.CHARSET, defaultCharset);
- else if (!defaultProperties.containsKey(IContentDescription.CHARSET))
- defaultProperties.put(IContentDescription.CHARSET, defaultCharset);
- return ContentType.createContentType(catalog, uniqueId, name, priority, fileExtensions, fileNames, baseTypeId, aliasTargetTypeId, defaultProperties, contentTypeCE);
- }
-
- // Store this around for performance
- private final static IConfigurationElement[] emptyConfArray = new IConfigurationElement[0];
-
- /**
- * Gets confuguration elements for both "backward compatible" extension point
- * org.eclipse.core.runtime.contentTypes
- * and "new" extension point controlled by this plugin:
- * org.eclipse.core.contenttype.contentTypes
- */
- protected IConfigurationElement[] getConfigurationElements() {
- IExtensionRegistry registry = RegistryFactory.getRegistry();
- if (registry == null)
- return emptyConfArray;
- IConfigurationElement[] oldConfigElements = emptyConfArray;
- IConfigurationElement[] newConfigElements = emptyConfArray;
- // "old" extenstion point
- IExtensionPoint oldPoint = registry.getExtensionPoint(IContentConstants.RUNTIME_NAME, PT_CONTENTTYPES);
- if (oldPoint != null)
- oldConfigElements = oldPoint.getConfigurationElements();
- // "new" extension point
- IExtensionPoint newPoint = registry.getExtensionPoint(IContentConstants.CONTENT_NAME, PT_CONTENTTYPES);
- if (newPoint != null)
- newConfigElements = newPoint.getConfigurationElements();
-
- IConfigurationElement[] allContentTypeCEs = new IConfigurationElement[oldConfigElements.length + newConfigElements.length];
- System.arraycopy(oldConfigElements, 0, allContentTypeCEs, 0, oldConfigElements.length);
- System.arraycopy(newConfigElements, 0, allContentTypeCEs, oldConfigElements.length, newConfigElements.length);
-
- return allContentTypeCEs;
- }
-
- private void missingMandatoryAttribute(String messageKey, String argument) throws CoreException {
- String message = NLS.bind(messageKey, argument);
- throw new CoreException(new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, null));
- }
-
- private void registerContentType(IConfigurationElement contentTypeCE) {
- try {
- ContentType contentType = createContentType(contentTypeCE);
- catalog.addContentType(contentType);
- } catch (CoreException e) {
- // failed validation
- RuntimeLog.log(e.getStatus());
- }
- }
-
- /* Adds extra file associations to existing content types. If the content
- * type has not been added, the file association is ignored.
- */
- private void registerFileAssociation(IConfigurationElement fileAssociationElement) {
- //TODO: need to ensure the config. element is valid
- String contentTypeId = getUniqueId(fileAssociationElement.getContributor().getName(), fileAssociationElement.getAttribute("content-type")); //$NON-NLS-1$
- ContentType target = catalog.internalGetContentType(contentTypeId);
- if (target == null)
- return;
- addFileAssociation(fileAssociationElement, target);
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeCatalog.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeCatalog.java
deleted file mode 100644
index 5eb63bc..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeCatalog.java
+++ /dev/null
@@ -1,555 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.io.*;
-import java.util.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.content.*;
-import org.eclipse.core.runtime.content.IContentTypeManager.ISelectionPolicy;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-
-public final class ContentTypeCatalog {
- private static final IContentType[] NO_CONTENT_TYPES = new IContentType[0];
-
- private Map allChildren = new HashMap();
- private Map contentTypes = new HashMap();
-
- private Map fileExtensions = new HashMap();
-
- private Map fileNames = new HashMap();
-
- private int generation;
-
- private ContentTypeManager manager;
-
- /**
- * A sorting policy where the more generic content type wins. Lexicographical comparison is done
- * as a last resort when all other criteria fail.
- */
- private Comparator policyConstantGeneralIsBetter = new Comparator() {
- public int compare(Object o1, Object o2) {
- ContentType type1 = (ContentType) o1;
- ContentType type2 = (ContentType) o2;
- // first criteria: depth - the lower, the better
- int depthCriteria = type1.getDepth() - type2.getDepth();
- if (depthCriteria != 0)
- return depthCriteria;
- // second criteria: priority - the higher, the better
- int priorityCriteria = type1.getPriority() - type2.getPriority();
- if (priorityCriteria != 0)
- return -priorityCriteria;
- // they have same depth and priority - choose one arbitrarily (stability is important)
- return type1.getId().compareTo(type2.getId());
- }
- };
-
- /**
- * A sorting policy where the more specific content type wins. Lexicographical comparison is done
- * as a last resort when all other criteria fail.
- */
- private Comparator policyConstantSpecificIsBetter = new Comparator() {
- public int compare(Object o1, Object o2) {
- ContentType type1 = (ContentType) o1;
- ContentType type2 = (ContentType) o2;
- // first criteria: depth - the higher, the better
- int depthCriteria = type1.getDepth() - type2.getDepth();
- if (depthCriteria != 0)
- return -depthCriteria;
- // second criteria: priority - the higher, the better
- int priorityCriteria = type1.getPriority() - type2.getPriority();
- if (priorityCriteria != 0)
- return -priorityCriteria;
- // they have same depth and priority - choose one arbitrarily (stability is important)
- return type1.getId().compareTo(type2.getId());
- }
- };
-
- /**
- * A sorting policy where the more general content type wins.
- */
- private Comparator policyGeneralIsBetter = new Comparator() {
- public int compare(Object o1, Object o2) {
- ContentType type1 = (ContentType) o1;
- ContentType type2 = (ContentType) o2;
- // first criteria: depth - the lower, the better
- int depthCriteria = type1.getDepth() - type2.getDepth();
- if (depthCriteria != 0)
- return depthCriteria;
- // second criteria: priority - the higher, the better
- int priorityCriteria = type1.getPriority() - type2.getPriority();
- if (priorityCriteria != 0)
- return -priorityCriteria;
- return 0;
- }
- };
-
- /**
- * A sorting policy where content types are sorted by id.
- */
- private Comparator policyLexicographical = new Comparator() {
- public int compare(Object o1, Object o2) {
- ContentType type1 = (ContentType) o1;
- ContentType type2 = (ContentType) o2;
- return type1.getId().compareTo(type2.getId());
- }
- };
- /**
- * A sorting policy where the more specific content type wins.
- */
- private Comparator policySpecificIsBetter = new Comparator() {
- public int compare(Object o1, Object o2) {
- ContentType type1 = (ContentType) o1;
- ContentType type2 = (ContentType) o2;
- // first criteria: depth - the higher, the better
- int depthCriteria = type1.getDepth() - type2.getDepth();
- if (depthCriteria != 0)
- return -depthCriteria;
- // second criteria: priority - the higher, the better
- int priorityCriteria = type1.getPriority() - type2.getPriority();
- if (priorityCriteria != 0)
- return -priorityCriteria;
- return 0;
- }
- };
-
- private static IContentType[] concat(IContentType[][] types) {
- if (types[0].length == 0)
- return types[1];
- if (types[1].length == 0)
- return types[0];
- IContentType[] result = new IContentType[types[0].length + types[1].length];
- System.arraycopy(types[0], 0, result, 0, types[0].length);
- System.arraycopy(types[1], 0, result, types[0].length, types[1].length);
- return result;
- }
-
- public ContentTypeCatalog(ContentTypeManager manager, int generation) {
- this.manager = manager;
- this.generation = generation;
- }
-
- void addContentType(IContentType contentType) {
- contentTypes.put(contentType.getId(), contentType);
- }
-
- /**
- * Applies a client-provided selection policy.
- */
- private IContentType[] applyPolicy(final IContentTypeManager.ISelectionPolicy policy, final IContentType[] candidates, final boolean fileName, final boolean contents) {
- final IContentType[][] result = new IContentType[][] {candidates};
- SafeRunner.run(new ISafeRunnable() {
- public void handleException(Throwable exception) {
- // already logged in SafeRunner#run()
- // default result is the original array
- // nothing to be done
- }
-
- public void run() throws Exception {
- result[0] = policy.select(candidates, fileName, contents);
- }
- });
- return result[0];
- }
-
- void associate(ContentType contentType) {
- String[] builtInFileNames = contentType.getFileSpecs(IContentType.IGNORE_USER_DEFINED | IContentType.FILE_NAME_SPEC);
- for (int i = 0; i < builtInFileNames.length; i++)
- associate(contentType, builtInFileNames[i], IContentType.FILE_NAME_SPEC);
- String[] builtInFileExtensions = contentType.getFileSpecs(IContentType.IGNORE_USER_DEFINED | IContentType.FILE_EXTENSION_SPEC);
- for (int i = 0; i < builtInFileExtensions.length; i++)
- associate(contentType, builtInFileExtensions[i], IContentType.FILE_EXTENSION_SPEC);
- }
-
- void associate(ContentType contentType, String text, int type) {
- Map fileSpecMap = ((type & IContentType.FILE_NAME_SPEC) != 0) ? fileNames : fileExtensions;
- String mappingKey = FileSpec.getMappingKeyFor(text);
- Set existing = (Set) fileSpecMap.get(mappingKey);
- if (existing == null)
- fileSpecMap.put(mappingKey, existing = new HashSet());
- existing.add(contentType);
- }
-
- private int collectMatchingByContents(int valid, IContentType[] subset, List destination, ILazySource contents) throws IOException {
- for (int i = 0; i < subset.length; i++) {
- ContentType current = (ContentType) subset[i];
- IContentDescriber describer = current.getDescriber();
- int status = IContentDescriber.INDETERMINATE;
- if (describer != null) {
- if (contents.isText() && !(describer instanceof ITextContentDescriber))
- // for text streams we skip content types that do not provide text-based content describers
- continue;
- status = current.describe(describer, contents, null);
- if (status == IContentDescriber.INVALID)
- continue;
- }
- if (status == IContentDescriber.VALID)
- destination.add(valid++, current);
- else
- destination.add(current);
- }
- return valid;
- }
-
- void dissociate(ContentType contentType, String text, int type) {
- Map fileSpecMap = ((type & IContentType.FILE_NAME_SPEC) != 0) ? fileNames : fileExtensions;
- String mappingKey = FileSpec.getMappingKeyFor(text);
- Set existing = (Set) fileSpecMap.get(mappingKey);
- if (existing == null)
- return;
- existing.remove(contentType);
- }
-
- /**
- * A content type will be valid if:
- * <ol>
- * <li>it does not designate a base type, or</li>
- * <li>it designates a base type that exists and is valid</li>
- * </ol>
- * <p>And</p>:
- * <ol>
- * <li>it does not designate an alias type, or</li>
- * <li>it designates an alias type that does not exist, or</li>
- * <li>it designates an alias type that exists and is valid</li>
- * </ol>
- */
- private boolean ensureValid(ContentType type) {
- if (type.getValidation() != ContentType.STATUS_UNKNOWN)
- // already processed
- return type.isValid();
- // set this type temporarily as invalid to prevent cycles
- // all types in a cycle would remain as invalid
- type.setValidation(ContentType.STATUS_INVALID);
- if (type.isAlias())
- // it is an alias, leave as invalid
- return false;
- // check base type
- ContentType baseType = null;
- if (type.getBaseTypeId() != null) {
- baseType = (ContentType) contentTypes.get(type.getBaseTypeId());
- if (baseType == null)
- // invalid: specified base type is not known
- return false;
- // base type exists, ensure it is valid
- baseType = baseType.getAliasTarget(true);
- ensureValid(baseType);
- if (baseType.getValidation() != ContentType.STATUS_VALID)
- // invalid: base type was invalid
- return false;
- }
- // valid: all conditions satisfied
- type.setValidation(ContentType.STATUS_VALID);
- type.setBaseType(baseType);
- return true;
- }
-
- IContentType[] findContentTypesFor(ContentTypeMatcher matcher, InputStream contents, String fileName) throws IOException {
- final ILazySource buffer = ContentTypeManager.readBuffer(contents);
- IContentType[] selected = internalFindContentTypesFor(matcher, buffer, fileName, true);
- // give the policy a chance to change the results
- ISelectionPolicy policy = matcher.getPolicy();
- if (policy != null)
- selected = applyPolicy(policy, selected, fileName != null, true);
- return selected;
- }
-
- IContentType[] findContentTypesFor(ContentTypeMatcher matcher, final String fileName) {
- IContentType[] selected = concat(internalFindContentTypesFor(matcher, fileName, policyConstantGeneralIsBetter));
- // give the policy a chance to change the results
- ISelectionPolicy policy = matcher.getPolicy();
- if (policy != null)
- selected = applyPolicy(policy, selected, true, false);
- return selected;
- }
-
- public IContentType[] getAllContentTypes() {
- List result = new ArrayList(contentTypes.size());
- for (Iterator i = contentTypes.values().iterator(); i.hasNext();) {
- ContentType type = (ContentType) i.next();
- if (type.isValid() && !type.isAlias())
- result.add(type);
- }
- return (IContentType[]) result.toArray(new IContentType[result.size()]);
- }
-
- public ContentType[] getChildren(ContentType parent) {
- ContentType[] children = (ContentType[]) allChildren.get(parent);
- if (children != null)
- return children;
- List result = new ArrayList(5);
- for (Iterator i = this.contentTypes.values().iterator(); i.hasNext();) {
- ContentType next = (ContentType) i.next();
- if (next.getBaseType() == parent)
- result.add(next);
- }
- children = (ContentType[]) result.toArray(new ContentType[result.size()]);
- allChildren.put(parent, children);
- return children;
- }
-
- public ContentType getContentType(String contentTypeIdentifier) {
- ContentType type = internalGetContentType(contentTypeIdentifier);
- return (type != null && type.isValid() && !type.isAlias()) ? type : null;
- }
-
- private IContentDescription getDescriptionFor(ContentTypeMatcher matcher, ILazySource contents, String fileName, QualifiedName[] options) throws IOException {
- IContentType[] selected = internalFindContentTypesFor(matcher, contents, fileName, false);
- if (selected.length == 0)
- return null;
- // give the policy a chance to change the results
- ISelectionPolicy policy = matcher.getPolicy();
- if (policy != null) {
- selected = applyPolicy(policy, selected, fileName != null, true);
- if (selected.length == 0)
- return null;
- }
- return matcher.getSpecificDescription(((ContentType) selected[0]).internalGetDescriptionFor(contents, options));
- }
-
- public IContentDescription getDescriptionFor(ContentTypeMatcher matcher, InputStream contents, String fileName, QualifiedName[] options) throws IOException {
- return getDescriptionFor(matcher, ContentTypeManager.readBuffer(contents), fileName, options);
- }
-
- public IContentDescription getDescriptionFor(ContentTypeMatcher matcher, Reader contents, String fileName, QualifiedName[] options) throws IOException {
- return getDescriptionFor(matcher, ContentTypeManager.readBuffer(contents), fileName, options);
- }
-
- public int getGeneration() {
- return generation;
- }
-
- public ContentTypeManager getManager() {
- return manager;
- }
-
- public boolean internalAccept(ContentTypeVisitor visitor, ContentType root) {
- if (!root.isValid() || root.isAlias())
- return true;
- int result = visitor.visit(root);
- switch (result) {
- // stop traversing the tree
- case ContentTypeVisitor.STOP :
- return false;
- // stop traversing this subtree
- case ContentTypeVisitor.RETURN :
- return true;
- }
- ContentType[] children = getChildren(root);
- if (children == null)
- // this content type has no sub-types - keep traversing the tree
- return true;
- for (int i = 0; i < children.length; i++)
- if (!internalAccept(visitor, children[i]))
- // stop the traversal
- return false;
- return true;
- }
-
- public IContentType[] internalFindContentTypesFor(ILazySource buffer, IContentType[][] subset, Comparator validPolicy, Comparator indeterminatePolicy) throws IOException {
- final List appropriate = new ArrayList(5);
- final int validFullName = collectMatchingByContents(0, subset[0], appropriate, buffer);
- final int appropriateFullName = appropriate.size();
- final int validExtension = collectMatchingByContents(validFullName, subset[1], appropriate, buffer) - validFullName;
- final int appropriateExtension = appropriate.size() - appropriateFullName;
- IContentType[] result = (IContentType[]) appropriate.toArray(new IContentType[appropriate.size()]);
- if (validFullName > 1)
- Arrays.sort(result, 0, validFullName, validPolicy);
- if (validExtension > 1)
- Arrays.sort(result, validFullName, validFullName + validExtension, validPolicy);
- if (appropriateFullName - validFullName > 1)
- Arrays.sort(result, validFullName + validExtension, appropriateFullName + validExtension, indeterminatePolicy);
- if (appropriateExtension - validExtension > 1)
- Arrays.sort(result, appropriateFullName + validExtension, appropriate.size(), indeterminatePolicy);
- return result;
- }
-
- private IContentType[] internalFindContentTypesFor(ContentTypeMatcher matcher, ILazySource buffer, String fileName, boolean forceValidation) throws IOException {
- final IContentType[][] subset;
- final Comparator validPolicy;
- Comparator indeterminatePolicy;
- if (fileName == null) {
- // we only have a single array, by need to provide a two-dimensional, 2-element array
- subset = new IContentType[][] {getAllContentTypes(), NO_CONTENT_TYPES};
- indeterminatePolicy = policyConstantGeneralIsBetter;
- validPolicy = policyConstantSpecificIsBetter;
- } else {
- subset = internalFindContentTypesFor(matcher, fileName, policyLexicographical);
- indeterminatePolicy = policyGeneralIsBetter;
- validPolicy = policySpecificIsBetter;
- }
- int total = subset[0].length + subset[1].length;
- if (total == 0)
- // don't do further work if subset is empty
- return NO_CONTENT_TYPES;
- if (!forceValidation && total == 1) {
- // do not do validation if not forced and only one was found (caller will validate later)
- IContentType[] found = subset[0].length == 1 ? subset[0] : subset[1];
- // bug 100032 - ignore binary content type if contents are text
- if (!buffer.isText())
- // binary buffer, caller can call the describer with no risk
- return found;
- // text buffer, need to check describer
- IContentDescriber describer = ((ContentType) found[0]).getDescriber();
- if (describer == null || describer instanceof ITextContentDescriber)
- // no describer or text describer, that is fine
- return found;
- // only eligible content type is binary and contents are text, ignore it
- return NO_CONTENT_TYPES;
- }
- return internalFindContentTypesFor(buffer, subset, validPolicy, indeterminatePolicy);
- }
-
- /**
- * This is the implementation for file name based content type matching.
- *
- * @return all matching content types in the preferred order
- * @see IContentTypeManager#findContentTypesFor(String)
- */
- public IContentType[][] internalFindContentTypesFor(ContentTypeMatcher matcher, final String fileName, Comparator sortingPolicy) {
- IScopeContext context = matcher.getContext();
- IContentType[][] result = {NO_CONTENT_TYPES, NO_CONTENT_TYPES};
-
- final Set allByFileName;
-
- if (context.equals(manager.getContext()))
- allByFileName = getDirectlyAssociated(fileName, IContentTypeSettings.FILE_NAME_SPEC);
- else {
- allByFileName = new HashSet(getDirectlyAssociated(fileName, IContentTypeSettings.FILE_NAME_SPEC | IContentType.IGNORE_USER_DEFINED));
- allByFileName.addAll(matcher.getDirectlyAssociated(this, fileName, IContentTypeSettings.FILE_NAME_SPEC));
- }
- Set selectedByName = selectMatchingByName(context, allByFileName, Collections.EMPTY_SET, fileName, IContentType.FILE_NAME_SPEC);
- result[0] = (IContentType[]) selectedByName.toArray(new IContentType[selectedByName.size()]);
- final String fileExtension = ContentTypeManager.getFileExtension(fileName);
- if (fileExtension != null) {
- final Set allByFileExtension;
- if (context.equals(manager.getContext()))
- allByFileExtension = getDirectlyAssociated(fileExtension, IContentTypeSettings.FILE_EXTENSION_SPEC);
- else {
- allByFileExtension = new HashSet(getDirectlyAssociated(fileExtension, IContentTypeSettings.FILE_EXTENSION_SPEC | IContentType.IGNORE_USER_DEFINED));
- allByFileExtension.addAll(matcher.getDirectlyAssociated(this, fileExtension, IContentTypeSettings.FILE_EXTENSION_SPEC));
- }
- Set selectedByExtension = selectMatchingByName(context, allByFileExtension, selectedByName, fileExtension, IContentType.FILE_EXTENSION_SPEC);
- if (!selectedByExtension.isEmpty())
- result[1] = (IContentType[]) selectedByExtension.toArray(new IContentType[selectedByExtension.size()]);
- }
- if (result[0].length > 1)
- Arrays.sort(result[0], sortingPolicy);
- if (result[1].length > 1)
- Arrays.sort(result[1], sortingPolicy);
- return result;
- }
-
- /**
- * Returns content types directly associated with the given file spec.
- *
- * @param text a file name or extension
- * @param typeMask a bit-wise or of the following flags:
- * <ul>
- * <li>IContentType.FILE_NAME, </li>
- * <li>IContentType.FILE_EXTENSION, </li>
- * <li>IContentType.IGNORE_PRE_DEFINED, </li>
- * <li>IContentType.IGNORE_USER_DEFINED</li>
- * </ul>
- * @return a set of content types
- */
- public Set getDirectlyAssociated(String text, int typeMask) {
- Map associations = (typeMask & IContentTypeSettings.FILE_NAME_SPEC) != 0 ? fileNames : fileExtensions;
- Set result = null;
- if ((typeMask & (IContentType.IGNORE_PRE_DEFINED | IContentType.IGNORE_USER_DEFINED)) == 0)
- // no restrictions, get everything
- result = (Set) associations.get(FileSpec.getMappingKeyFor(text));
- else {
- // only those specs satisfying the type mask should be included
- Set initialSet = (Set) associations.get(FileSpec.getMappingKeyFor(text));
- if (initialSet != null && !initialSet.isEmpty()) {
- // copy so we can modify
- result = new HashSet(initialSet);
- // invert the last two bits so it is easier to compare
- typeMask ^= (IContentType.IGNORE_PRE_DEFINED | IContentType.IGNORE_USER_DEFINED);
- for (Iterator i = result.iterator(); i.hasNext();) {
- ContentType contentType = (ContentType) i.next();
- if (!contentType.hasFileSpec(text, typeMask, true))
- i.remove();
- }
- }
- }
- return result == null ? Collections.EMPTY_SET : result;
- }
-
- ContentType internalGetContentType(String contentTypeIdentifier) {
- return (ContentType) contentTypes.get(contentTypeIdentifier);
- }
-
- void makeAliases() {
- // process all content types marking aliases appropriately
- for (Iterator i = contentTypes.values().iterator(); i.hasNext();) {
- ContentType type = (ContentType) i.next();
- String targetId = type.getAliasTargetId();
- if (targetId == null)
- continue;
- ContentType target = internalGetContentType(targetId);
- if (target != null)
- type.setAliasTarget(target);
- }
- }
-
- /**
- * Resolves inter-content type associations (inheritance and aliasing).
- */
- protected void organize() {
- // build the aliasing
- makeAliases();
- // do the validation
- for (Iterator i = contentTypes.values().iterator(); i.hasNext();) {
- ContentType type = (ContentType) i.next();
- if (ensureValid(type))
- associate(type);
- }
- if (ContentTypeManager.DEBUGGING)
- for (Iterator i = contentTypes.values().iterator(); i.hasNext();) {
- ContentType type = (ContentType) i.next();
- if (!type.isValid())
- ContentMessages.message("Invalid: " + type); //$NON-NLS-1$
- }
- }
-
- /**
- * Processes all content types in source, adding those matching the given file spec to the
- * destination collection.
- */
- private Set selectMatchingByName(final IScopeContext context, Collection source, final Collection existing, final String fileSpecText, final int fileSpecType) {
- if (source == null || source.isEmpty())
- return Collections.EMPTY_SET;
- final Set destination = new HashSet(5);
- // process all content types in the given collection
- for (Iterator i = source.iterator(); i.hasNext();) {
- final ContentType root = (ContentType) i.next();
- // From a given content type, check if it matches, and
- // include any children that match as well.
- internalAccept(new ContentTypeVisitor() {
- public int visit(ContentType type) {
- if (type != root && type.hasBuiltInAssociations())
- // this content type has built-in associations - visit it later as root
- return RETURN;
- if (type == root && !type.hasFileSpec(context, fileSpecText, fileSpecType))
- // it is the root and does not match the file name - do not add it nor look into its children
- return RETURN;
- // either the content type is the root and matches the file name or
- // is a sub content type and does not have built-in files specs
- if (!existing.contains(type))
- destination.add(type);
- return CONTINUE;
- }
- }, root);
- }
- return destination;
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeHandler.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeHandler.java
deleted file mode 100644
index 74cdad3..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeHandler.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.io.*;
-import java.lang.ref.SoftReference;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.*;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-
-/**
- * The only content types exposed to clients. Allows the content type registry to change
- * underneath preserving handlers kept by clients.
- */
-public class ContentTypeHandler implements IContentType {
-
- /**
- * A dummy description object to be returned by getDescription when this
- * handler's target cannot be determined.
- */
- private class DummyContentDescription implements IContentDescription {
- public String getCharset() {
- return null;
- }
-
- public IContentType getContentType() {
- return ContentTypeHandler.this;
- }
-
- public Object getProperty(QualifiedName key) {
- return null;
- }
-
- public boolean isRequested(QualifiedName key) {
- return false;
- }
-
- public void setProperty(QualifiedName key, Object value) {
- // don't do anything
- }
- }
-
- private int generation;
- String id;
- private SoftReference targetRef;
-
- ContentTypeHandler(ContentType target, int generation) {
- this.id = target.getId();
- this.targetRef = new SoftReference(target);
- this.generation = generation;
- }
-
- public void addFileSpec(String fileSpec, int type) throws CoreException {
- final IContentType target = getTarget();
- if (target != null)
- target.addFileSpec(fileSpec, type);
- }
-
- public boolean equals(Object another) {
- if (another instanceof ContentType)
- return id.equals(((ContentType) another).id);
- if (another instanceof ContentTypeHandler)
- return id.equals(((ContentTypeHandler) another).id);
- return false;
- }
-
- public IContentType getBaseType() {
- final ContentType target = getTarget();
- if (target == null)
- return null;
- final ContentType baseType = (ContentType) target.getBaseType();
- return (baseType != null) ? new ContentTypeHandler(baseType, baseType.getCatalog().getGeneration()) : null;
- }
-
- public String getDefaultCharset() {
- final IContentType target = getTarget();
- return (target != null) ? target.getDefaultCharset() : null;
- }
-
- public IContentDescription getDefaultDescription() {
- final IContentType target = getTarget();
- return (target != null) ? target.getDefaultDescription() : new DummyContentDescription();
- }
-
- public IContentDescription getDescriptionFor(InputStream contents, QualifiedName[] options) throws IOException {
- final IContentType target = getTarget();
- return (target != null) ? target.getDescriptionFor(contents, options) : null;
- }
-
- public IContentDescription getDescriptionFor(Reader contents, QualifiedName[] options) throws IOException {
- final IContentType target = getTarget();
- return (target != null) ? target.getDescriptionFor(contents, options) : null;
- }
-
- public String[] getFileSpecs(int type) {
- final IContentType target = getTarget();
- return (target != null) ? target.getFileSpecs(type) : new String[0];
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- final IContentType target = getTarget();
- return (target != null) ? target.getName() : id;
- }
-
- public IContentTypeSettings getSettings(IScopeContext context) throws CoreException {
- final ContentType target = getTarget();
- if (target == null)
- return null;
- // the content type may returned itself as the settings object (instance scope context)
- final IContentTypeSettings settings = target.getSettings(context);
- // in that case, return this same handler; otherwise, just return the settings
- return settings == target ? this : settings;
- }
-
- /**
- * Returns the content type this handler represents.
- * Note that this handles the case of aliasing.
- *
- * Public for testing purposes only.
- */
- public ContentType getTarget() {
- ContentType target = (ContentType) targetRef.get();
- ContentTypeCatalog catalog = ContentTypeManager.getInstance().getCatalog();
- if (target == null || catalog.getGeneration() != generation) {
- target = catalog.getContentType(id);
- targetRef = new SoftReference(target);
- generation = catalog.getGeneration();
- }
- return target == null ? null : target.getAliasTarget(true);
- }
-
- public int hashCode() {
- return id.hashCode();
- }
-
- public boolean isAssociatedWith(String fileName) {
- final IContentType target = getTarget();
- return (target != null) ? target.isAssociatedWith(fileName) : false;
- }
-
- public boolean isAssociatedWith(String fileName, IScopeContext context) {
- final IContentType target = getTarget();
- return (target != null) ? target.isAssociatedWith(fileName, context) : false;
- }
-
- public boolean isKindOf(IContentType another) {
- if (another instanceof ContentTypeHandler)
- another = ((ContentTypeHandler) another).getTarget();
- final IContentType target = getTarget();
- return (target != null) ? target.isKindOf(another) : false;
- }
-
- public void removeFileSpec(String fileSpec, int type) throws CoreException {
- final IContentType target = getTarget();
- if (target != null)
- target.removeFileSpec(fileSpec, type);
- }
-
- public void setDefaultCharset(String userCharset) throws CoreException {
- final IContentType target = getTarget();
- if (target != null)
- target.setDefaultCharset(userCharset);
- }
-
- public String toString() {
- return id;
- }
-
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeManager.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeManager.java
deleted file mode 100644
index 82a7fbf..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeManager.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.io.InputStream;
-import java.io.Reader;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.content.*;
-import org.eclipse.core.runtime.preferences.*;
-
-public class ContentTypeManager extends ContentTypeMatcher implements IContentTypeManager, IRegistryChangeListener {
- private static ContentTypeManager instance;
-
- public static final int BLOCK_SIZE = 0x400;
- public static final String CONTENT_TYPE_PREF_NODE = IContentConstants.RUNTIME_NAME + IPath.SEPARATOR + "content-types"; //$NON-NLS-1$
- private static final String OPTION_DEBUG_CONTENT_TYPES = "org.eclipse.core.contenttype/debug"; //$NON-NLS-1$;
- static final boolean DEBUGGING = Activator.getDefault().getBooleanDebugOption(OPTION_DEBUG_CONTENT_TYPES, false);
- private ContentTypeCatalog catalog;
- private int catalogGeneration;
-
- /**
- * List of registered listeners (element type:
- * <code>IContentTypeChangeListener</code>).
- * These listeners are to be informed when
- * something in a content type changes.
- */
- protected ListenerList contentTypeListeners = new ListenerList();
-
- /**
- * Creates and initializes the platform's content type manager. A reference to the
- * content type manager can later be obtained by calling <code>getInstance()</code>.
- */
- // TODO we can remove this sometime, it is no longer needed
- public static void startup() {
- getInstance();
- }
-
- public static void addRegistryChangeListener(IExtensionRegistry registry) {
- if (registry == null)
- return;
- registry.addRegistryChangeListener(getInstance(), IContentConstants.RUNTIME_NAME);
- registry.addRegistryChangeListener(getInstance(), IContentConstants.CONTENT_NAME);
- }
-
- /**
- * Shuts down the platform's content type manager. After this call returns,
- * the content type manager will be closed for business.
- */
- public static void shutdown() {
- // there really is nothing left to do except null the instance.
- instance = null;
- }
-
- public static void removeRegistryChangeListener(IExtensionRegistry registry) {
- if (registry == null)
- return;
- getInstance().invalidate();
- registry.removeRegistryChangeListener(getInstance());
- }
-
- /**
- * Obtains this platform's content type manager.
- *
- * @return the content type manager
- */
- public static ContentTypeManager getInstance() {
- if (instance == null)
- instance = new ContentTypeManager();
- return instance;
- }
-
- /*
- * Returns the extension for a file name (omitting the leading '.').
- */
- static String getFileExtension(String fileName) {
- int dotPosition = fileName.lastIndexOf('.');
- return (dotPosition == -1 || dotPosition == fileName.length() - 1) ? "" : fileName.substring(dotPosition + 1); //$NON-NLS-1$
- }
-
- protected static ILazySource readBuffer(InputStream contents) {
- return new LazyInputStream(contents, BLOCK_SIZE);
- }
-
- protected static ILazySource readBuffer(Reader contents) {
- return new LazyReader(contents, BLOCK_SIZE);
- }
-
- public ContentTypeManager() {
- super(null, new InstanceScope());
- }
-
- protected ContentTypeBuilder createBuilder(ContentTypeCatalog newCatalog) {
- return new ContentTypeBuilder(newCatalog);
- }
-
- public IContentType[] getAllContentTypes() {
- ContentTypeCatalog currentCatalog = getCatalog();
- IContentType[] types = currentCatalog.getAllContentTypes();
- IContentType[] result = new IContentType[types.length];
- int generation = currentCatalog.getGeneration();
- for (int i = 0; i < result.length; i++)
- result[i] = new ContentTypeHandler((ContentType) types[i], generation);
- return result;
- }
-
- protected synchronized ContentTypeCatalog getCatalog() {
- if (catalog != null)
- // already has one
- return catalog;
- // create new catalog
- ContentTypeCatalog newCatalog = new ContentTypeCatalog(this, catalogGeneration++);
- // build catalog by parsing the extension registry
- ContentTypeBuilder builder = createBuilder(newCatalog);
- try {
- builder.buildCatalog();
- // only remember catalog if building it was successful
- catalog = newCatalog;
- } catch (InvalidRegistryObjectException e) {
- // the registry has stale objects... just don't remember the returned (incomplete) catalog
- }
- newCatalog.organize();
- return newCatalog;
- }
-
- public IContentType getContentType(String contentTypeIdentifier) {
- ContentTypeCatalog currentCatalog = getCatalog();
- ContentType type = currentCatalog.getContentType(contentTypeIdentifier);
- return type == null ? null : new ContentTypeHandler(type, currentCatalog.getGeneration());
- }
-
- public IContentTypeMatcher getMatcher(final ISelectionPolicy customPolicy, final IScopeContext context) {
- return new ContentTypeMatcher(customPolicy, context == null ? getContext() : context);
- }
-
- IEclipsePreferences getPreferences() {
- return getPreferences(getContext());
- }
-
- IEclipsePreferences getPreferences(IScopeContext context) {
- return context.getNode(CONTENT_TYPE_PREF_NODE);
- }
-
- public void registryChanged(IRegistryChangeEvent event) {
- // no changes related to the content type registry
- if (event.getExtensionDeltas(IContentConstants.RUNTIME_NAME, ContentTypeBuilder.PT_CONTENTTYPES).length == 0 &&
- event.getExtensionDeltas(IContentConstants.CONTENT_NAME, ContentTypeBuilder.PT_CONTENTTYPES).length == 0)
- return;
- invalidate();
- }
-
- /**
- * Causes a new catalog to be built afresh next time an API call is made.
- */
- synchronized void invalidate() {
- if (ContentTypeManager.DEBUGGING && catalog != null)
- ContentMessages.message("Registry discarded"); //$NON-NLS-1$
- catalog = null;
- }
-
- /* (non-Javadoc)
- * @see IContentTypeManager#addContentTypeChangeListener(IContentTypeChangeListener)
- */
- public void addContentTypeChangeListener(IContentTypeChangeListener listener) {
- contentTypeListeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see IContentTypeManager#removeContentTypeChangeListener(IContentTypeChangeListener)
- */
- public void removeContentTypeChangeListener(IContentTypeChangeListener listener) {
- contentTypeListeners.remove(listener);
- }
-
- public void fireContentTypeChangeEvent(ContentType type) {
- Object[] listeners = this.contentTypeListeners.getListeners();
- IContentType eventObject = new ContentTypeHandler(type, type.getCatalog().getGeneration());
- for (int i = 0; i < listeners.length; i++) {
- final ContentTypeChangeEvent event = new ContentTypeChangeEvent(eventObject);
- final IContentTypeChangeListener listener = (IContentTypeChangeListener) listeners[i];
- ISafeRunnable job = new ISafeRunnable() {
- public void handleException(Throwable exception) {
- // already logged in SafeRunner#run()
- }
-
- public void run() throws Exception {
- listener.contentTypeChanged(event);
- }
- };
- SafeRunner.run(job);
- }
- }
-
- public IContentDescription getSpecificDescription(BasicDescription description) {
- // this is the platform content type manager, no specificities
- return description;
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeMatcher.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeMatcher.java
deleted file mode 100644
index d4ad792..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeMatcher.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.io.*;
-import java.util.*;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.*;
-import org.eclipse.core.runtime.preferences.*;
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * @since 3.1
- */
-public class ContentTypeMatcher implements IContentTypeMatcher {
-
- private IScopeContext context;
- private IContentTypeManager.ISelectionPolicy policy;
-
- public ContentTypeMatcher(IContentTypeManager.ISelectionPolicy policy, IScopeContext context) {
- this.policy = policy;
- this.context = context;
- }
-
- /**
- * @see IContentTypeMatcher
- */
- public IContentType findContentTypeFor(InputStream contents, String fileName) throws IOException {
- ContentTypeCatalog currentCatalog = getCatalog();
- IContentType[] all = currentCatalog.findContentTypesFor(this, contents, fileName);
- return all.length > 0 ? new ContentTypeHandler((ContentType) all[0], currentCatalog.getGeneration()) : null;
- }
-
- /**
- * @see IContentTypeMatcher
- */
- public IContentType findContentTypeFor(String fileName) {
- // basic implementation just gets all content types
- ContentTypeCatalog currentCatalog = getCatalog();
- IContentType[] associated = currentCatalog.findContentTypesFor(this, fileName);
- return associated.length == 0 ? null : new ContentTypeHandler((ContentType) associated[0], currentCatalog.getGeneration());
- }
-
- /**
- * @see IContentTypeMatcher
- */
- public IContentType[] findContentTypesFor(InputStream contents, String fileName) throws IOException {
- ContentTypeCatalog currentCatalog = getCatalog();
- IContentType[] types = currentCatalog.findContentTypesFor(this, contents, fileName);
- IContentType[] result = new IContentType[types.length];
- int generation = currentCatalog.getGeneration();
- for (int i = 0; i < result.length; i++)
- result[i] = new ContentTypeHandler((ContentType) types[i], generation);
- return result;
- }
-
- /**
- * @see IContentTypeMatcher
- */
- public IContentType[] findContentTypesFor(String fileName) {
- ContentTypeCatalog currentCatalog = getCatalog();
- IContentType[] types = currentCatalog.findContentTypesFor(this, fileName);
- IContentType[] result = new IContentType[types.length];
- int generation = currentCatalog.getGeneration();
- for (int i = 0; i < result.length; i++)
- result[i] = new ContentTypeHandler((ContentType) types[i], generation);
- return result;
- }
-
- private ContentTypeCatalog getCatalog() {
- return ContentTypeManager.getInstance().getCatalog();
- }
-
- /**
- * @see IContentTypeMatcher
- */
- public IContentDescription getDescriptionFor(InputStream contents, String fileName, QualifiedName[] options) throws IOException {
- return getCatalog().getDescriptionFor(this, contents, fileName, options);
- }
-
- /**
- * @see IContentTypeMatcher
- */
- public IContentDescription getDescriptionFor(Reader contents, String fileName, QualifiedName[] options) throws IOException {
- return getCatalog().getDescriptionFor(this, contents, fileName, options);
- }
-
- public IScopeContext getContext() {
- return context;
- }
-
- public IContentTypeManager.ISelectionPolicy getPolicy() {
- return policy;
- }
-
- /**
- * Enumerates all content types whose settings satisfy the given file spec type mask.
- */
- public Collection getDirectlyAssociated(final ContentTypeCatalog catalog, final String fileSpec, final int typeMask) {
- //TODO: make sure we include built-in associations as well
- final IEclipsePreferences root = context.getNode(ContentTypeManager.CONTENT_TYPE_PREF_NODE);
- final Set result = new HashSet(3);
- try {
- root.accept(new IPreferenceNodeVisitor() {
- public boolean visit(IEclipsePreferences node) {
- if (node == root)
- return true;
- String[] fileSpecs = ContentTypeSettings.getFileSpecs(node, typeMask);
- for (int i = 0; i < fileSpecs.length; i++)
- if (fileSpecs[i].equalsIgnoreCase(fileSpec)) {
- ContentType associated = catalog.getContentType(node.name());
- if (associated != null)
- result.add(associated);
- break;
- }
- return false;
- }
-
- });
- } catch (BackingStoreException bse) {
- ContentType.log(ContentMessages.content_errorLoadingSettings, bse);
- }
- return result == null ? Collections.EMPTY_SET : result;
- }
-
- public IContentDescription getSpecificDescription(BasicDescription description) {
- if (description == null || ContentTypeManager.getInstance().getContext().equals(getContext()))
- // no need for specific content descriptions
- return description;
- // default description
- if (description instanceof DefaultDescription)
- // return an context specific description instead
- return new DefaultDescription(new ContentTypeSettings((ContentType) description.getContentTypeInfo(), context));
- // non-default description
- // replace info object with context specific settings
- ((ContentDescription) description).setContentTypeInfo(new ContentTypeSettings((ContentType) description.getContentTypeInfo(), context));
- return description;
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeSettings.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeSettings.java
deleted file mode 100644
index dca05a9..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeSettings.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.util.List;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.IContentTypeSettings;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-public class ContentTypeSettings implements IContentTypeSettings, IContentTypeInfo {
-
- private ContentType contentType;
- private IScopeContext context;
-
- static void addFileSpec(IScopeContext context, String contentTypeId, String fileSpec, int type) throws CoreException {
- Preferences contentTypeNode = ContentTypeManager.getInstance().getPreferences(context).node(contentTypeId);
- String key = ContentType.getPreferenceKey(type);
- List existingValues = Util.parseItemsIntoList(contentTypeNode.get(key, null));
- for (int i = 0; i < existingValues.size(); i++)
- if (((String) existingValues.get(i)).equalsIgnoreCase(fileSpec))
- // don't do anything if already exists
- return;
- existingValues.add(fileSpec);
- // set new preference value
- String newValue = Util.toListString(existingValues.toArray());
- ContentType.setPreference(contentTypeNode, key, newValue);
- try {
- contentTypeNode.flush();
- } catch (BackingStoreException bse) {
- String message = NLS.bind(ContentMessages.content_errorSavingSettings, contentTypeId);
- IStatus status = new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, bse);
- throw new CoreException(status);
- }
- }
-
- static String[] getFileSpecs(IScopeContext context, String contentTypeId, int type) {
- Preferences contentTypeNode = ContentTypeManager.getInstance().getPreferences(context).node(contentTypeId);
- return getFileSpecs(contentTypeNode, type);
- }
-
- static String[] getFileSpecs(Preferences contentTypeNode, int type) {
- String key = ContentType.getPreferenceKey(type);
- String existing = contentTypeNode.get(key, null);
- return Util.parseItems(existing);
- }
-
- public static String internalGetDefaultProperty(ContentType current, final Preferences contentTypePrefs, final QualifiedName key) throws BackingStoreException {
- String id = current.getId();
- if (contentTypePrefs.nodeExists(id)) {
- Preferences contentTypeNode = contentTypePrefs.node(id);
- String propertyValue = contentTypeNode.get(key.getLocalName(), null);
- if (propertyValue != null)
- return propertyValue;
- }
- // try built-in settings
- String propertyValue = current.basicGetDefaultProperty(key);
- if (propertyValue != null)
- return propertyValue;
- // try ancestor
- ContentType baseType = (ContentType) current.getBaseType();
- return baseType == null ? null : internalGetDefaultProperty(baseType, contentTypePrefs, key);
- }
-
- static void removeFileSpec(IScopeContext context, String contentTypeId, String fileSpec, int type) throws CoreException {
- Preferences contentTypeNode = ContentTypeManager.getInstance().getPreferences(context).node(contentTypeId);
- String key = ContentType.getPreferenceKey(type);
- String existing = contentTypeNode.get(key, null);
- if (existing == null)
- // content type has no settings - nothing to do
- return;
- List existingValues = Util.parseItemsIntoList(contentTypeNode.get(key, null));
- int index = -1;
- int existingCount = existingValues.size();
- for (int i = 0; index == -1 && i < existingCount; i++)
- if (((String) existingValues.get(i)).equalsIgnoreCase(fileSpec))
- index = i;
- if (index == -1)
- // did not find the file spec to be removed - nothing to do
- return;
- existingValues.remove(index);
- // set new preference value
- String newValue = Util.toListString(existingValues.toArray());
- ContentType.setPreference(contentTypeNode, key, newValue);
- try {
- contentTypeNode.flush();
- } catch (BackingStoreException bse) {
- String message = NLS.bind(ContentMessages.content_errorSavingSettings, contentTypeId);
- IStatus status = new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, bse);
- throw new CoreException(status);
- }
- }
-
- public ContentTypeSettings(ContentType contentType, IScopeContext context) {
- this.context = context;
- this.contentType = contentType;
- }
-
- /*
- * @see IContentTypeSettings
- */
- public void addFileSpec(String fileSpec, int type) throws CoreException {
- addFileSpec(context, contentType.getId(), fileSpec, type);
- }
-
- public ContentType getContentType() {
- return contentType;
- }
-
- public String getDefaultCharset() {
- return getDefaultProperty(IContentDescription.CHARSET);
- }
-
- public String getDefaultProperty(final QualifiedName key) {
- final Preferences contentTypePrefs = ContentTypeManager.getInstance().getPreferences(context);
- try {
- String propertyValue = internalGetDefaultProperty(contentType, contentTypePrefs, key);
- return "".equals(propertyValue) ? null : propertyValue; //$NON-NLS-1$
- } catch (BackingStoreException e) {
- return null;
- }
- }
-
- public String[] getFileSpecs(int type) {
- return getFileSpecs(context, contentType.getId(), type);
- }
-
- public String getId() {
- return contentType.getId();
- }
-
- public void removeFileSpec(String fileSpec, int type) throws CoreException {
- removeFileSpec(context, contentType.getId(), fileSpec, type);
- }
-
- public void setDefaultCharset(String userCharset) throws CoreException {
- Preferences contentTypeNode = ContentTypeManager.getInstance().getPreferences(context).node(contentType.getId());
- ContentType.setPreference(contentTypeNode, ContentType.PREF_DEFAULT_CHARSET, userCharset);
- try {
- contentTypeNode.flush();
- } catch (BackingStoreException bse) {
- String message = NLS.bind(ContentMessages.content_errorSavingSettings, contentType.getId());
- IStatus status = new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, bse);
- throw new CoreException(status);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeVisitor.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeVisitor.java
deleted file mode 100644
index 5b1ff55..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeVisitor.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-public interface ContentTypeVisitor {
- int CONTINUE = 0;
- int RETURN = 1;
- int STOP = 2;
-
- /**
- * @return CONTINUE, RETURN or STOP
- */
- public int visit(ContentType contentType);
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/DefaultDescription.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/DefaultDescription.java
deleted file mode 100644
index 6112008..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/DefaultDescription.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.IContentDescription;
-
-/**
- * A content description for which all properties have default values.
- */
-public final class DefaultDescription extends BasicDescription {
-
- public DefaultDescription(IContentTypeInfo contentTypeInfo) {
- super(contentTypeInfo);
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof DefaultDescription))
- return false;
- // see ContentType.equals()
- return contentTypeInfo.equals(((DefaultDescription) obj).contentTypeInfo);
- }
-
- /**
- * @see IContentDescription
- */
- public String getCharset() {
- return (String) getProperty(CHARSET);
- }
-
- /**
- * @see IContentDescription
- */
- public Object getProperty(QualifiedName key) {
- return contentTypeInfo.getDefaultProperty(key);
- }
-
- public int hashCode() {
- return contentTypeInfo.getContentType().hashCode();
- }
-
- /**
- * @see IContentDescription
- */
- public boolean isRequested(QualifiedName key) {
- return false;
- }
-
- /**
- * @see IContentDescription
- */
- public void setProperty(QualifiedName key, Object value) {
- throw new IllegalStateException();
- }
-
- public String toString() {
- return "{default} : " + contentTypeInfo.getContentType(); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/FileSpec.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/FileSpec.java
deleted file mode 100644
index 715f56b..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/FileSpec.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import org.eclipse.core.runtime.content.IContentType;
-
-/**
- * Provides a uniform representation for file specifications, such
- * as file names, file extensions and regular expressions.
- */
-class FileSpec {
- final static int BASIC_TYPE = IContentType.FILE_EXTENSION_SPEC | IContentType.FILE_NAME_SPEC;
- private String text;
- private int type;
-
- public FileSpec(String text, int type) {
- this.text = text;
- this.type = type;
- }
-
- public String getText() {
- return text;
- }
-
- public int getType() {
- return type;
- }
-
- public static int getBasicType(int type) {
- return BASIC_TYPE & type;
- }
-
- public boolean equals(Object other) {
- if (!(other instanceof FileSpec))
- return false;
- FileSpec otherFileSpec = (FileSpec) other;
- return equals(text, otherFileSpec.getType(), false);
- }
-
- public boolean equals(final String text, final int otherType, final boolean strict) {
- return ((!strict && getBasicType(type) == getBasicType(otherType)) || type == otherType) && this.text.equalsIgnoreCase(text);
- }
-
- public int hashCode() {
- return text.hashCode();
- }
-
- public static String getMappingKeyFor(String fileSpecText) {
- return fileSpecText.toLowerCase();
- }
-
- public String toString() {
- return getText();
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/IContentConstants.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/IContentConstants.java
deleted file mode 100644
index 298b149..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/IContentConstants.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-/**
- * Container for the constants used by this plugin.
- *
- * @since org.eclipse.core.contenttype 3.2
- */
-public interface IContentConstants {
- /**
- * Backward compatibility: name of the original runtime plugin
- */
- public static final String RUNTIME_NAME = "org.eclipse.core.runtime"; //$NON-NLS-1$
-
- /**
- * Name of this plugin
- */
- public static final String CONTENT_NAME = "org.eclipse.core.contenttype"; //$NON-NLS-1$
-
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/IContentTypeInfo.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/IContentTypeInfo.java
deleted file mode 100644
index 9d6c7e3..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/IContentTypeInfo.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import org.eclipse.core.runtime.QualifiedName;
-
-/**
- * @since 3.1
- */
-public abstract interface IContentTypeInfo {
- /**
- * Returns a reference to the corresponding content type.
- */
- public abstract ContentType getContentType();
-
- /**
- * Returns the default value for the given property, delegating to the
- * ancestor type if necessary.
- */
- public abstract String getDefaultProperty(QualifiedName key);
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ILazySource.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ILazySource.java
deleted file mode 100644
index e25c0aa..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ILazySource.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-/**
- * A common abstract view for lazy character/binary input streams.
- *
- * @since 3.1
- */
-public interface ILazySource {
- /**
- * @return a boolean indicating whether this stream is character or byte-based
- */
- public boolean isText();
-
- /**
- * Rewinds the stream.
- */
- public void rewind();
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/LazyInputStream.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/LazyInputStream.java
deleted file mode 100644
index 8d883f9..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/LazyInputStream.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-public class LazyInputStream extends InputStream implements ILazySource {
- private int blockCapacity;
- byte[][] blocks = {};
- private int bufferSize;
- private InputStream in;
- private int mark;
- private int offset;
-
- public LazyInputStream(InputStream in, int blockCapacity) {
- this.in = in;
- this.blockCapacity = blockCapacity;
- }
-
- public int available() throws IOException {
- try {
- return bufferSize - offset + in.available();
- } catch (IOException ioe) {
- throw new LowLevelIOException(ioe);
- }
- }
-
- private int computeBlockSize(int blockIndex) {
- if (blockIndex < blocks.length - 1)
- return blockCapacity;
- int blockSize = bufferSize % blockCapacity;
- return blockSize == 0 ? blockCapacity : blockSize;
- }
-
- private int copyFromBuffer(byte[] userBuffer, int userOffset, int needed) {
- int copied = 0;
- int current = offset / blockCapacity;
- while ((needed - copied) > 0 && current < blocks.length) {
- int blockSize = computeBlockSize(current);
- int offsetInBlock = offset % blockCapacity;
- int availableInBlock = blockSize - offsetInBlock;
- int toCopy = Math.min(availableInBlock, needed - copied);
- System.arraycopy(blocks[current], offsetInBlock, userBuffer, userOffset + copied, toCopy);
- copied += toCopy;
- current++;
- offset += toCopy;
- }
- return copied;
- }
-
- private void ensureAvailable(long bytesToRead) throws IOException {
- int loadedBlockSize = blockCapacity;
- while (bufferSize < offset + bytesToRead && loadedBlockSize == blockCapacity) {
- try {
- loadedBlockSize = loadBlock();
- } catch (IOException e) {
- throw new LowLevelIOException(e);
- }
- bufferSize += loadedBlockSize;
- }
- }
-
- // for testing purposes
- protected int getBlockCount() {
- return blocks.length;
- }
-
- // for testing purposes
- protected int getBufferSize() {
- return bufferSize;
- }
-
- // for testing purposes
- protected int getMark() {
- return mark;
- }
-
- // for testing purposes
- protected int getOffset() {
- return offset;
- }
-
- public boolean isText() {
- return false;
- }
-
- private int loadBlock() throws IOException {
- // read a block from the underlying stream
- byte[] newBlock = new byte[blockCapacity];
- int readCount = in.read(newBlock);
- if (readCount == -1)
- return 0;
- // expand blocks array
- byte[][] tmpBlocks = new byte[blocks.length + 1][];
- System.arraycopy(blocks, 0, tmpBlocks, 0, blocks.length);
- blocks = tmpBlocks;
- blocks[blocks.length - 1] = newBlock;
- return readCount;
- }
-
- public void mark(int readlimit) {
- mark = offset;
- }
-
- public boolean markSupported() {
- return true;
- }
-
- public int read() throws IOException {
- ensureAvailable(1);
- if (bufferSize <= offset)
- return -1;
- int nextByte = 0xFF & blocks[offset / blockCapacity][offset % blockCapacity];
- offset++;
- return nextByte;
- }
-
- public int read(byte[] b) throws IOException {
- return read(b, 0, b.length);
- }
-
- public int read(byte[] b, int off, int len) throws IOException {
- ensureAvailable(len);
- int copied = copyFromBuffer(b, off, len);
- return copied == 0 ? -1 : copied;
- }
-
- public void reset() {
- offset = mark;
- }
-
- public void rewind() {
- mark = 0;
- offset = 0;
- }
-
- public long skip(long toSkip) throws IOException {
- if (toSkip <= 0)
- return 0;
- ensureAvailable(toSkip);
- long skipped = Math.min(toSkip, bufferSize - offset);
- offset += skipped;
- return skipped;
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/LazyReader.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/LazyReader.java
deleted file mode 100644
index 43965cd..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/LazyReader.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.io.IOException;
-import java.io.Reader;
-
-public class LazyReader extends Reader implements ILazySource {
- private int blockCapacity;
- char[][] blocks = {};
- private int bufferSize;
- private Reader in;
- private int mark;
- private int offset;
-
- public LazyReader(Reader in, int blockCapacity) {
- this.in = in;
- this.blockCapacity = blockCapacity;
- }
-
- public void close() {
- // we don't close the underlying stream
- }
-
- private int computeBlockSize(int blockIndex) {
- if (blockIndex < blocks.length - 1)
- return blockCapacity;
- int blockSize = bufferSize % blockCapacity;
- return blockSize == 0 ? blockCapacity : blockSize;
- }
-
- private int copyFromBuffer(char[] userBuffer, int userOffset, int needed) {
- int copied = 0;
- int current = offset / blockCapacity;
- while ((needed - copied) > 0 && current < blocks.length) {
- int blockSize = computeBlockSize(current);
- int offsetInBlock = offset % blockCapacity;
- int availableInBlock = blockSize - offsetInBlock;
- int toCopy = Math.min(availableInBlock, needed - copied);
- System.arraycopy(blocks[current], offsetInBlock, userBuffer, userOffset + copied, toCopy);
- copied += toCopy;
- current++;
- offset += toCopy;
- }
- return copied;
- }
-
- private void ensureAvailable(long charsToRead) throws IOException {
- int loadedBlockSize = blockCapacity;
- while (bufferSize < offset + charsToRead && loadedBlockSize == blockCapacity) {
- try {
- loadedBlockSize = loadBlock();
- } catch (IOException ioe) {
- throw new LowLevelIOException(ioe);
- }
- bufferSize += loadedBlockSize;
- }
- }
-
- // for testing purposes
- protected int getBlockCount() {
- return blocks.length;
- }
-
- // for testing purposes
- protected int getBufferSize() {
- return bufferSize;
- }
-
- // for testing purposes
- protected int getMark() {
- return mark;
- }
-
- // for testing purposes
- protected int getOffset() {
- return offset;
- }
-
- public boolean isText() {
- return true;
- }
-
- private int loadBlock() throws IOException {
- // read a block from the underlying stream
- char[] newBlock = new char[blockCapacity];
- int readCount = in.read(newBlock);
- if (readCount == -1)
- return 0;
- // expand blocks array
- char[][] tmpBlocks = new char[blocks.length + 1][];
- System.arraycopy(blocks, 0, tmpBlocks, 0, blocks.length);
- blocks = tmpBlocks;
- blocks[blocks.length - 1] = newBlock;
- return readCount;
- }
-
- public void mark(int readlimit) {
- mark = offset;
- }
-
- public boolean markSupported() {
- return true;
- }
-
- public int read() throws IOException {
- ensureAvailable(1);
- if (bufferSize <= offset)
- return -1;
- char nextChar = blocks[offset / blockCapacity][offset % blockCapacity];
- offset++;
- return nextChar;
- }
-
- public int read(char[] c) throws IOException {
- return read(c, 0, c.length);
- }
-
- public int read(char[] c, int off, int len) throws IOException {
- ensureAvailable(len);
- int copied = copyFromBuffer(c, off, len);
- return copied == 0 ? -1 : copied;
- }
-
- public boolean ready() throws IOException {
- try {
- return (bufferSize - offset) > 0 || in.ready();
- } catch (IOException ioe) {
- throw new LowLevelIOException(ioe);
- }
- }
-
- public void reset() {
- offset = mark;
- }
-
- public void rewind() {
- mark = 0;
- offset = 0;
- }
-
- public long skip(long toSkip) throws IOException {
- if (toSkip <= 0)
- return 0;
- ensureAvailable(toSkip);
- long skipped = Math.min(toSkip, bufferSize - offset);
- offset += skipped;
- return skipped;
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/LowLevelIOException.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/LowLevelIOException.java
deleted file mode 100644
index e2b3ba5..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/LowLevelIOException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.io.IOException;
-import org.eclipse.core.runtime.Assert;
-
-/**
- * A wrapper for IOExceptions, throw by LazyInputStream/Reader.
- * Its purpose is to allow one to differentiate
- * between IOExceptions thrown by the base stream/reader from those
- * thrown by streams/readers built on top of LazyInputStream/Reader.
- *
- * @see LazyInputStream
- * @see LazyReader
- */
-/* package */class LowLevelIOException extends IOException {
-
- /**
- * All serializable objects should have a stable serialVersionUID
- */
- private static final long serialVersionUID = 1L;
-
- private IOException actual;
-
- public LowLevelIOException(IOException actual) {
- // ensure we don't wrap more than once
- Assert.isLegal(!(actual instanceof LowLevelIOException));
- this.actual = actual;
- }
-
- public IOException getActualException() {
- return actual;
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/TextContentDescriber.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/TextContentDescriber.java
deleted file mode 100644
index be4444a..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/TextContentDescriber.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.io.*;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.ITextContentDescriber;
-
-/**
- * This class provides internal basis for text-based content describers.
- *
- * <p>
- * Note: do not add protected/public members to this class if you don't intend to
- * make them public API.
- * </p>
- *
- * @see org.eclipse.core.runtime.content.XMLRootElementContentDescriber2
- * @since 3.0
- */
-public class TextContentDescriber implements ITextContentDescriber {
-
- private final static QualifiedName[] SUPPORTED_OPTIONS = {IContentDescription.BYTE_ORDER_MARK};
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.content.ITextContentDescriber#describe(java.io.Reader, org.eclipse.core.runtime.content.IContentDescription)
- */
- public int describe(Reader contents, IContentDescription description) throws IOException {
- // we want to be pretty loose on detecting the text content type
- return INDETERMINATE;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.content.IContentDescriber#describe(java.io.InputStream, org.eclipse.core.runtime.content.IContentDescription)
- */
- public int describe(InputStream contents, IContentDescription description) throws IOException {
- if (description == null || !description.isRequested(IContentDescription.BYTE_ORDER_MARK))
- return INDETERMINATE;
- byte[] bom = getByteOrderMark(contents);
- if (bom != null)
- description.setProperty(IContentDescription.BYTE_ORDER_MARK, bom);
- // we want to be pretty loose on detecting the text content type
- return INDETERMINATE;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.content.IContentDescriber#getSupportedOptions()
- */
- public QualifiedName[] getSupportedOptions() {
- return SUPPORTED_OPTIONS;
- }
-
- byte[] getByteOrderMark(InputStream input) throws IOException {
- int first = input.read();
- if (first == 0xEF) {
- //look for the UTF-8 Byte Order Mark (BOM)
- int second = input.read();
- int third = input.read();
- if (second == 0xBB && third == 0xBF)
- return IContentDescription.BOM_UTF_8;
- } else if (first == 0xFE) {
- //look for the UTF-16 BOM
- if (input.read() == 0xFF)
- return IContentDescription.BOM_UTF_16BE;
- } else if (first == 0xFF) {
- if (input.read() == 0xFE)
- return IContentDescription.BOM_UTF_16LE;
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/Util.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/Util.java
deleted file mode 100644
index 22a9268..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/Util.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.util.*;
-
-public class Util {
- public static String[] parseItems(String string) {
- return parseItems(string, ","); //$NON-NLS-1$
- }
-
- public static String[] parseItems(String string, String separator) {
- if (string == null)
- return new String[0];
- StringTokenizer tokenizer = new StringTokenizer(string, separator, true);
- if (!tokenizer.hasMoreTokens())
- return new String[] {string.trim()};
- String first = tokenizer.nextToken().trim();
- boolean wasSeparator = false;
- if (first.equals(separator)) {
- // leading separator
- first = ""; //$NON-NLS-1$
- wasSeparator = true;
- }
- // simple cases, do not create temporary list
- if (!tokenizer.hasMoreTokens())
- return wasSeparator ? /* two empty strings */new String[] {first, first} : /*single non-empty element */new String[] {first};
- ArrayList items = new ArrayList();
- items.add(first);
- String current;
- do {
- current = tokenizer.nextToken().trim();
- boolean isSeparator = current.equals(separator);
- if (isSeparator) {
- if (wasSeparator)
- items.add(""); //$NON-NLS-1$
- } else
- items.add(current);
- wasSeparator = isSeparator;
- } while (tokenizer.hasMoreTokens());
- if (wasSeparator)
- // trailing separator
- items.add(""); //$NON-NLS-1$
- return (String[]) items.toArray(new String[items.size()]);
- }
-
- public static List parseItemsIntoList(String string) {
- return parseItemsIntoList(string, ","); //$NON-NLS-1$
- }
-
- public static List parseItemsIntoList(String string, String separator) {
- List items = new ArrayList(5);
- if (string == null)
- return items;
- StringTokenizer tokenizer = new StringTokenizer(string, separator, true);
- if (!tokenizer.hasMoreTokens()) {
- items.add(string.trim());
- return items;
- }
- String first = tokenizer.nextToken().trim();
- boolean wasSeparator = false;
- if (first.equals(separator)) {
- // leading separator
- first = ""; //$NON-NLS-1$
- wasSeparator = true;
- }
- items.add(first);
- if (!tokenizer.hasMoreTokens())
- return items;
- String current;
- do {
- current = tokenizer.nextToken().trim();
- boolean isSeparator = current.equals(separator);
- if (isSeparator) {
- if (wasSeparator)
- items.add(""); //$NON-NLS-1$
- } else
- items.add(current);
- wasSeparator = isSeparator;
- } while (tokenizer.hasMoreTokens());
- if (wasSeparator)
- // trailing separator
- items.add(""); //$NON-NLS-1$
- return items;
- }
-
- public static String toListString(Object[] list) {
- return toListString(list, ","); //$NON-NLS-1$
- }
-
- public static String toListString(Object[] list, String separator) {
- if (list == null || list.length == 0)
- return null;
- StringBuffer result = new StringBuffer();
- for (int i = 0; i < list.length; i++) {
- result.append(list[i]);
- result.append(separator);
- }
- // ignore last comma
- return result.substring(0, result.length() - 1);
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/XMLContentDescriber.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/XMLContentDescriber.java
deleted file mode 100644
index d15c326..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/XMLContentDescriber.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.io.*;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.ITextContentDescriber;
-
-/**
- * A content interpreter for XML files.
- * This class provides internal basis for XML-based content describers.
- * <p>
- * Note: do not add protected/public members to this class if you don't intend to
- * make them public API.
- * </p>
- *
- * @see org.eclipse.core.runtime.content.XMLRootElementContentDescriber2
- * @see "http://www.w3.org/TR/REC-xml *"
- */
-public class XMLContentDescriber extends TextContentDescriber implements ITextContentDescriber {
- private static final QualifiedName[] SUPPORTED_OPTIONS = new QualifiedName[] {IContentDescription.CHARSET, IContentDescription.BYTE_ORDER_MARK};
- private static final String ENCODING = "encoding="; //$NON-NLS-1$
- private static final String XML_PREFIX = "<?xml "; //$NON-NLS-1$
-
- public int describe(InputStream input, IContentDescription description) throws IOException {
- byte[] bom = getByteOrderMark(input);
- String xmlDeclEncoding = "UTF-8"; //$NON-NLS-1$
- input.reset();
- if (bom != null) {
- if (bom == IContentDescription.BOM_UTF_16BE)
- xmlDeclEncoding = "UTF-16BE"; //$NON-NLS-1$
- else if (bom == IContentDescription.BOM_UTF_16LE)
- xmlDeclEncoding = "UTF-16LE"; //$NON-NLS-1$
- // skip BOM to make comparison simpler
- input.skip(bom.length);
- // set the BOM in the description if requested
- if (description != null && description.isRequested(IContentDescription.BYTE_ORDER_MARK))
- description.setProperty(IContentDescription.BYTE_ORDER_MARK, bom);
- }
- byte[] xmlPrefixBytes = XML_PREFIX.getBytes(xmlDeclEncoding);
- byte[] prefix = new byte[xmlPrefixBytes.length];
- if (input.read(prefix) < prefix.length)
- // there is not enough info to say anything
- return INDETERMINATE;
- for (int i = 0; i < prefix.length; i++)
- if (prefix[i] != xmlPrefixBytes[i])
- // we don't have a XMLDecl... there is not enough info to say anything
- return INDETERMINATE;
- if (description == null)
- return VALID;
- // describe charset if requested
- if (description.isRequested(IContentDescription.CHARSET)) {
- String fullXMLDecl = readFullXMLDecl(input, xmlDeclEncoding);
- if (fullXMLDecl != null) {
- String charset = getCharset(fullXMLDecl);
- if (charset != null && !"UTF-8".equalsIgnoreCase(charset)) //$NON-NLS-1$
- // only set property if value is not default (avoid using a non-default content description)
- description.setProperty(IContentDescription.CHARSET, getCharset(fullXMLDecl));
- }
- }
- return VALID;
- }
-
- private String readFullXMLDecl(InputStream input, String unicodeEncoding) throws IOException {
- byte[] xmlDecl = new byte[100];
- int c = 0;
- // looks for XMLDecl ending char (?)
- int read = 0;
- while (read < xmlDecl.length && (c = input.read()) != -1 && c != '?')
- xmlDecl[read++] = (byte) c;
- return c == '?' ? new String(xmlDecl, 0, read, unicodeEncoding) : null;
- }
-
- public int describe(Reader input, IContentDescription description) throws IOException {
- BufferedReader reader = new BufferedReader(input);
- String line = reader.readLine();
- // end of stream
- if (line == null)
- return INDETERMINATE;
- // XMLDecl should be the first string (no blanks allowed)
- if (!line.startsWith(XML_PREFIX))
- return INDETERMINATE;
- if (description == null)
- return VALID;
- // describe charset if requested
- if ((description.isRequested(IContentDescription.CHARSET)))
- description.setProperty(IContentDescription.CHARSET, getCharset(line));
- return VALID;
- }
-
- private String getCharset(String firstLine) {
- int encodingPos = firstLine.indexOf(ENCODING);
- if (encodingPos == -1)
- return null;
- char quoteChar = '"';
- int firstQuote = firstLine.indexOf(quoteChar, encodingPos);
- if (firstQuote == -1) {
- quoteChar = '\'';
- firstQuote = firstLine.indexOf(quoteChar, encodingPos);
- }
- if (firstQuote == -1 || firstLine.length() == firstQuote - 1)
- return null;
- int secondQuote = firstLine.indexOf(quoteChar, firstQuote + 1);
- if (secondQuote == -1)
- return null;
- return firstLine.substring(firstQuote + 1, secondQuote);
- }
-
- public QualifiedName[] getSupportedOptions() {
- return SUPPORTED_OPTIONS;
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/XMLRootHandler.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/XMLRootHandler.java
deleted file mode 100644
index 9871f37..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/XMLRootHandler.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.io.IOException;
-import java.io.StringReader;
-import javax.xml.parsers.*;
-import org.xml.sax.*;
-import org.xml.sax.ext.LexicalHandler;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * A content describer for detecting the name of the top-level element of the
- * DTD system identifier in an XML file. This supports two parameters:
- * <code>DTD_TO_FIND</code> and <code>ELEMENT_TO_FIND</code>. This is done
- * using the <code>IExecutableExtension</code> mechanism. If the
- * <code>":-"</code> method is used, then the value is treated as the
- * <code>ELEMENT_TO_FIND</code>.
- *
- * @since 3.0
- */
-public final class XMLRootHandler extends DefaultHandler implements LexicalHandler {
- /**
- * An exception indicating that the parsing should stop. This is usually
- * triggered when the top-level element has been found.
- *
- * @since 3.0
- */
- private class StopParsingException extends SAXException {
- /**
- * All serializable objects should have a stable serialVersionUID
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructs an instance of <code>StopParsingException</code> with a
- * <code>null</code> detail message.
- */
- public StopParsingException() {
- super((String) null);
- }
- }
-
- /**
- * Should we check the root element?
- */
- private boolean checkRoot;
- /**
- * The system identifier for the DTD that was found while parsing the XML.
- * This member variable is <code>null</code> unless the file has been
- * parsed successful to the point of finding the DTD's system identifier.
- */
- private String dtdFound = null;
- /**
- * This is the name of the top-level element found in the XML file. This
- * member variable is <code>null</code> unless the file has been parsed
- * successful to the point of finding the top-level element.
- */
- private String elementFound = null;
-
- /**
- * This is the namespace of the top-level element found in the XML file. This
- * member variable is <code>null</code> unless the file has been parsed
- * successful to the point of finding the top-level element.
- */
- private String namespaceFound = null;
-
- public XMLRootHandler(boolean checkRoot) {
- this.checkRoot = checkRoot;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.xml.sax.ext.LexicalHandler#comment(char[], int, int)
- */
- public final void comment(final char[] ch, final int start, final int length) {
- // Not interested.
- }
-
- /**
- * Creates a new SAX parser for use within this instance.
- *
- * @return The newly created parser.
- *
- * @throws ParserConfigurationException
- * If a parser of the given configuration cannot be created.
- * @throws SAXException
- * If something in general goes wrong when creating the parser.
- * @throws SAXNotRecognizedException
- * If the <code>XMLReader</code> does not recognize the
- * lexical handler configuration option.
- * @throws SAXNotSupportedException
- * If the <code>XMLReader</code> does not support the lexical
- * handler configuration option.
- */
- private final SAXParser createParser(SAXParserFactory parserFactory) throws ParserConfigurationException, SAXException, SAXNotRecognizedException, SAXNotSupportedException {
- // Initialize the parser.
- final SAXParser parser = parserFactory.newSAXParser();
- final XMLReader reader = parser.getXMLReader();
- reader.setProperty("http://xml.org/sax/properties/lexical-handler", this); //$NON-NLS-1$
- // disable DTD validation (bug 63625)
- try {
- // be sure validation is "off" or the feature to ignore DTD's will not apply
- reader.setFeature("http://xml.org/sax/features/validation", false); //$NON-NLS-1$
- reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); //$NON-NLS-1$
- } catch (SAXNotRecognizedException e) {
- // not a big deal if the parser does not recognize the features
- } catch (SAXNotSupportedException e) {
- // not a big deal if the parser does not support the features
- }
- return parser;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.xml.sax.ext.LexicalHandler#endCDATA()
- */
- public final void endCDATA() {
- // Not interested.
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.xml.sax.ext.LexicalHandler#endDTD()
- */
- public final void endDTD() {
- // Not interested.
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.xml.sax.ext.LexicalHandler#endEntity(java.lang.String)
- */
- public final void endEntity(final String name) {
- // Not interested.
- }
-
- public String getDTD() {
- return dtdFound;
- }
-
- public String getRootName() {
- return elementFound;
- }
-
- /**
- * @since org.eclipse.core.contenttype 3.3
- */
- public String getRootNamespace() {
- return namespaceFound;
- }
-
- public boolean parseContents(InputSource contents) throws IOException, ParserConfigurationException, SAXException {
- // Parse the file into we have what we need (or an error occurs).
- try {
- SAXParserFactory factory = Activator.getDefault().getFactory();
- if (factory == null)
- return false;
- final SAXParser parser = createParser(factory);
- // to support external entities specified as relative URIs (see bug 63298)
- contents.setSystemId("/"); //$NON-NLS-1$
- parser.parse(contents, this);
- } catch (StopParsingException e) {
- // Abort the parsing normally. Fall through...
- }
- return true;
- }
-
- /*
- * Resolve external entity definitions to an empty string. This is to speed
- * up processing of files with external DTDs. Not resolving the contents
- * of the DTD is ok, as only the System ID of the DTD declaration is used.
- * @see org.xml.sax.helpers.DefaultHandler#resolveEntity(java.lang.String, java.lang.String)
- */
- public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
- return new InputSource(new StringReader("")); //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.xml.sax.ext.LexicalHandler#startCDATA()
- */
- public final void startCDATA() {
- // Not interested.
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.xml.sax.ext.LexicalHandler#startDTD(java.lang.String,
- * java.lang.String, java.lang.String)
- */
- public final void startDTD(final String name, final String publicId, final String systemId) throws SAXException {
- dtdFound = systemId;
- // If we don't care about the top-level element, we can stop here.
- if (!checkRoot)
- throw new StopParsingException();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.xml.sax.ContentHandler#startElement(java.lang.String,
- * java.lang.String, java.lang.String, org.xml.sax.Attributes)
- */
- public final void startElement(final String uri, final String elementName, final String qualifiedName, final Attributes attributes) throws SAXException {
- elementFound = elementName;
- namespaceFound = uri;
- throw new StopParsingException();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.xml.sax.ext.LexicalHandler#startEntity(java.lang.String)
- */
- public final void startEntity(final String name) {
- // Not interested.
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/messages.properties b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/messages.properties
deleted file mode 100644
index 6e3bba2..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/messages.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-### Content type manager
-content_badInitializationData = Invalid initialization data for \"{0}\".
-content_errorReadingContents = Error reading contents using content type: {0}.
-content_errorSavingSettings = Failed saving settings for content type {0}.
-content_errorLoadingSettings = Failed loading content type settings.
-content_invalidContentDescriber = Could not create content describer for {0}. Content type has been disabled.
-content_invalidProperty = Ignored invalid property \"{0}\" for content type {1}.
-content_missingIdentifier = Content type {0} has no identifier. Content type has been disabled.
-content_missingName = Content type {0} has no name. Content type has been disabled.
-content_parserConfiguration = XML parser configuration error during content description.
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/BinarySignatureDescriber.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/BinarySignatureDescriber.java
deleted file mode 100644
index 3b7da5f..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/BinarySignatureDescriber.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.content;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.*;
-import org.eclipse.core.internal.content.ContentMessages;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * A content describer for binary formats that present some
- * simple signature at a known, fixed offset.
- * <p>
- * This executable extension supports three parameters:
- * "signature", "offset" and "required", the first one being mandatory.
- * If the
- * <code>":-"</code> method is used, then the value is treated as the
- * "signature".
- * </p>
- * <p>
- * The "signature" parameter is a sequence of hex codes, one for each byte in
- * the signature. For example, "CA FE BA BE" would be a signature for Java
- * class files.
- * </p>
- * <p>
- * The "offset" parameter is an integer indicating the offset where the
- * signature's first byte is found.
- * </p>
- * <p>
- * The "required" parameter is a boolean (default is " true") indicating whether
- * the absence of a signature should deem the contents validity status as
- * IContentDescriber.INVALID or IContentDescriber.INDETERMINATE.
- * </p>
- * <p>
- * This class is not intended to be subclassed or instantiated by clients,
- * only to be referenced by the "describer" configuration element in
- * extensions to the <code>org.eclipse.core.runtime.contentTypes</code>
- * extension point.
- * </p>
- *
- * @since 3.0
- */
-public final class BinarySignatureDescriber implements IContentDescriber, IExecutableExtension {
- private final static String SIGNATURE = "signature"; //$NON-NLS-1$
- private final static String OFFSET = "offset"; //$NON-NLS-1$
- private static final Object REQUIRED = "required"; //$NON-NLS-1$
- private byte[] signature;
- private int offset;
- private boolean required = true;
-
- /* (Intentionally not included in javadoc)
- * @see IContentDescriber#describe(InputStream, IContentDescription)
- */
- public int describe(InputStream contents, IContentDescription description) throws IOException {
- byte[] buffer = new byte[signature.length];
- int notValid = required ? INVALID : INDETERMINATE;
- if (contents.skip(offset) < offset)
- return notValid;
- if (contents.read(buffer) != buffer.length)
- return notValid;
- for (int i = 0; i < signature.length; i++)
- if (signature[i] != buffer[i])
- return notValid;
- return VALID;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IContentDescriber#getSupportedOptions
- */
- public QualifiedName[] getSupportedOptions() {
- return new QualifiedName[0];
- }
-
- /* (Intentionally not included in javadoc)
- * @see IExecutableExtension#setInitializationData
- */
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- try {
- if (data instanceof String)
- signature = parseSignature((String) data);
- else if (data instanceof Hashtable) {
- Hashtable parameters = (Hashtable) data;
- if (!parameters.containsKey(SIGNATURE)) {
- String message = NLS.bind(ContentMessages.content_badInitializationData, BinarySignatureDescriber.class.getName());
- throw new CoreException(new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, null));
- }
- signature = parseSignature((String) parameters.get(SIGNATURE));
- if (parameters.containsKey(OFFSET))
- offset = Integer.parseInt((String) parameters.get(OFFSET));
- if (parameters.containsKey(REQUIRED))
- required = Boolean.valueOf((String) parameters.get(REQUIRED)).booleanValue();
- }
- } catch (NumberFormatException nfe) {
- String message = NLS.bind(ContentMessages.content_badInitializationData, BinarySignatureDescriber.class.getName());
- throw new CoreException(new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, nfe));
- }
- }
-
- private static byte[] parseSignature(String data) {
- List bytes = new ArrayList();
- StringTokenizer tokenizer = new StringTokenizer(data, " \t\n\r\f,"); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens())
- bytes.add(new Byte((byte) Integer.parseInt(tokenizer.nextToken().trim(), 16)));
- byte[] signature = new byte[bytes.size()];
- for (int i = 0; i < signature.length; i++)
- signature[i] = ((Byte) bytes.get(i)).byteValue();
- return signature;
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentDescriber.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentDescriber.java
deleted file mode 100644
index 5820a16..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentDescriber.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.content;
-
-import java.io.IOException;
-import java.io.InputStream;
-import org.eclipse.core.runtime.QualifiedName;
-
-/**
- * Content describers know how to retrieve metadata from
- * contents.
- * <p>
- * Note: It is expected that content describer implementations be declared in a package
- * that is exempt from plug-in activation (using the Eclipse-AutoStart bundle
- * manifest header). Since all describers are instantiated when the content type
- * framework is initialized, failure in complying with this requirement causes
- * premature activation, which must be avoided. Future implementations of the
- * framework might refuse to instantiate describers if doing so would trigger
- * activation of the corresponding plug-in.
- * </p>
- * <p>
- * Describers for text-based content types should implement
- * <code>ITextContentDescriber</code> instead.
- * </p>
- * <p>
- * Clients may implement this interface.
- * </p>
-
- * @see IContentDescription
- * @since 3.0
- */
-public interface IContentDescriber {
- /**
- * Description result constant, indicating that it was not possible
- * to determine whether the contents were valid for
- * the intended content type.
- *
- * @see #describe
- */
- public final static int INDETERMINATE = 1;
- /**
- * Description result constant, indicating the contents are invalid for
- * the intended content type.
- *
- * @see #describe
- */
- public final static int INVALID = 0;
- /**
- * Description result constant, indicating the contents are valid for
- * the intended content type.
- *
- * @see #describe
- */
- public final static int VALID = 2;
-
- /**
- * Tries to fill a description for the given contents. Returns
- * an <code>int</code> indicating whether the given stream of
- * bytes represents a valid sample for its corresponding content type.
- * If no content description is provided, this method should perform
- * content type validation.
- * <p>
- * The input stream must be kept open, and any IOExceptions while
- * reading the stream should flow to the caller.
- * </p>
- *
- * @param contents the contents to be examined
- * @param description a description to be filled in, or <code>null</code> if
- * only content type validation is to be performed
- * @return one of the following:<ul>
- * <li><code>VALID</code></li>,
- * <li><code>INVALID</code></li>,
- * <li><code>INDETERMINATE</code></li>
- * </ul>
- * @throws IOException if an I/O error occurs
- * @see IContentDescription
- * @see #VALID
- * @see #INVALID
- * @see #INDETERMINATE
- */
- public int describe(InputStream contents, IContentDescription description) throws IOException;
-
- /**
- * Returns the properties supported by this describer.
- *
- * @return the supported properties
- * @see #describe
- */
- public QualifiedName[] getSupportedOptions();
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentDescription.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentDescription.java
deleted file mode 100644
index 84c9ea0..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentDescription.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.content;
-
-import org.eclipse.core.internal.content.IContentConstants;
-import org.eclipse.core.runtime.QualifiedName;
-
-/**
- * A content description object contains information about the nature of
- * arbitrary data.
- * <p>
- * A content description object will always include the content type for the
- * examined contents, and may also include information on:
- * <ol>
- * <li>charset;</li>
- * <li>byte order mark;</li>
- * <li>other custom properties provided by third-party plug-ins.</li>
- * </ol>
- * </p>
- * <p>
- * <cite>Content describers</cite> provided by plug-ins will fill in most of the
- * properties in a content description object, except for the content type,
- * what is done by the platform. After a content
- * description is filled in by a content interpreter, it is marked as immutable
- * by the platform, so calling any of the mutator methods defined in this
- * interface will cause an <code>IllegalStateException</code> to be thrown.
- * </p>
- * <p>
- * Default values for properties can be contributed by plug-ins as part of
- * the content type definition markup.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IContentDescriber
- * @since 3.0
- */
-public interface IContentDescription {
- /**
- * Key for the "charset" property.
- */
- public final static QualifiedName CHARSET = new QualifiedName(IContentConstants.RUNTIME_NAME, "charset"); //$NON-NLS-1$
- /**
- * Key for the "byte order mark" property. This property is only meaningful
- * when describing byte streams.
- */
- public final static QualifiedName BYTE_ORDER_MARK = new QualifiedName(IContentConstants.RUNTIME_NAME, "bom"); //$NON-NLS-1$
- /**
- * Options constant meaning that all properties should be described.
- */
- public final static QualifiedName[] ALL = null;
- /**
- * Constant that identifies the Byte-Order-Mark for contents encoded with
- * the UTF-8 character encoding scheme.
- */
- public final static byte[] BOM_UTF_8 = {(byte) 0xEF, (byte) 0xBB, (byte) 0xBF};
- /**
- * Constant that identifies the Byte-Order-Mark for contents encoded with
- * the UTF-16 Big Endian character encoding scheme.
- */
- public final static byte[] BOM_UTF_16BE = {(byte) 0xFE, (byte) 0xFF};
- /**
- * Constant that identifies the Byte-Order-Mark for contents encoded with
- * the UTF-16 Little Endian character encoding scheme.
- */
- public final static byte[] BOM_UTF_16LE = {(byte) 0xFF, (byte) 0xFE};
-
- /**
- * Returns whether the given property is requested to be described. This
- * method is intended to allow content describers to determine which
- * properties should be described.
- *
- * @param key a key for the property to be verified
- * @return <code>true</code> if the property is to be described,
- * <code>false</code> otherwise
- */
- public boolean isRequested(QualifiedName key);
-
- /**
- * Returns the charset name to be used when reading the contents
- * described by this object.
- * <p>
- * If a Unicode byte order mark has been found (the
- * <code>BYTE_ORDER_MARK</code> property has been set),
- * a corresponding charset name will be returned (e.g. "UTF-8",
- * "UTF-16"). Otherwise, the value of the <code>CHARSET</code>
- * property will be returned.
- * </p>
- * @return a charset name, or <code>null</code>
- */
- public String getCharset();
-
- /**
- * Returns the content type detected. Returns <code>null</code> if the
- * content type could not be determined.
- *
- * @return the corresponding content type, or <code>null</code>
- */
- public IContentType getContentType();
-
- /**
- * Returns the value of custom property set by the content describer,
- * or the default value for the property, if one has been defined.
- * <p>
- * The qualifier part of the property name must be the unique identifier
- * of the declaring plug-in (e.g. <code>"com.example.plugin"</code>).
- * </p>
- *
- * @param key the property key
- * @return the property value, or <code>null</code>, if the property is not
- * found
- */
- public Object getProperty(QualifiedName key);
-
- /**
- * Sets the given property to the given value.
- * <p>
- * The qualifier part of the property name must be the unique identifier
- * of the declaring plug-in (e.g. <code>"com.example.plugin"</code>).
- * </p>
- * <p>
- * This method should not be called by clients other than content
- * describers. An attempt to set a property from other contexts will cause
- * an <code>IllegalStateException</code> to be thrown.
- * </p>
- *
- * @param key the qualified name of the property
- * @param value the property value, or <code>null</code>,
- * if the property is to be removed
- * @throws IllegalStateException if called after this description has been
- * filled in
- */
- public void setProperty(QualifiedName key, Object value);
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentType.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentType.java
deleted file mode 100644
index 55cacaf..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentType.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.content;
-
-import java.io.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-
-/**
- * Content types represent and provide information on file types, such as
- * associated file names/extensions, default charset, etc.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @since 3.0
- */
-public interface IContentType extends IContentTypeSettings {
- /**
- * File spec type flag constant, indicating that pre-defined file
- * specifications should not be taken into account.
- */
- public static final int IGNORE_PRE_DEFINED = 0x01;
- /**
- * File spec type flag constant, indicating that user-defined file
- * specifications should not be taken into account.
- */
- public static final int IGNORE_USER_DEFINED = 0x02;
- /**
- * File spec type constant, indicating a file name specification.
- */
- public static final int FILE_NAME_SPEC = 0x04;
- /**
- * File spec type constant, indicating a file extension specification.
- */
- public static final int FILE_EXTENSION_SPEC = 0x08;
-
- /**
- * Returns a reference to this content type's base type. If this content type
- * does not have a base type (it is a root type), returns <code>null</code>.
- *
- * @return this content type's base type, or <code>null</code>
- */
- public IContentType getBaseType();
-
- /**
- * Returns the default content description for this content type. A default
- * content description is returned by the content type API whenever
- * content analysis could not find any particular information to be described
- * about the contents being processed, so all default attributes for the
- * content type in question apply.
- * <p>
- * Clients doing caching of content descriptions may choose to treat default
- * descriptions in a special manner, since they are easily recoverable
- * through this API.
- * </p>
- *
- * @return a content description
- * @since 3.1
- */
- public IContentDescription getDefaultDescription();
-
- /**
- * Tries to obtain a description for the given contents.
- * <p>
- * Any IOExceptions that may occur while reading the given input stream
- * will flow to the caller. The input stream will not be closed by this
- * operation.
- * </p>
- *
- * @param contents the contents to be interpreted
- * @param options an array of keys for all properties that should be described
- * @return a content description if one could be obtained, or
- * <code>null</code>
- * @throws IOException if an error occurs while reading the contents
- * @see IContentDescription
- */
- public IContentDescription getDescriptionFor(InputStream contents, QualifiedName[] options) throws IOException;
-
- /**
- * Tries to obtain a description for the given contents.
- * <p>
- * Any IOExceptions that may occur while reading the given reader
- * will flow to the caller. The reader will not be closed by this
- * operation.
- * </p>
- *
- * @param contents the contents to be interpreted
- * @param options an array of keys for all properties that should be described
- * @return a content description if one could be obtained, or
- * <code>null</code>
- * @throws UnsupportedOperationException if this content type
- * has a describer that does not implement
- * <code>ITextContentDescriber</code>
- * @throws IOException if an error occurs while reading the contents
- * @see IContentDescription
- */
- public IContentDescription getDescriptionFor(Reader contents, QualifiedName[] options) throws IOException;
-
- /**
- * Returns the default charset for this content type if one has been defined,
- * <code>null</code> otherwise.
- * This refinement of the corresponding <code>IContentTypeSettings</code>
- * method also takes into account the charset defined by the content type
- * provider (or its base content type).
- *
- * @return the default charset, or <code>null</code>
- */
- public String getDefaultCharset();
-
- /**
- * Returns file specifications from this content type. The type mask
- * is a bit-wise or of file specification type constants indicating the
- * file specification types of interest.
- * This refinement of the corresponding <code>IContentTypeSettings</code>
- * method supports additional flags because it also takes into account the
- * file specifications defined by the content type provider (or its base
- * content type).
- *
- * @param type a bit-wise or of file specification type constants. Valid
- * flags are:
- *<ul>
- *<li>one of <code>FILE_EXTENSION_SPEC</code> or
- *<code>FILE_NAME_SPEC</code></li>
- *<li>and optionally, one of <code>IGNORE_PRE_DEFINED</code>
- *or <code>IGNORE_USER_DEFINED</code></li>
- *</ul>
- * @return the file specification
- * @see #FILE_NAME_SPEC
- * @see #FILE_EXTENSION_SPEC
- * @see #IGNORE_PRE_DEFINED
- * @see #IGNORE_USER_DEFINED
- */
- public String[] getFileSpecs(int type);
-
- /**
- * Returns this content type's unique identifier. Each content type has an
- * identifier by which they can be retrieved from the content type catalog.
- *
- * @return this content type's unique identifier
- */
- public String getId();
-
- /**
- * Returns a user-friendly name for this content type.
- *
- * @return this content type's name
- */
- public String getName();
-
- /**
- * Returns whether this content type is associated with the
- * given file name.
- *
- * @param fileName the file name
- * @return <code>true</code> if this content type is associated with
- * the given file name, <code>false</code> otherwise
- * @see #isAssociatedWith(String, IScopeContext)
- */
- public boolean isAssociatedWith(String fileName);
-
- /**
- * Returns whether this content type is associated with the
- * given file name in the given preference scope.
- *
- * @param fileName the file name
- * @param context a preference scope context
- * @return <code>true</code> if this content type is associated with
- * the given file name, <code>false</code> otherwise
- * @since 3.1
- */
- public boolean isAssociatedWith(String fileName, IScopeContext context);
-
- /**
- * Returns whether this content type is a kind of the given content
- * type. A content type A is a kind of a content type B if:
- * <ol>
- * <li>A and B are the same content type, or</li>
- * <li>A's base type is B, or</li>
- * <li>A's base type is a kind of B.</li>
- * </ol>
- *
- * @param another a content type
- * @return <code>true</code> if this content type is a kind of the
- * given content type, <code>false</code> otherwise
- */
- public boolean isKindOf(IContentType another);
-
- /**
- * Returns the settings for this content type in the given
- * preference context.
- *
- * @param context a preference scope context
- * @return setting in the given context
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li> An error occurred obtaining the settings.</li>
- * </ul>
- * @since 3.1
- */
- public IContentTypeSettings getSettings(IScopeContext context) throws CoreException;
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentTypeManager.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentTypeManager.java
deleted file mode 100644
index 425640e..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentTypeManager.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.content;
-
-import java.util.EventObject;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-
-/**
- * The content type manager provides facilities for file name and content-based
- * type lookup and content description.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see org.eclipse.core.runtime.content.IContentTypeMatcher
- * @see org.eclipse.core.runtime.Platform#getContentTypeManager()
- * @since 3.0
- */
-public interface IContentTypeManager extends IContentTypeMatcher {
-
- /**
- * An event object which describes the details of a change to a
- * content type.
- * <p>
- * Types of changes include a change in the file associations or
- * a change in the encoding setting.
- * </p>
- */
- public final class ContentTypeChangeEvent extends EventObject {
- /**
- * All serializable objects should have a stable serialVersionUID
- */
- private static final long serialVersionUID = 1L;
- /*
- * The context for the setting that changed.
- *
- * @since 3.1
- */
- private IScopeContext context;
-
- /**
- * Constructor for a new content type change event.
- *
- * @param source the content type that changed
- */
- public ContentTypeChangeEvent(IContentType source) {
- super(source);
- }
-
- /**
- * Constructor for a new content type change event.
- *
- * @param source the content type that changed
- * @param context the context where a setting changed, or <code>null</code>
- * @since 3.1
- */
- public ContentTypeChangeEvent(IContentType source, IScopeContext context) {
- super(source);
- this.context = context;
- }
-
- /**
- * Return the content type object associated with this change event.
- *
- * @return the content type
- */
- public IContentType getContentType() {
- return (IContentType) source;
- }
-
- /**
- * Return the preference scope where the setting changed, or
- * <code>null</code>, if the change happened in the content type manager
- * default context.
- *
- * @return the context where the change happened, or <code>null</code>
- * @since 3.1
- */
- public IScopeContext getContext() {
- return context;
- }
- }
-
- /**
- * A listener to be used to receive content type change events.
- * <p>
- * Clients who reference the <code>org.eclipse.core.resources</code>
- * bundle are encouraged <em>not</em> to use this listener mechanism to
- * detect encoding changes. The Core Resources bundle will
- * detect changes to content types and notify clients appropriately
- * of potential changes to the encoding of files in the workspace
- * via the resource change mechanism.
- * </p>
- * <p>
- * Clients may implement this interface.
- * </p>
- */
- public interface IContentTypeChangeListener {
-
- /**
- * Notification that a content type has changed in the content type manager.
- * The given event object contains the content type which changed and must not
- * be <code>null</code>.
- *
- * @param event the content type change event
- */
- public void contentTypeChanged(ContentTypeChangeEvent event);
- }
-
- /**
- * A policy for refining the set of content types that
- * should be accepted during content type matching operations.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see IContentTypeManager#getMatcher(IContentTypeManager.ISelectionPolicy, IScopeContext)
- * @since 3.1
- */
- public interface ISelectionPolicy {
- /**
- * Returns a subset of the given content types sorted by using a custom criterion.
- * <p>
- * The given array of content types has already been sorted using
- * the platform rules. If this object follows the same rules, further sorting
- * is not necessary.
- * </p>
- * <p>
- * The type of matching being performed (name, contents or name + contents)
- * might affect the outcome for this method. For instance, for file name-only
- * matching, the more general type could have higher priority. For content-based
- * matching, the more specific content type could be preferred instead.
- * </p>
- *
- * @param candidates an array containing content types matching some query
- * @param fileName whether it is a file name-based content type matching
- * @param content whether its a content-based content type matching
- * @return an array of content types
- */
- IContentType[] select(IContentType[] candidates, boolean fileName, boolean content);
- }
-
- /**
- * Content type identifier constant for platform's primary
- * text-based content type: <code>org.eclipse.core.runtime.text</code>.
- * <p>
- * All text-based content types ought to be sub types of the content type
- * identified by this string. This provides a simple way for detecting
- * whether a content type is text-based:
- * <pre>
- * IContentType text = Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT);
- * IContentType someType = ...;
- * boolean isTextBased = someType.isKindOf(text);
- * </pre>
- * </p>
- */
- public final static String CT_TEXT = "org.eclipse.core.runtime.text"; //$NON-NLS-1$
-
- /**
- * Register the given listener for notification of content type changes.
- * Calling this method multiple times with the same listener has no effect. The
- * given listener argument must not be <code>null</code>.
- *
- * @param listener the content type change listener to register
- * @see #removeContentTypeChangeListener(IContentTypeManager.IContentTypeChangeListener)
- * @see IContentTypeManager.IContentTypeChangeListener
- */
- public void addContentTypeChangeListener(IContentTypeChangeListener listener);
-
- /**
- * Returns all content types known by the platform.
- * <p>
- * Returns an empty array if there are no content types available.
- * </p>
- *
- * @return all content types known by the platform.
- */
- public IContentType[] getAllContentTypes();
-
- /**
- * Returns the content type with the given identifier, or <code>null</code>
- * if no such content type is known by the platform.
- *
- * @param contentTypeIdentifier the identifier for the content type
- * @return the content type, or <code>null</code>
- */
- public IContentType getContentType(String contentTypeIdentifier);
-
- /**
- * Returns a newly created content type matcher using the given content type selection policy
- * and preference scope. If the preference scope is <code>null</code>, the default scope
- * is used.
- *
- * @param customPolicy a selection policy
- * @param context a user preference context to be used by the matcher, or <code>null</code>
- * @return a content type matcher that uses the given policy
- * @since 3.1
- */
- public IContentTypeMatcher getMatcher(ISelectionPolicy customPolicy, IScopeContext context);
-
- /**
- * De-register the given listener from receiving notification of content type changes.
- * Calling this method multiple times with the same listener has no
- * effect. The given listener argument must not be <code>null</code>.
- *
- * @param listener the content type change listener to remove
- * @see #addContentTypeChangeListener(IContentTypeManager.IContentTypeChangeListener)
- * @see IContentTypeManager.IContentTypeChangeListener
- */
- public void removeContentTypeChangeListener(IContentTypeChangeListener listener);
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentTypeMatcher.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentTypeMatcher.java
deleted file mode 100644
index ab8c4bd..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentTypeMatcher.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.content;
-
-import java.io.*;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-
-/**
- * An object that performs content type matching queries.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IContentTypeManager#getMatcher(IContentTypeManager.ISelectionPolicy, IScopeContext)
- * @since 3.1
- */
-public interface IContentTypeMatcher {
- /**
- * Returns the preferred content type for the given contents and file name.
- * <p>
- * Returns <code>null</code> if no associated content types are
- * found.
- * </p>
- * <p>
- * If a file name is not provided, the entire content type registry will be
- * queried. For performance reasons, it is highly recommended
- * to provide a file name if available.
- * </p>
- * <p>
- * Any IOExceptions that may occur while reading the given input stream
- * will flow to the caller. The input stream will not be closed by this
- * operation.
- * </p>
- *
- * @param contents an input stream
- * @param fileName the file name associated to the contents, or <code>null</code>
- * @return the preferred content type associated to the given file name, or <code>null</code>
- * @throws IOException if an error occurs while reading the contents
- */
- public IContentType findContentTypeFor(InputStream contents, String fileName) throws IOException;
-
- /**
- * Returns the preferred content type for the given file name. If multiple content types
- * are associated with the given file name, the one considered the most appropriated will
- * be returned. If there are no content types associated, <code>null</code> is returned.
- *
- * @param fileName the name of the file
- * @return the preferred content type associated to the given file name, or <code>null</code>
- */
- public IContentType findContentTypeFor(String fileName);
-
- /**
- * Returns the content types associated to the given contents and file name.
- * <p>
- * Returns an empty array if no associated content types are found.
- * </p>
- * <p>
- * If a file name is not provided, the entire content type registry will be
- * queried. For performance reasons, it is highly recommended
- * to provide a file name if available.
- * </p>
- * <p>
- * Any IOExceptions that may occur while reading the given input stream
- * will flow to the caller. The input stream will not be closed by this
- * operation.
- * </p>
- *
- * @param contents an input stream
- * @param fileName the file name associated to the contents, or <code>null</code>
- * @return all content types associated to the given contents and file name
- * @throws IOException if an error occurs while reading the contents
- */
- public IContentType[] findContentTypesFor(InputStream contents, String fileName) throws IOException;
-
- /**
- * Returns all content types known by the platform that are associated to the given file name.
- * <p>
- * Returns an empty array if there are no content types associated.
- * </p>
- *
- * @param fileName the name of the file
- * @return all content types associated to the given file spec
- */
- public IContentType[] findContentTypesFor(String fileName);
-
- /**
- * Tries to obtain a description for the given contents and file name.
- * <p>
- * Any IOExceptions that may occur while reading the given input stream
- * will flow to the caller. The input stream will not be closed by this
- * operation.
- * </p>
- * <p>
- * If a file name is not provided, the entire content type registry will be
- * queried. For performance reasons, it is highly recommended
- * to provide a file name if available.
- * </p>
- *
- * @param contents the contents to be interpreted
- * @param fileName the file name associated to the contents, or <code>null</code>
- * @param options an array of keys for all properties that should be
- * described, or <code>IContentDescription.ALL</code>, for all of them
- * @return a content description if one could be obtained, or <code>null</code>
- * @throws IOException if an error occurs while reading the contents
- * @see IContentDescription
- */
- public IContentDescription getDescriptionFor(InputStream contents, String fileName, QualifiedName[] options) throws IOException;
-
- /**
- * Tries to obtain a description for the given contents and file name.
- * <p>
- * Any IOExceptions that may occur while reading the given input stream
- * will flow to the caller. The reader will not be closed by this
- * operation.
- * </p>
- * <p>
- * If a file name is not provided, the entire content type registry will be
- * queried. For performance reasons, it is highly recommended
- * to provide a file name if available.
- * </p>
- *
- * @param contents the contents to be interpreted
- * @param fileName the file name associated to the contents, or <code>null</code>
- * @param options an array of keys for all properties that should be
- * described, or <code>IContentDescription.ALL</code>, for all of them
- * @return a content description if one could be obtained, or <code>null</code>
- * @throws IOException if an error occurs while reading the contents
- * @see IContentDescription
- */
- public IContentDescription getDescriptionFor(Reader contents, String fileName, QualifiedName[] options) throws IOException;
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentTypeSettings.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentTypeSettings.java
deleted file mode 100644
index c2d6502..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/IContentTypeSettings.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.content;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-
-/**
- * Gives access to the user settings for a content type.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IContentType
- * @see IContentType#getSettings(IScopeContext)
- * @since 3.1
- */
-public interface IContentTypeSettings {
- /**
- * File spec type constant, indicating a file extension specification.
- */
- public static final int FILE_EXTENSION_SPEC = 0x08;
- /**
- * File spec type constant, indicating a file name specification.
- */
- public static final int FILE_NAME_SPEC = 0x04;
-
- /**
- * Adds a user-defined file specification to the corresponding content type. Has no
- * effect if the given file specification is already defined.
- *
- * @param fileSpec the file specification
- * @param type the type of the file specification. One of
- * <code>FILE_NAME_SPEC</code>,
- * <code>FILE_EXTENSION_SPEC</code>.
- * @throws IllegalArgumentException if the type bit mask is
- * incorrect
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li> An error occurred persisting this setting.</li>
- * </ul>
- * @see #FILE_NAME_SPEC
- * @see #FILE_EXTENSION_SPEC
- */
- public void addFileSpec(String fileSpec, int type) throws CoreException;
-
- /**
- * Returns the default charset for the corresponding content type if
- * it has been set, or
- * <code>null</code> otherwise.
- *
- * @return the default charset, or <code>null</code>
- */
- public String getDefaultCharset();
-
- /**
- * Returns the file specifications for the corresponding content type. The type mask
- * is a bit-wise or of file specification type constants indicating the
- * file specification types of interest.
- *
- * @param type a bit-wise or of file specification type constants. Valid
- * flags are one of <code>FILE_EXTENSION_SPEC</code> or
- *<code>FILE_NAME_SPEC</code>
- * @return the file specification
- * @see #FILE_NAME_SPEC
- * @see #FILE_EXTENSION_SPEC
- */
- public String[] getFileSpecs(int type);
-
- /**
- * Returns the corresponding content type's unique identifier. Each content
- * type has an identifier by which they can be retrieved from the content
- * type catalog.
- *
- * @return the content type unique identifier
- */
- public String getId();
-
- /**
- * Removes a user-defined file specification from the corresponding content type. Has no
- * effect if the given file specification was not defined by the user.
- *
- * @param fileSpec the file specification
- * @param type the type of the file specification. One of
- * <code>FILE_NAME_SPEC</code>,
- * <code>FILE_EXTENSION_SPEC</code>.
- * @throws IllegalArgumentException if the type bit mask is
- * incorrect
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li> An error occurred persisting this setting.</li>
- * </ul>
- * @see #FILE_NAME_SPEC
- * @see #FILE_EXTENSION_SPEC
- */
- public void removeFileSpec(String fileSpec, int type) throws CoreException;
-
- /**
- * Sets the default charset for the corresponding content type. If
- * <code>null</code> is provided, restores the pre-defined default charset.
- *
- * @param userCharset the new charset for the content type, or
- * <code>null</code>
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li> An error occurred persisting this setting.</li>
- * </ul>
- */
- public void setDefaultCharset(String userCharset) throws CoreException;
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/ITextContentDescriber.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/ITextContentDescriber.java
deleted file mode 100644
index b80f295..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/ITextContentDescriber.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.content;
-
-import java.io.IOException;
-import java.io.Reader;
-
-/**
- * Text content describers extend basic content describers to provide
- * the ability of scanning character streams (readers). Describers for
- * text-based content types must implement this interface
- * instead of <code>IContentDescription</code>.
- * <p>
- * Note: It is expected that content describer implementations be declared in a package
- * that is exempt from plug-in activation (using the Eclipse-AutoStart bundle
- * manifest header). Since all describers are instantiated when the content type
- * framework is initialized, failure in complying with this requirement causes
- * premature activation, which must be avoided. Future implementations of the
- * framework might refuse to instantiate describers if doing so would trigger
- * activation of the corresponding plug-in.
- * </p>
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see IContentDescription
- * @since 3.0
- */
-public interface ITextContentDescriber extends IContentDescriber {
- /**
- * Tries to fill a description for the given contents. Returns
- * an <code>int</code> indicating whether the given stream of
- * characters represents a valid sample for this describer's corresponding
- * content type. If no content description is provided, this method should
- * only perform content type validation.
- * <p>
- * The stream provided must be kept open, and any IOExceptions while
- * reading it should flow to the caller.
- * </p>
- *
- * @param contents the contents to be examined
- * @param description a description to be filled in, or <code>null</code> if
- * only content type validation is to be performed
- * @return one of the following:<ul>
- * <li><code>VALID</code></li>
- * <li><code>INVALID</code></li>
- * <li><code>INDETERMINATE</code></li>
- * </ul>
- * @throws IOException if an I/O error occurs
- * @see IContentDescription
- * @see #VALID
- * @see #INVALID
- * @see #INDETERMINATE
- */
- public int describe(Reader contents, IContentDescription description) throws IOException;
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/XMLRootElementContentDescriber.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/XMLRootElementContentDescriber.java
deleted file mode 100644
index c104d82..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/XMLRootElementContentDescriber.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.content;
-
-import java.io.*;
-import java.util.Hashtable;
-import javax.xml.parsers.ParserConfigurationException;
-import org.eclipse.core.internal.content.*;
-import org.eclipse.core.internal.runtime.RuntimeLog;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * A content describer for detecting the name of the top-level element or the
- * DTD system identifier in an XML file.
- * <p>
- * This executable extension supports two parameters:
- * "dtd" and "element".
- * At least one of them <strong>must</strong> be provided. If the
- * <code>":-"</code> method is used, then the value is treated as
- * "element".
- * </p>
- * <p>
- * This class is not intended to be subclassed or instantiated by clients,
- * only to be referenced by the "describer" configuration element in
- * extensions to the <code>org.eclipse.core.runtime.contentTypes</code>
- * extension point.
- * </p>
- *
- * @since 3.0
- * @deprecated Use {@link XMLRootElementContentDescriber2} instead
- */
-public final class XMLRootElementContentDescriber extends XMLContentDescriber implements IExecutableExtension {
- private static final String DTD_TO_FIND = "dtd"; //$NON-NLS-1$
- private static final String ELEMENT_TO_FIND = "element"; //$NON-NLS-1$
- /* (Intentionally not included in javadoc)
- * The system identifier that we wish to find. This value will be
- * initialized by the <code>setInitializationData</code> method. If no
- * value is provided, then this means that we don't care what the system
- * identifier will be.
- */
- private String dtdToFind = null;
- /* (Intentionally not included in javadoc)
- * The top-level element we are looking for. This value will be initialized
- * by the <code>setInitializationData</code> method. If no value is
- * provided, then this means that we don't care what the top-level element
- * will be.
- */
- private String elementToFind = null;
-
- /* (Intentionally not included in javadoc)
- * Determines the validation status for the given contents.
- *
- * @param contents the contents to be evaluated
- * @return one of the following:<ul>
- * <li><code>VALID</code></li>,
- * <li><code>INVALID</code></li>,
- * <li><code>INDETERMINATE</code></li>
- * </ul>
- * @throws IOException
- */
- private int checkCriteria(InputSource contents) throws IOException {
- XMLRootHandler xmlHandler = new XMLRootHandler(elementToFind != null);
- try {
- if (!xmlHandler.parseContents(contents))
- return INDETERMINATE;
- } catch (SAXException e) {
- // we may be handed any kind of contents... it is normal we fail to parse
- return INDETERMINATE;
- } catch (ParserConfigurationException e) {
- // some bad thing happened - force this describer to be disabled
- String message = ContentMessages.content_parserConfiguration;
- RuntimeLog.log(new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, e));
- throw new RuntimeException(message);
- }
- // Check to see if we matched our criteria.
- if ((elementToFind != null) && (!elementToFind.equals(xmlHandler.getRootName())))
- return INDETERMINATE;
- if ((dtdToFind != null) && (!dtdToFind.equals(xmlHandler.getDTD())))
- return INDETERMINATE;
- // We must be okay then.
- return VALID;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IContentDescriber#describe(InputStream, IContentDescription)
- */
- public int describe(InputStream contents, IContentDescription description) throws IOException {
- // call the basic XML describer to do basic recognition
- if (super.describe(contents, description) == INVALID)
- return INVALID;
- // super.describe will have consumed some chars, need to rewind
- contents.reset();
- // Check to see if we matched our criteria.
- return checkCriteria(new InputSource(contents));
- }
-
- /* (Intentionally not included in javadoc)
- * @see IContentDescriber#describe(Reader, IContentDescription)
- */
- public int describe(Reader contents, IContentDescription description) throws IOException {
- // call the basic XML describer to do basic recognition
- if (super.describe(contents, description) == INVALID)
- return INVALID;
- // super.describe will have consumed some chars, need to rewind
- contents.reset();
- // Check to see if we matched our criteria.
- return checkCriteria(new InputSource(contents));
- }
-
- /* (Intentionally not included in javadoc)
- * @see IExecutableExtension#setInitializationData
- */
- public void setInitializationData(final IConfigurationElement config, final String propertyName, final Object data) throws CoreException {
- if (data instanceof String)
- elementToFind = (String) data;
- else if (data instanceof Hashtable) {
- Hashtable parameters = (Hashtable) data;
- dtdToFind = (String) parameters.get(DTD_TO_FIND);
- elementToFind = (String) parameters.get(ELEMENT_TO_FIND);
- }
- if (dtdToFind == null && elementToFind == null) {
- String message = NLS.bind(ContentMessages.content_badInitializationData, XMLRootElementContentDescriber.class.getName());
- throw new CoreException(new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, null));
- }
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/XMLRootElementContentDescriber2.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/XMLRootElementContentDescriber2.java
deleted file mode 100644
index 8279949..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/XMLRootElementContentDescriber2.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jesper Steen Moeller - added namespace support
- *******************************************************************************/
-package org.eclipse.core.runtime.content;
-
-import java.io.*;
-import java.util.*;
-import javax.xml.parsers.ParserConfigurationException;
-import org.eclipse.core.internal.content.*;
-import org.eclipse.core.internal.runtime.RuntimeLog;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * A content describer for detecting the name of the top-level element,
- * its namespace and the DTD system identifier in an XML file.
- * <p>
- * This executable extension supports "element" parameter, that
- * can be specified more than once. If the
- * <code>":-"</code> method is used, then the value is treated as
- * "element" (always just one)
- * </p>
- * <p>
- * The value of "element" is specified using such a format
- * <code>{namespace}name/dtd</code>. The namespace or dtd part
- * can be omitted and accepted are values like <code>name/dtd</code>,
- * <code>{ns}name</code> and <code>name</code>.
- * </p>
- * <p>
- * The describer will detect a document, if it matches at least one "element"
- * what means, that dtd, namespace (if specified) and name in "element"
- * match those in the document.
- * </p>
- * <p>
- * If the "element" name part is "*", e.g. <code>{namespace}*</code>,
- * it denotes a wildcard match. If the "element" namespace part is empty,
- * e.g. <code>{}name</code>, only these documents with the root element
- * that belong to the unnamed namespace <code><elem xmlns=""></code>
- * will be detected.
- * </p>
- * <p>
- * This class should be used instead of {@link XMLRootElementContentDescriber}
- * which doesn't detect namespaces and doesn't allow to specify
- * more than one set of dtds, root element names and namespaces which
- * should be detected.
- * </p>
- * <p>
- * This class is not intended to be subclassed or instantiated by clients,
- * only to be referenced by the "describer" configuration element in
- * extensions to the <code>org.eclipse.core.runtime.contentTypes</code>
- * extension point.
- * </p>
- *
- * @since org.eclipse.core.contenttype 3.3
- */
-public final class XMLRootElementContentDescriber2 extends XMLContentDescriber implements IExecutableExtension {
- private static final String ELEMENT_TO_FIND = "element"; //$NON-NLS-1$
-
- /* (Intentionally not included in javadoc)
- * The top-level elements we are looking for. This value will be initialized
- * by the <code>setInitializationData</code> method. If no value is
- * provided, then this means that we don't care what the top-level element
- * will be. The list is a collection of <code>QualifiedElement</code>.
- */
- private QualifiedElement[] elementsToFind = null;
-
- /* (Intentionally not included in javadoc)
- * Simple value holder for root element name, its namespace and dtd.
- */
- private class QualifiedElement {
- private String namespace;
- private String element;
- private String dtd;
-
- public QualifiedElement(String namespace, String element, String dtd) {
- this.namespace = namespace;
- this.element = element;
- this.dtd = dtd;
- }
-
- public QualifiedElement(String qualifiedElement) {
- // Extract namespace part
- int openBrace = qualifiedElement.indexOf('{');
- int closeBrace = qualifiedElement.indexOf('}');
- if (openBrace == 0 && closeBrace >=1 ) {
- namespace = qualifiedElement.substring(1, closeBrace);
- qualifiedElement = qualifiedElement.substring(closeBrace+1);
- }
- // Extract dtd part
- int dtdSlash = qualifiedElement.indexOf('/');
- if (dtdSlash > 0) {
- dtd = qualifiedElement.substring(dtdSlash+1);
- qualifiedElement = qualifiedElement.substring(0, dtdSlash);
- }
- // Check if the name is a wildcard
- element = ("*".equals(qualifiedElement) ? null : qualifiedElement);
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public String getElement() {
- return element;
- }
- public String getDTD() {
- return dtd;
- }
-
- public boolean matches(String someNamespace, String someElement, String someDtd) {
- boolean nsMatch = this.namespace != null ? this.namespace.equals(someNamespace) : true;
- boolean elementEquals = this.element != null ? this.element.equals(someElement) : true;
- boolean dtdEquals = this.dtd != null ? this.dtd.equals(someDtd) : true;
- return nsMatch && elementEquals && dtdEquals;
- }
- }
-
- /* (Intentionally not included in javadoc)
- * Determines the validation status for the given contents.
- *
- * @param contents the contents to be evaluated
- * @return one of the following:<ul>
- * <li><code>VALID</code></li>,
- * <li><code>INVALID</code></li>,
- * <li><code>INDETERMINATE</code></li>
- * </ul>
- * @throws IOException
- */
- private int checkCriteria(InputSource contents) throws IOException {
- XMLRootHandler xmlHandler = new XMLRootHandler(elementsToFind != null);
- try {
- if (!xmlHandler.parseContents(contents))
- return INDETERMINATE;
- } catch (SAXException e) {
- // we may be handed any kind of contents... it is normal we fail to parse
- return INDETERMINATE;
- } catch (ParserConfigurationException e) {
- // some bad thing happened - force this describer to be disabled
- String message = ContentMessages.content_parserConfiguration;
- RuntimeLog.log(new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, e));
- throw new RuntimeException(message);
- }
- // Check to see if we matched our criteria.
- if (elementsToFind != null) {
- boolean foundOne = false;
- for (int i = 0; i < elementsToFind.length && !foundOne; ++i) {
- foundOne |= elementsToFind[i].matches(xmlHandler.getRootNamespace(), xmlHandler.getRootName(), xmlHandler.getDTD());
- }
- if (!foundOne)
- return INDETERMINATE;
- }
- // We must be okay then.
- return VALID;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IContentDescriber#describe(InputStream, IContentDescription)
- */
- public int describe(InputStream contents, IContentDescription description) throws IOException {
- // call the basic XML describer to do basic recognition
- if (super.describe(contents, description) == INVALID)
- return INVALID;
- // super.describe will have consumed some chars, need to rewind
- contents.reset();
- // Check to see if we matched our criteria.
- return checkCriteria(new InputSource(contents));
- }
-
- /* (Intentionally not included in javadoc)
- * @see IContentDescriber#describe(Reader, IContentDescription)
- */
- public int describe(Reader contents, IContentDescription description) throws IOException {
- // call the basic XML describer to do basic recognition
- if (super.describe(contents, description) == INVALID)
- return INVALID;
- // super.describe will have consumed some chars, need to rewind
- contents.reset();
- // Check to see if we matched our criteria.
- return checkCriteria(new InputSource(contents));
- }
-
- /* (Intentionally not included in javadoc)
- * @see IExecutableExtension#setInitializationData
- */
- public void setInitializationData(final IConfigurationElement config, final String propertyName, final Object data) throws CoreException {
- if (data instanceof String)
- elementsToFind = new QualifiedElement[] {new QualifiedElement((String) data)};
- else if (data instanceof Hashtable) {
- List elements = null;
-
- // the describer parameters have to be read again, because "element" parameter can be specified multiple times
- // and the given hashtable carries only one of them
- IConfigurationElement describerElement = config.getChildren("describer")[0]; //$NON-NLS-1$
- IConfigurationElement[] params = describerElement.getChildren("parameter"); //$NON-NLS-1$
- String pname = null;
- for (int i = 0; i < params.length; i++) {
- pname = params[i].getAttribute("name"); //$NON-NLS-1$
- if (ELEMENT_TO_FIND.equals(pname)) {
- if (elements == null)
- elements = new LinkedList();
- elements.add(new QualifiedElement(params[i].getAttribute("value"))); //$NON-NLS-1$
- }
- }
-
- List qualifiedElements = new ArrayList();
-
- // create list of qualified elements
- if (elements != null) {
- for (Iterator it = elements.iterator(); it.hasNext();) {
- qualifiedElements.add(it.next());
- }
- }
- elementsToFind = (QualifiedElement[]) qualifiedElements.toArray(new QualifiedElement[qualifiedElements.size()]);
- }
-
- if (elementsToFind.length == 0) {
- String message = NLS.bind(ContentMessages.content_badInitializationData, XMLRootElementContentDescriber2.class.getName());
- throw new CoreException(new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, null));
- }
- }
-}
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/package.html b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/package.html
deleted file mode 100644
index fa292a8..0000000
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/runtime/content/package.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides core support for content types.
-<h2>
-Package Specification</h2>
-<p>
-This package specifies API for content type management and automatic
-content type determination.
-</p>
-<p>
-@since 3.0
-</p>
-</body>
-</html>
diff --git a/bundles/org.eclipse.core.expressions/.classpath b/bundles/org.eclipse.core.expressions/.classpath
deleted file mode 100644
index ce73933..0000000
--- a/bundles/org.eclipse.core.expressions/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.core.expressions/.cvsignore b/bundles/org.eclipse.core.expressions/.cvsignore
deleted file mode 100644
index fe99505..0000000
--- a/bundles/org.eclipse.core.expressions/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-bin
-
diff --git a/bundles/org.eclipse.core.expressions/.options b/bundles/org.eclipse.core.expressions/.options
deleted file mode 100644
index be381a7..0000000
--- a/bundles/org.eclipse.core.expressions/.options
+++ /dev/null
@@ -1,3 +0,0 @@
-# Traces property resolving in the hierarchy of type
-# extensions
-org.eclipse.core.expressions/tracePropertyResolving=false
diff --git a/bundles/org.eclipse.core.expressions/.project b/bundles/org.eclipse.core.expressions/.project
deleted file mode 100644
index 3bf832e..0000000
--- a/bundles/org.eclipse.core.expressions/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.expressions</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.core.expressions/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.expressions/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 6c3039b..0000000
--- a/bundles/org.eclipse.core.expressions/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,89 +0,0 @@
-#Thu Oct 11 11:40:25 CEST 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.builder.cleanOutputFolder=clean
-org.eclipse.jdt.core.builder.duplicateResourceTask=warning
-org.eclipse.jdt.core.builder.invalidClasspath=abort
-org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
-org.eclipse.jdt.core.circularClasspath=error
-org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
-org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.3
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=error
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.compiler.problem.nullReference=error
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
-org.eclipse.jdt.core.incompatibleJDKLevel=ignore
-org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.core.expressions/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.core.expressions/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index d7a11b2..0000000
--- a/bundles/org.eclipse.core.expressions/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Tue Apr 18 13:07:27 CEST 2006
-eclipse.preferences.version=1
-internal.default.compliance=user
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=java;javax;org.osgi;org.eclipse.core.runtime;org.eclipse.core.expressions;org.eclipse.core.internal.expressions;
-org.eclipse.jdt.ui.ondemandthreshold=99
-org.eclipse.jdt.ui.staticondemandthreshold=99
diff --git a/bundles/org.eclipse.core.expressions/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.core.expressions/.settings/org.eclipse.pde.prefs
deleted file mode 100644
index ac9eea9..0000000
--- a/bundles/org.eclipse.core.expressions/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,15 +0,0 @@
-#Mon Jan 29 10:51:35 CET 2007
-compilers.incompatible-environment=1
-compilers.p.build=0
-compilers.p.deprecated=1
-compilers.p.missing-packages=0
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=1
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=0
-compilers.p.unknown-element=0
-compilers.p.unknown-resource=0
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.use-project=true
-eclipse.preferences.version=1
diff --git a/bundles/org.eclipse.core.expressions/.template b/bundles/org.eclipse.core.expressions/.template
deleted file mode 100644
index d65e0f4..0000000
--- a/bundles/org.eclipse.core.expressions/.template
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<form>
- <p/><p><b>Tips on working with this plug-in project</b></p><li>For the view of the new plug-in at a glance, go to the <img href="pageImage"/><a href="OverviewPage">Overview</a>.</li><li>You can test the contributions of this plug-in by launching another instance of the workbench. On the <b>Run</b> menu, click <b>Run As</b> and choose <img href="runTimeWorkbenchImage"/><a href="action.run">Run-time Workbench</a> from the available choices.</li><li>You can add more functionality to this plug-in by adding extensions using the <a href="action.newExtension">New Extension Wizard</a>.</li><li>The plug-in project contains Java code that you can debug. Place breakpoints in Java classes. On the <b>Run</b> menu, select <b>Debug As</b> and choose <img href="runTimeWorkbenchImage"/><a href="action.debug">Run-time Workbench</a> from the available choices.</li>
-</form>
diff --git a/bundles/org.eclipse.core.expressions/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.expressions/META-INF/MANIFEST.MF
deleted file mode 100644
index 43070af..0000000
--- a/bundles/org.eclipse.core.expressions/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,19 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.core.expressions; singleton:=true
-Bundle-Version: 3.4.0.qualifier
-Bundle-ClassPath: .
-Bundle-Activator: org.eclipse.core.internal.expressions.ExpressionPlugin
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Export-Package: org.eclipse.core.expressions,
- org.eclipse.core.internal.expressions;x-internal:=true,
- org.eclipse.core.internal.expressions.propertytester;x-internal:=true,
- org.eclipse.core.internal.expressions.util;x-internal:=true
-Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)"
-Eclipse-LazyStart: true
-Bundle-RequiredExecutionEnvironment: J2SE-1.4,
- CDC-1.0/Foundation-1.0,
- J2SE-1.3
-Import-Package: org.w3c.dom
diff --git a/bundles/org.eclipse.core.expressions/about.html b/bundles/org.eclipse.core.expressions/about.html
deleted file mode 100644
index 4602330..0000000
--- a/bundles/org.eclipse.core.expressions/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/apichanges_core-expressions.html b/bundles/org.eclipse.core.expressions/apichanges_core-expressions.html
deleted file mode 100644
index c974eb7..0000000
--- a/bundles/org.eclipse.core.expressions/apichanges_core-expressions.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type"
- content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Core Expressions Breaking API changes</title>
- <link rel="stylesheet" href="http://dev.eclipse.org/default_style.css"
- type="text/css">
-</head>
-<body style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
-<font color="#8080ff" size="-2">core expressions</font>
-<p>This document lists the breaking API changes that occurred between
-R3.3 and R3.4 and
-how to migrate from the R3.3 API to the R3.4 API.
-</p>
-<table border="0" cellpadding="2" cellspacing="5" width="100%" summary="Breaking API changes">
- <tbody>
- <tr>
- <td align="left" width="72%"> <font size="+3"><b>core expressions -
-Breaking API changes from R3.3 to R3.4</b></font> <br>
- </td>
- </tr>
- <tr>
- <td>
- None
- </td>
- </tr>
- </tbody>
-</table>
-<p> </p>
-<table border="0" cellpadding="2" cellspacing="5" width="100%" summary="Non-breaking API changes">
- <tbody>
- <tr>
- <td align="left" width="72%"> <font size="+3"><b>core expressions -
-Non-breaking API changes from R3.3 to R3.4</b></font> <br>
- </td>
- </tr>
- <tr>
- <td>
- New API added to <code>ExpressionInfo</code> to access all
- properties that have been accessed
- <ul><li><code>getAccessedPropertyNames</code></li>
- <li><code>addAccessedPropertyName</code></li></ul>
- </td>
- </tr>
- <tr>
- <td>
- New API constant added: <code>IEvaluationContext.UNDEFINED_VARIABLE</code>.
- <ul><li>Represents the value used by variables that exist but are not defined
- in a evaluation context. When tested by the 'with' expression, <code>false</code>
- will be returned.</li></ul>
- </td>
- </tr>
- </tbody>
-</table>
-<p>
-API changes from 3.2 to 3.3 can be found <a href="./notes/r3.3/apichanges_core-expressions.html?view=co">here</a>.
-</p>
-</body>
-</html>
-
diff --git a/bundles/org.eclipse.core.expressions/build.properties b/bundles/org.eclipse.core.expressions/build.properties
deleted file mode 100644
index eb7f1ce..0000000
--- a/bundles/org.eclipse.core.expressions/build.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = plugin.xml,\
- about.html,\
- plugin.properties,\
- .,\
- .options,\
- META-INF/
-src.includes = about.html,\
- schema/
-source.. = src/
diff --git a/bundles/org.eclipse.core.expressions/buildnotes_core-expressions.html b/bundles/org.eclipse.core.expressions/buildnotes_core-expressions.html
deleted file mode 100644
index ecdf618..0000000
--- a/bundles/org.eclipse.core.expressions/buildnotes_core-expressions.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!--
- DO NOT EDIT THIS FILE WITH HTML EDITORS
--->
-
-<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
-<html>
-
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.76 [en] (Windows NT 5.0; U) [Netscape]">
- <title>Eclipse Core Expressions Build Notes</title>
-</head>
-
-<body>
-<h1>Eclipse Core Expressions Build Notes</h1>
-
-<h3>Incompatible and interesting new APIs</h3>
-Click <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.core.expressions/apichanges_core-expressions.html?view=co">here</a> to see the list of APIs added or changed for 3.4.
-
-</body>
-</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/component.xml b/bundles/org.eclipse.core.expressions/component.xml
deleted file mode 100644
index e3cc1c2..0000000
--- a/bundles/org.eclipse.core.expressions/component.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<component xmlns="http://eclipse.org/component"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://eclipse.org/component ../component.xsd "
- name="Expression Language">
- <plugin id="org.eclipse.core.expressions" />
-
- <package name="org.eclipse.core.expressions">
- <type name= "EvaluationContext" subclass="false"/>
- <type name= "EvaluationResult" subclass="false"/>
- <type name= "ExpressionConverter" subclass="false"/>
- <type name= "ExpressionTagNames" subclass="false"/>
- <type name= "IEvaluationContext" implement="false"/>
- <type name= "IPropertyTester" implement="false"/>
- <type name= "IIterable"/>
- <type name= "ICountable"/>
- </package>
-
- <component-depends unrestricted="true"/>
-</component>
diff --git a/bundles/org.eclipse.core.expressions/notes/r3.3/apichanges_core-expressions.html b/bundles/org.eclipse.core.expressions/notes/r3.3/apichanges_core-expressions.html
deleted file mode 100644
index 3d5905e..0000000
--- a/bundles/org.eclipse.core.expressions/notes/r3.3/apichanges_core-expressions.html
+++ /dev/null
@@ -1,90 +0,0 @@
-<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type"
- content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Core Expressions Breaking API changes</title>
- <link rel="stylesheet" href="http://dev.eclipse.org/default_style.css"
- type="text/css">
-</head>
-<body style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
-<font color="#8080ff" size="-2">core expressions</font>
-<p>This document lists the breaking API changes that occurred between
-R3.2 and R3.3 and
-how to migrate from the R3.2 API to the R3.3 API.
-</p>
-<table border="0" cellpadding="2" cellspacing="5" width="100%" summary="Breaking API changes">
- <tbody>
- <tr>
- <td align="left" width="72%"> <font size="+3"><b>core expressions -
-Breaking API changes from R3.2 to R3.3</b></font> <br>
- </td>
- </tr>
- <tr>
- <td>
- None
- </td>
- </tr>
- </tbody>
-</table>
-<p> </p>
-<table border="0" cellpadding="2" cellspacing="5" width="100%" summary="Non-breaking API changes">
- <tbody>
- <tr>
- <td align="left" width="72%"> <font size="+3"><b>core expressions -
-Non-breaking API changes from R3.2 to R3.3</b></font> <br>
- </td>
- </tr>
- <tr>
- <td>
- New API in <code>org.eclipse.core.expressions.ElementHandler</code>:
- <ul>
- <li>
- <code>Expression create(ExpressionConverter converter, Element element) throws CoreException</code>
- </li>
- <li>
- <code>processChildren(ExpressionConverter converter, Element element, CompositeExpression expression) throws CoreException</code>
- </li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- New API in <code>org.eclipse.core.expressions.ExpressionConverter</code>:
- <ul>
- <li>
- <code>Expression perform(Element root) throws CoreException</code>
- </li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- New API constants in <code>org.eclipse.core.expressions.ExpressionTagNames</code>:
- <ul>
- <li>
- <code>REFERENCE</code>
- </li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- New API classes in package <code>org.eclipse.core.expressions</code>:
- <ul>
- <li>
- <code>IIterable</code>
- </li>
- <li>
- <code>ICountable</code>
- </li>
- </ul>
- </td>
- </tr>
- </tbody>
-</table>
-<p> </p>
-</body>
-</html>
-
diff --git a/bundles/org.eclipse.core.expressions/old_build_notes.html b/bundles/org.eclipse.core.expressions/old_build_notes.html
deleted file mode 100644
index 910d001..0000000
--- a/bundles/org.eclipse.core.expressions/old_build_notes.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]">
- <title>Core Expressions Release Notes</title>
-</head>
-<body>
-
-<h1>
-Eclipse Platform Build Notes <br>
-Core Expressions</h1>
-<h3>Mai 7, 2004</h3>
-<h4>Problem Reports Fixed</h4>
-<h4>Implemenation Changes</h4>
-<ul>
- <li>The ability to resolve a plug-in descriptor via the resolve expression has been removed
- from the expression language. This was necessary since IPluginDescriptor is deprecated
- for 3.0 and the functionality was new in 3.0 anyways.</li>
-</ul>
-<h3>March 23, 2004</h3>
-<h4>Problem Reports Fixed</h4>
-<h4>Implemenation Changes</h4>
-<ul>
- <li>removed the constructor public EvaluationContext(IEvaluationContext parent, Object defaultVariable,
- Object selection). Instead of calling this constructor, the following code has to be written:
- <pre>
- EvaluationContext evalContext= new EvaluationContext(null, cunit);
- evalContext.addVariable("selection", cunit); //$NON-NLS-1$
- </pre>
- </li>
- <li> removed the two string constants:
- <pre>
- public static final String SYSTEM= "System"; //$NON-NLS-1$
- public static final String SELECTION= "selection"; //$NON-NLS-1$
- </pre>
- </li>
- <li>added support for custom variable resolver (see new class IVariableResolver). So there is no need
- to subclass EvaluationContext anymore to add your own resolving strategy.
- </li>
- <li>added support for an equals expression. </li>
-</ul>
-
-<h3>March 16, 2004</h3>
-<h4>Problem Reports Fixed</h4>
-<h4>Implemenation Changes</h4>
-The adapt expression now uses the new IAdapterManager API hasAdapter(Object, String) and
-getAdapter(Object, String). This ensures that the right class loader is used to convert
-the string representing a type into a corresponding Class. However, this change now requires
-that the adapters requested via an adapt expression must be declared in XML using the new
-org.eclipse.core.runtime.adapters extension point.
-</body>
-</html>
-
diff --git a/bundles/org.eclipse.core.expressions/plugin.properties b/bundles/org.eclipse.core.expressions/plugin.properties
deleted file mode 100644
index 675269a..0000000
--- a/bundles/org.eclipse.core.expressions/plugin.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2007 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-pluginName= Expression Language
-providerName= Eclipse.org
-
-propertyTesterExtensionPoint= Property Tester
-defintionsExtensionPoint= Expression Definitions
diff --git a/bundles/org.eclipse.core.expressions/plugin.xml b/bundles/org.eclipse.core.expressions/plugin.xml
deleted file mode 100644
index 3134c65..0000000
--- a/bundles/org.eclipse.core.expressions/plugin.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
-
- <extension-point id="propertyTesters" name="%propertyTesterExtensionPoint" schema="schema/propertyTesters.exsd"/>
- <extension-point id="definitions" name="%defintionsExtensionPoint" schema="schema/definitions.exsd"/>
-
- <extension
- point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- id="org.eclipse.core.expressions.bundlePropertyTester"
- type="org.eclipse.core.runtime.Platform"
- namespace="org.eclipse.core.runtime"
- properties="product,isBundleInstalled"
- class="org.eclipse.core.internal.expressions.propertytester.PlatformPropertyTester">
- </propertyTester>
- </extension>
-
-</plugin>
diff --git a/bundles/org.eclipse.core.expressions/schema/definitions.exsd b/bundles/org.eclipse.core.expressions/schema/definitions.exsd
deleted file mode 100644
index 2114704..0000000
--- a/bundles/org.eclipse.core.expressions/schema/definitions.exsd
+++ /dev/null
@@ -1,166 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.core.expressions">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.core.expressions" id="definitions" name="Expression Definitions"/>
- </appInfo>
- <documentation>
- <p>
-This extension point allows you to create reusable extensions. They can then be used in other core expression constructs.
-</p>
-<p>
-The reference element in a core expression will evaluated the expression definition with the evaluation context that is active for the reference element.
-</p>
-
- </documentation>
- </annotation>
-
- <include schemaLocation="expressionLanguage.exsd"/>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="definition" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="definition">
- <annotation>
- <documentation>
- Provides a global definition of an expression to be used with the &lt;reference/&gt; expression element. This helps to reuse common expressions.
- </documentation>
- </annotation>
- <complexType>
- <choice>
- <element ref="not"/>
- <element ref="and"/>
- <element ref="or"/>
- <element ref="instanceof"/>
- <element ref="test"/>
- <element ref="systemTest"/>
- <element ref="equals"/>
- <element ref="count"/>
- <element ref="with"/>
- <element ref="resolve"/>
- <element ref="adapt"/>
- <element ref="iterate"/>
- </choice>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- A globally unique identifier for the expression definition.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- You can define and the use core expressions:
-
-<p>
-<pre>
-&lt;extension point="org.eclipse.core.expressions.definitions"&gt;
- &lt;definition id="com.example.parts.activeProblemsView"&gt;
- &lt;with variable="activePartId"&gt;
- &lt;equals value="org.eclipse.ui.views.ProblemsView"/&gt;
- &lt;/with&gt;
- &lt;/definition&gt;
- &lt;definition id="com.example.markers.markerSelection"&gt;
- &lt;iterate&gt;
- &lt;instanceof value="org.eclipse.core.resources.IMarker"/&gt;
- &lt;/with&gt;
- &lt;/definition&gt;
-&lt;/extension&gt;
-</pre>
-</p>
-<p>
-Then this expression definition can be used when composing other expressions.
-</p>
-<p>
-<pre>
-&lt;enabledWhen&gt;
- &lt;reference definitionId="com.example.parts.activeProblemsView"&gt;
-&lt;/enabledWhen&gt;
-</pre>
-<pre>
-&lt;visibleWhen&gt;
- &lt;and&gt;
- &lt;reference definitionId="com.example.parts.activeProblemsView"/&gt;
- &lt;reference definitionId="com.example.markers.markerSelection"/&gt;
- &lt;/and&gt;
-&lt;/visibleWhen&gt;
-</pre>
-</p>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.3
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2007 IBM Corporation and others.<br>
-All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.core.expressions/schema/expressionLanguage.exsd b/bundles/org.eclipse.core.expressions/schema/expressionLanguage.exsd
deleted file mode 100644
index 3436ff8..0000000
--- a/bundles/org.eclipse.core.expressions/schema/expressionLanguage.exsd
+++ /dev/null
@@ -1,515 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.core.expressions" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.eclipse.core.expressions" id="commonExpression" name="Common Expressions"/>
- </appinfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <element name="enablement">
- <annotation>
- <documentation>
- A generic root element. The element can be used inside an extension point to define its enablement expression.
- The children of an enablement expression are combined using the and operator.
- </documentation>
- </annotation>
- <complexType>
- <sequence minOccurs="0" maxOccurs="unbounded">
- <element ref="not"/>
- <element ref="and"/>
- <element ref="or"/>
- <element ref="instanceof"/>
- <element ref="test"/>
- <element ref="systemTest"/>
- <element ref="equals"/>
- <element ref="count"/>
- <element ref="with"/>
- <element ref="resolve"/>
- <element ref="adapt"/>
- <element ref="iterate"/>
- <element ref="reference"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="not">
- <annotation>
- <documentation>
- This element represent a NOT operation on the result of evaluating it's sub-element expression.
- </documentation>
- </annotation>
- <complexType>
- <choice>
- <element ref="not"/>
- <element ref="and"/>
- <element ref="or"/>
- <element ref="instanceof"/>
- <element ref="test"/>
- <element ref="systemTest"/>
- <element ref="equals"/>
- <element ref="count"/>
- <element ref="with"/>
- <element ref="resolve"/>
- <element ref="adapt"/>
- <element ref="iterate"/>
- <element ref="reference"/>
- </choice>
- </complexType>
- </element>
-
- <element name="and">
- <annotation>
- <documentation>
- This element represent an AND operation on the result of evaluating all it's sub-elements expressions.
- </documentation>
- </annotation>
- <complexType>
- <sequence minOccurs="0" maxOccurs="unbounded">
- <element ref="not"/>
- <element ref="and"/>
- <element ref="or"/>
- <element ref="instanceof"/>
- <element ref="test"/>
- <element ref="systemTest"/>
- <element ref="equals"/>
- <element ref="count"/>
- <element ref="with"/>
- <element ref="resolve"/>
- <element ref="adapt"/>
- <element ref="iterate"/>
- <element ref="reference"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="or">
- <annotation>
- <documentation>
- This element represent an OR operation on the result of evaluating all it's sub-element expressions.
- </documentation>
- </annotation>
- <complexType>
- <sequence minOccurs="0" maxOccurs="unbounded">
- <element ref="not"/>
- <element ref="and"/>
- <element ref="or"/>
- <element ref="instanceof"/>
- <element ref="test"/>
- <element ref="systemTest"/>
- <element ref="equals"/>
- <element ref="count"/>
- <element ref="with"/>
- <element ref="resolve"/>
- <element ref="adapt"/>
- <element ref="iterate"/>
- <element ref="reference"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="instanceof">
- <annotation>
- <appinfo>
- <meta.element labelAttribute="value"/>
- </appinfo>
- <documentation>
- This element is used to perform an instanceof check of the object in focus. The expression returns
- EvaluationResult.TRUE if the object's type is a sub type of the type specified by the attribute value.
- Otherwise EvaluationResult.FALSE is returned.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="value" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified name of a class or interface.
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn="java.lang.Object"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="test">
- <annotation>
- <appinfo>
- <meta.element labelAttribute="property"/>
- </appinfo>
- <documentation>
- This element is used to evaluate the property state of the object in focus. The set of
- testable properties can be extended using the propery tester extension point. The test
- expression returns EvaluationResult.NOT_LOADED if the property tester doing the actual
- testing isn't loaded yet and the attribute forcePluginActivation is set to false.
- If forcePluginActivation is set to true and the evaluation context used to evaluate
- this expression support plug-in activation then evaluating the property will result in
- activating the plug-in defining the tester.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="property" type="string" use="required">
- <annotation>
- <documentation>
- the name of an object's property to test.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="args" type="string">
- <annotation>
- <documentation>
- additional arguments passed to the property tester. Multiple arguments are seperated
- by commas. Each individual argument is converted into a Java base type using the same
- rules as defined for the value attribute of the test expression.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="value" type="string">
- <annotation>
- <documentation>
- the expected value of the property. Can be omitted if the property
- is a boolean property. The test expression is supposed to return
-EvaluationResult.TRUE if the property matches the value and EvaluationResult.FALSE
-otherwise. The value attribute is converted into a Java base type using the following
-rules:
-<ul>
- <li>the string &quot;true&quot; is converted into Boolean.TRUE</li>
- <li>the string &quot;false&quot; is converted into Boolean.FALSE</li>
- <li>if the string contains a dot then the interpreter tries to convert
- the value into a Float object. If this fails the string is treated as a
- java.lang.String</li>
- <li>if the string only consists of numbers then the interpreter
- converts the value in an Integer object.</li>
- <li>in all other cases the string is treated as a java.lang.String</li>
- <li>the conversion of the string into a Boolean, Float, or Integer can
- be suppressed by surrounding the string with single quotes. For
- example, the attribute value=&quot;'true'&quot; is converted into the
- string &quot;true&quot;</li>
-</ul>
- </documentation>
- </annotation>
- </attribute>
- <attribute name="forcePluginActivation" type="boolean">
- <annotation>
- <documentation>
- a flag indicating whether the plug-in contributing the property tester
- should be loaded if necessary. As such, this flag should be used judiciously,
- in order to avoid unnecessary plug-in activations. Most clients should avoid
- setting this flag to true. This flag is only honored if the evaluation context
- used to evaluate this expression allows plug-in activation. Otherwise the flag
- is ignored and no plug-in loading takes place.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="systemTest">
- <annotation>
- <appinfo>
- <meta.element labelAttribute="value"/>
- </appinfo>
- <documentation>
- Tests a system property by calling the System.getProperty method and compares the result
- with the value specified through the value attribute.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="property" type="string" use="required">
- <annotation>
- <documentation>
- the name of an system property to test.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="value" type="string" use="required">
- <annotation>
- <documentation>
- the expected value of the property. The value is interpreted as a string value.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="equals">
- <annotation>
- <appinfo>
- <meta.element labelAttribute="value"/>
- </appinfo>
- <documentation>
- This element is used to perform an equals check of the object in focus. The expression returns
- EvaluationResult.TRUE if the object is equal to the value provided by the attribute value. Otherwise
- EvaluationResult.FALSE is returned.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="value" type="string" use="required">
- <annotation>
- <documentation>
- the expected value. The value provided as a string is converted into
- a Java base type using the same rules as for the value attribute of the test expression.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="count">
- <annotation>
- <documentation>
- This element is used to test the number of elements in a collection.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="value" type="string" use="required">
- <annotation>
- <documentation>
- an expression to specify the number of elements in a list. Following wildcard
- characters can be used:
- <dl>
- <dt>*</dt> <dd>any number of elements</dd>
- <dt>?</dt> <dd>no elements or one element</dd>
- <dt>+</dt> <dd>one or more elements</dd>
- <dt>!</dt> <dd>no elements</dd>
- <dt>integer value</dt> <dd>the list must contain the exact number of elements</dd>
- </dl>
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="with">
- <annotation>
- <appinfo>
- <meta.element labelAttribute="variable"/>
- </appinfo>
- <documentation>
- This element changes the object to be inspected for all its child element to the object
- referenced by the given variable. If the variable can not be resolved then the expression
- will throw a ExpressionException when evaluating it. The children of a with expression
- are combined using the and operator.
- </documentation>
- </annotation>
- <complexType>
- <sequence minOccurs="0" maxOccurs="unbounded">
- <element ref="not"/>
- <element ref="and"/>
- <element ref="or"/>
- <element ref="instanceof"/>
- <element ref="test"/>
- <element ref="systemTest"/>
- <element ref="equals"/>
- <element ref="count"/>
- <element ref="with"/>
- <element ref="resolve"/>
- <element ref="adapt"/>
- <element ref="iterate"/>
- <element ref="reference"/>
- </sequence>
- <attribute name="variable" type="string" use="required">
- <annotation>
- <documentation>
- the name of the variable to be used for further inspection. It is up to the evaluator
- of an extension point to provide the variable in the variable pool.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="resolve">
- <annotation>
- <appinfo>
- <meta.element labelAttribute="variable"/>
- </appinfo>
- <documentation>
- This element changes the object to be inspected for all its child element to the object
- referenced by the given variable. If the variable can not be resolved then the expression
- will throw a ExpressionException when evaluating it. The children of a with expression
- are combined using the and operator.
- </documentation>
- </annotation>
- <complexType>
- <sequence minOccurs="0" maxOccurs="unbounded">
- <element ref="not"/>
- <element ref="and"/>
- <element ref="or"/>
- <element ref="instanceof"/>
- <element ref="test"/>
- <element ref="systemTest"/>
- <element ref="equals"/>
- <element ref="count"/>
- <element ref="with"/>
- <element ref="resolve"/>
- <element ref="adapt"/>
- <element ref="iterate"/>
- <element ref="reference"/>
- </sequence>
- <attribute name="variable" type="string" use="required">
- <annotation>
- <documentation>
- the name of the variable to be resolved. This variable is then used as the object in focus
- for child element evaluation. It is up to the evaluator of an extension point to provide a
- corresponding variable resolver (see IVariableResolver) through the evaluation context passed
- to the root expression element when evaluating the expression.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="args" type="string">
- <annotation>
- <documentation>
- additional arguments passed to the variable resolver. Multiple arguments are seperated
- by commas. Each individual argument is converted into a Java base type using the same
- rules as defined for the value attribute of the test expression.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="adapt">
- <annotation>
- <appinfo>
- <meta.element labelAttribute="type"/>
- </appinfo>
- <documentation>
- This element is used to adapt the object in focus to the type specified by the attribute
- type. The expression returns not loaded if either the adapter or the type referenced isn't
- loaded yet. It throws a ExpressionException during evaluation if the type name doesn't exist
- at all. The children of an adapt expression are combined using the and operator.
- </documentation>
- </annotation>
- <complexType>
- <sequence minOccurs="0" maxOccurs="unbounded">
- <element ref="not"/>
- <element ref="and"/>
- <element ref="or"/>
- <element ref="instanceof"/>
- <element ref="test"/>
- <element ref="systemTest"/>
- <element ref="equals"/>
- <element ref="count"/>
- <element ref="with"/>
- <element ref="resolve"/>
- <element ref="adapt"/>
- <element ref="iterate"/>
- <element ref="reference"/>
- </sequence>
- <attribute name="type" type="string" use="required">
- <annotation>
- <documentation>
- the type to which the object in focus is to be adapted.
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn="java.lang.Object"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="iterate">
- <annotation>
- <documentation>
- This element is used to iterate over a variable that is of type java.util.Collection. If
- the object in focus is not of type java.util.Collection then an ExpressionException will
- be thrown while evaluating the expression.
- </documentation>
- </annotation>
- <complexType>
- <sequence minOccurs="0" maxOccurs="unbounded">
- <element ref="not"/>
- <element ref="and"/>
- <element ref="or"/>
- <element ref="instanceof"/>
- <element ref="test"/>
- <element ref="systemTest"/>
- <element ref="equals"/>
- <element ref="count"/>
- <element ref="with"/>
- <element ref="resolve"/>
- <element ref="adapt"/>
- <element ref="iterate"/>
- <element ref="reference"/>
- </sequence>
- <attribute name="operator">
- <annotation>
- <documentation>
- either "and" or "or". The operator defines how the child
- elements will be combined. If not specified, "and" will be used.
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="or">
- </enumeration>
- <enumeration value="and">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- <attribute name="ifEmpty" type="boolean">
- <annotation>
- <documentation>
- the value return from the iterate expression if the collection is empty. If
- not specified then true is returned when the operator equals "and"
- and false is return if the operator equals "or".
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="reference">
- <annotation>
- <appinfo>
- <meta.element labelAttribute="definitionId"/>
- </appinfo>
- <documentation>
- This element is used to reference an expression from the <b>org.eclipse.core.expressions.definitions</b> extension point. The expression definition will be evaluated within the current expression element using the current evaluation context.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="definitionId" type="string" use="required">
- <annotation>
- <documentation>
- The unique id of an expression from <b>org.eclipse.core.expressions.definitions</b>.
- </documentation>
- <appinfo>
- <meta.attribute kind="identifier" basedOn="org.eclipse.core.expressions.definitions/definition/@id"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- Release 3.0
- </documentation>
- </annotation>
-
-
-
-
-
- <annotation>
- <appinfo>
- <meta.section type="copyright"/>
- </appinfo>
- <documentation>
- Copyright (c) 2001, 2008 IBM Corporation and others.<br>
-All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.core.expressions/schema/propertyTesters.exsd b/bundles/org.eclipse.core.expressions/schema/propertyTesters.exsd
deleted file mode 100644
index 0438e6a..0000000
--- a/bundles/org.eclipse.core.expressions/schema/propertyTesters.exsd
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.core.expressions">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.core.expressions" id="propertyTesters" name="Property Testers"/>
- </appInfo>
- <documentation>
- This extension point allows to add properties to an already existing type. Those
- properties can then be used inside the expression language's test expression
- element.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="propertyTester" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="propertyTester">
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- unique identifier for the property tester
- </documentation>
- </annotation>
- </attribute>
- <attribute name="type" type="string" use="required">
- <annotation>
- <documentation>
- the type to be extended by this property tester
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="namespace" type="string" use="required">
- <annotation>
- <documentation>
- a unique id determining the name space the properties are added to
- </documentation>
- </annotation>
- </attribute>
- <attribute name="properties" type="string" use="required">
- <annotation>
- <documentation>
- a comma separated list of properties provided by this property tester
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- the name of the class that implements the testing methods. The class must be public and extend
-<samp>org.eclipse.core.expressions.PropertyTester</samp> with a public 0-argument constructor.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.core.expressions.PropertyTester"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a property tester contribution:
-
-<p>
-<pre>
- <extension point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- id="org.eclipse.jdt.ui.IResourceTester"
- type="org.eclipse.core.resources.IResource"
- namespace="org.eclipse.jdt.ui"
- properties="canDelete"
- class="org.eclipse.jdt.ui.internal.ResourceTester">
- </propertyTester>
- </extension>
-</pre>
-</p>
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- The contributed class must extend <code>org.eclipse.core.expressions.PropertyTester</code>
- </documentation>
- </annotation>
-
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2001, 2004 IBM Corporation and others.<br>
-All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.core.expressions/scripts/exportplugin.xml b/bundles/org.eclipse.core.expressions/scripts/exportplugin.xml
deleted file mode 100644
index 709d3cc..0000000
--- a/bundles/org.eclipse.core.expressions/scripts/exportplugin.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<project name="org.eclipse.jdt.ui" default="export" basedir="..">
-<!-- build script to create a plugin from org.eclipse.core.expressions -->
-
- <target name="init">
- <tstamp/>
- <property name="destdir" value="../../plugin-export" />
- <property name="plugin" value="org.eclipse.core.expressions" />
- <property name="qualifier" value="zzz${DSTAMP}-${TSTAMP}" />
-
- <!-- define property ${plugin_version} by reading version from MANIFEST.MF: -->
- <tempfile property="plugin_version_file" suffix=".plugin_version.tmp" destdir="${destdir}"/>
- <copy file="META-INF/MANIFEST.MF" tofile="${plugin_version_file}"/>
- <replaceregexp file="${plugin_version_file}" match=".*Bundle-Version: ((\d)+\.(\d)+\.(\d)+\.)qualifier.*" replace="plugin_version=_\1${qualifier}" flags="s" />
- <property file="${plugin_version_file}"/>
- <delete file="${plugin_version_file}" />
-
- <property name="dest" value="${destdir}/${plugin}${plugin_version}" />
- <property name="destjar" value="${destdir}/${plugin}${plugin_version}.jar" />
- </target>
-
- <target name="build" depends="init">
- <eclipse.incrementalBuild project="${plugin}" kind="incr"/>
- </target>
-
- <target name="export" depends="build">
- <mkdir dir="${destdir}" />
- <delete dir="${dest}" />
- <mkdir dir="${dest}" />
-
- <copy todir="${dest}/META-INF">
- <fileset dir="META-INF" />
- </copy>
-
- <replaceregexp file="${dest}/META-INF/MANIFEST.MF" match="Bundle-Version: ((\d)+\.(\d)+\.(\d)+\.)qualifier" replace="Bundle-Version: \1${qualifier}" byline="true" />
-
- <delete file="${destjar}" />
- <zip zipfile="${destjar}">
- <fileset dir=".">
- <include name="plugin.xml" />
- <include name="plugin.properties" />
- <include name=".options" />
- <include name="schema/**" />
- <include name="src/**" />
- </fileset>
- <fileset dir="bin" />
- <fileset dir="${dest}">
- <include name="META-INF/**" />
- </fileset>
- </zip>
-
- <delete dir="${dest}" />
-
- </target>
-</project>
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ElementHandler.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ElementHandler.java
deleted file mode 100644
index 3ac5cc2..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ElementHandler.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-import org.w3c.dom.Element;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.core.internal.expressions.CompositeExpression;
-import org.eclipse.core.internal.expressions.ExpressionMessages;
-import org.eclipse.core.internal.expressions.ExpressionPlugin;
-import org.eclipse.core.internal.expressions.StandardElementHandler;
-
-
-/**
- * An element handler converts an {@link IConfigurationElement} into a
- * corresponding expression object.
- * <p>
- * The class should be subclassed by clients wishing to provide an element
- * handler for special expressions.
- * </p>
- * @since 3.0
- */
-public abstract class ElementHandler {
-
- private static final ElementHandler INSTANCE= new StandardElementHandler();
-
- /**
- * The default element handler which can cope with all XML expression elements
- * defined by the common expression language.
- *
- * @return the default element handler
- */
- public static ElementHandler getDefault() {
- return INSTANCE;
- }
-
- /**
- * Creates the corresponding expression for the given configuration element.
- *
- * @param converter the expression converter used to initiate the
- * conversion process
- *
- * @param config the configuration element to convert
- *
- * @return the corresponding expression
- *
- * @throws CoreException if the conversion failed
- */
- public abstract Expression create(ExpressionConverter converter, IConfigurationElement config) throws CoreException;
-
- /**
- * Creates the corresponding expression for the given DOM element. This is
- * an optional operation that is only required if the handler supports conversion
- * of DOM elements.
- *
- * @param converter the expression converter used to initiate the
- * conversion process
- *
- * @param element the DOM element to convert
- *
- * @return the corresponding expression
- *
- * @throws CoreException if the conversion failed
- *
- * @since 3.3
- */
- public Expression create(ExpressionConverter converter, Element element) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, ExpressionPlugin.getPluginId(),
- IStatus.ERROR,
- ExpressionMessages.ElementHandler_unsupported_element,
- null));
- }
-
- /**
- * Converts the children of the given configuration element and adds them
- * to the given composite expression.
- * <p>
- * Note this is an internal method and should not be called by clients.
- * </p>
- * @param converter the converter used to do the actual conversion
- * @param element the configuration element for which the children
- * are to be processed
- * @param expression the composite expression representing the result
- * of the conversion
- *
- * @throws CoreException if the conversion failed
- *
- * @noreference This method is not intended to be referenced by clients.
- */
- protected void processChildren(ExpressionConverter converter, IConfigurationElement element, CompositeExpression expression) throws CoreException {
- converter.processChildren(element, expression);
- }
-
- /**
- * Converts the children of the given DOM element and adds them to the
- * given composite expression.
- * <p>
- * Note this is an internal method and should not be called by clients.
- * </p>
- * @param converter the converter used to do the actual conversion
- * @param element the DOM element for which the children are to be processed
- * @param expression the composite expression representing the result
- * of the conversion
- *
- * @throws CoreException if the conversion failed
- *
- * @since 3.3
- *
- * @noreference This method is not intended to be referenced by clients.
- */
- protected void processChildren(ExpressionConverter converter, Element element, CompositeExpression expression) throws CoreException {
- converter.processChildren(element, expression);
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationContext.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationContext.java
deleted file mode 100644
index 08aa5fc..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationContext.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * A default implementation of an evaluation context.
- * <p>
- * Clients may instantiate this default context. The class is
- * not intended to be subclassed by clients.
- * </p>
- *
- * @since 3.0
- *
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class EvaluationContext implements IEvaluationContext {
-
- private IEvaluationContext fParent;
- private Object fDefaultVariable;
- private Map/*<String, Object>*/ fVariables;
- private IVariableResolver[] fVariableResolvers;
- private Boolean fAllowPluginActivation;
-
- /**
- * Create a new evaluation context with the given parent and default
- * variable.
- *
- * @param parent the parent context. Can be <code>null</code>.
- * @param defaultVariable the default variable
- */
- public EvaluationContext(IEvaluationContext parent, Object defaultVariable) {
- Assert.isNotNull(defaultVariable);
- fParent= parent;
- fDefaultVariable= defaultVariable;
- }
-
- /**
- * Create a new evaluation context with the given parent and default
- * variable.
- *
- * @param parent the parent context. Can be <code>null</code>.
- * @param defaultVariable the default variable
- * @param resolvers an array of <code>IVariableResolvers</code> to
- * resolve additional variables.
- *
- * @see #resolveVariable(String, Object[])
- */
- public EvaluationContext(IEvaluationContext parent, Object defaultVariable, IVariableResolver[] resolvers) {
- Assert.isNotNull(defaultVariable);
- Assert.isNotNull(resolvers);
- fParent= parent;
- fDefaultVariable= defaultVariable;
- fVariableResolvers= resolvers;
- }
-
- /**
- * {@inheritDoc}
- */
- public IEvaluationContext getParent() {
- return fParent;
- }
-
- /**
- * {@inheritDoc}
- */
- public IEvaluationContext getRoot() {
- if (fParent == null)
- return this;
- return fParent.getRoot();
- }
-
- /**
- * {@inheritDoc}
- */
- public Object getDefaultVariable() {
- return fDefaultVariable;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setAllowPluginActivation(boolean value) {
- fAllowPluginActivation= value ? Boolean.TRUE : Boolean.FALSE;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean getAllowPluginActivation() {
- if (fAllowPluginActivation == null) {
- if (fParent != null)
- return fParent.getAllowPluginActivation();
- return false;
- }
- return fAllowPluginActivation.booleanValue();
- }
-
- /**
- * {@inheritDoc}
- */
- public void addVariable(String name, Object value) {
- Assert.isNotNull(name);
- Assert.isNotNull(value);
- if (fVariables == null)
- fVariables= new HashMap();
- fVariables.put(name, value);
- }
-
- /**
- * {@inheritDoc}
- */
- public Object removeVariable(String name) {
- Assert.isNotNull(name);
- if (fVariables == null)
- return null;
- return fVariables.remove(name);
- }
-
- /**
- * {@inheritDoc}
- */
- public Object getVariable(String name) {
- Assert.isNotNull(name);
- Object result= null;
- if (fVariables != null) {
- result= fVariables.get(name);
- }
- if (result != null)
- return result;
- if (fParent != null)
- return fParent.getVariable(name);
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public Object resolveVariable(String name, Object[] args) throws CoreException {
- if (fVariableResolvers != null && fVariableResolvers.length > 0) {
- for (int i= 0; i < fVariableResolvers.length; i++) {
- IVariableResolver resolver= fVariableResolvers[i];
- Object variable= resolver.resolve(name, args);
- if (variable != null)
- return variable;
- }
- }
- if (fParent != null)
- return fParent.resolveVariable(name, args);
- return null;
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationResult.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationResult.java
deleted file mode 100644
index f561c9b..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationResult.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-import org.eclipse.core.runtime.Assert;
-
-/**
- * An evaluation result represents the result of an expression
- * evaluation. There are exact three instances of evaluation
- * result. They are: <code>FALSE</code>, <code>TRUE</code> and
- * <code>NOT_LOADED</code>. <code>NOT_LOADED</code> represents
- * the fact that an expression couldn't be evaluated since a
- * plug-in providing certain test expressions isn't loaded yet.
- * <p>
- * In addition the class implements the three operation <code>and
- * </code>, <code>or</code> and <code>not</code>. The operation are
- * defined as follows:
- * </p>
- * <p>
- * The and operation:
- * </p>
- * <table border="1" cellpadding="5">
- * <colgroup>
- * <col width="120">
- * <col width="120">
- * <col width="120">
- * <col width="120">
- * </colgroup>
- * <tbody>
- * <tr>
- * <td><em>AND</em></td>
- * <td>FALSE</td>
- * <td>TRUE</td>
- * <td>NOT_LOADED</td>
- * </tr>
- * <tr>
- * <td>FALSE</td>
- * <td>FALSE</td>
- * <td>FALSE</td>
- * <td>FALSE</td>
- * </tr>
- * <tr>
- * <td>TRUE</td>
- * <td>FALSE</td>
- * <td>TRUE</td>
- * <td>NOT_LOADED</td>
- * </tr>
- * <tr>
- * <td>NOT_LOADED</td>
- * <td>FALSE</td>
- * <td>NOT_LOADED</td>
- * <td>NOT_LOADED</td>
- * </tr>
- * </tbody>
- * </table>
- * <p>
- * The or operation:
- * </p>
- * <table border="1" cellpadding="5">
- * <colgroup>
- * <col width="120">
- * <col width="120">
- * <col width="120">
- * <col width="120">
- * </colgroup>
- * <tbody>
- * <tr>
- * <td><em>OR</em></td>
- * <td>FALSE</td>
- * <td>TRUE</td>
- * <td>NOT_LOADED</td>
- * </tr>
- * <tr>
- * <td>FALSE</td>
- * <td>FALSE</td>
- * <td>TRUE</td>
- * <td>NOT_LOADED</td>
- * </tr>
- * <tr>
- * <td>TRUE</td>
- * <td>TRUE</td>
- * <td>TRUE</td>
- * <td>TRUE</td>
- * </tr>
- * <tr>
- * <td>NOT_LOADED</td>
- * <td>NOT_LOADED</td>
- * <td>TRUE</td>
- * <td>NOT_LOADED</td>
- * </tr>
- * </tbody>
- * </table>
- * <p>
- * The not operation:
- * </p>
- * <table border="1" cellpadding="5">
- * <colgroup>
- * <col width="120">
- * <col width="120">
- * <col width="120">
- * <col width="120">
- * </colgroup>
- * <tbody>
- * <tr>
- * <td><em>NOT<em></td>
- * <td>FALSE</td>
- * <td>TRUE</td>
- * <td>NOT_LOADED</td>
- * </tr>
- * <tr>
- * <td></td>
- * <td>TRUE</td>
- * <td>FALSE</td>
- * <td>NOT_LOADED</td>
- * </tr>
- * </tbody>
- * </table>
- *
- * <p>
- * The class is not intended to be subclassed by clients.
- * </p>
- * @since 3.0
- *
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class EvaluationResult {
-
- private int fValue;
-
- private static final int FALSE_VALUE= 0;
- private static final int TRUE_VALUE= 1;
- private static final int NOT_LOADED_VALUE= 2;
-
- /** The evaluation result representing the value FALSE */
- public static final EvaluationResult FALSE= new EvaluationResult(FALSE_VALUE);
- /** The evaluation result representing the value TRUE */
- public static final EvaluationResult TRUE= new EvaluationResult(TRUE_VALUE);
- /** The evaluation result representing the value NOT_LOADED */
- public static final EvaluationResult NOT_LOADED= new EvaluationResult(NOT_LOADED_VALUE);
-
- private static final EvaluationResult[][] AND= new EvaluationResult[][] {
- // FALSE //TRUE //NOT_LOADED
- /* FALSE */ { FALSE, FALSE, FALSE },
- /* TRUE */ { FALSE, TRUE, NOT_LOADED },
- /* PNL */ { FALSE, NOT_LOADED, NOT_LOADED },
- };
-
- private static final EvaluationResult[][] OR= new EvaluationResult[][] {
- // FALSE //TRUE //NOT_LOADED
- /* FALSE */ { FALSE, TRUE, NOT_LOADED },
- /* TRUE */ { TRUE, TRUE, TRUE },
- /* PNL */ { NOT_LOADED, TRUE, NOT_LOADED },
- };
-
- private static final EvaluationResult[] NOT= new EvaluationResult[] {
- //FALSE //TRUE //NOT_LOADED
- TRUE, FALSE, NOT_LOADED
- };
-
- /*
- * No instances outside of <code>EvaluationResult</code>
- */
- private EvaluationResult(int value) {
- fValue= value;
- }
-
- /**
- * Returns an <code>EvaluationResult</code> whose value is <code>this && other)</code>.
- *
- * @param other the right hand side of the and operation.
- *
- * @return <code>this && other</code> as defined by the evaluation result
- */
- public EvaluationResult and(EvaluationResult other) {
- return AND[fValue][other.fValue];
- }
-
- /**
- * Returns an <code>EvaluationResult</code> whose value is <code>this || other)</code>.
- *
- * @param other the right hand side of the or operation.
- *
- * @return <code>this || other</code> as defined by the evaluation result
- */
- public EvaluationResult or(EvaluationResult other) {
- return OR[fValue][other.fValue];
- }
-
- /**
- * Returns the inverted value of this evaluation result
- *
- * @return the inverted value of this evaluation result
- */
- public EvaluationResult not() {
- return NOT[fValue];
- }
-
- /**
- * Returns an evaluation result instance representing the
- * given boolean value. If the given boolean value is
- * <code>true</code> then <code>ExpressionResult.TRUE</code>
- * is returned. If the value is <code>false</code> then <code>
- * ExpressionResult.FALSE</code> is returned.
- *
- * @param b a boolean value
- *
- * @return the expression result representing the boolean
- * value
- */
- public static EvaluationResult valueOf(boolean b) {
- return b ? TRUE : FALSE;
- }
-
- /**
- * Returns a evaluation result instance representing the
- * given <code>Boolean</code> value. If the given <code>Boolean
- * </code> value is <code>true</code> then <code>ExpressionResult.TRUE</code>
- * is returned. If the value is <code>false</code> then <code>
- * ExpressionResult.FALSE</code> is returned.
- *
- * @param b a <code>Boolean</code> value
- *
- * @return the expression result representing the <code>Boolean</code>
- * value
- */
- public static EvaluationResult valueOf(Boolean b) {
- return b.booleanValue() ? TRUE : FALSE;
- }
-
- /**
- * For debugging purpose only
- *
- * @return a string representing this object. The result is not
- * human readable
- */
- public String toString() {
- switch (fValue) {
- case 0:
- return "false"; //$NON-NLS-1$
- case 1:
- return "true"; //$NON-NLS-1$
- case 2:
- return "not_loaded"; //$NON-NLS-1$
- }
- Assert.isTrue(false);
- return null;
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/Expression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/Expression.java
deleted file mode 100644
index 132e0d7..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/Expression.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * Abstract base class for all expressions provided by the common
- * expression language.
- * <p>
- * An expression is evaluated by calling {@link #evaluate(IEvaluationContext)}.
- * </p>
- * <p>
- * This class may be subclassed to provide specific expressions.
- * </p>
- *
- * @since 3.0
- */
-public abstract class Expression {
-
- /**
- * Checks whether two objects are equal using the
- * <code>equals(Object)</code> method of the <code>left</code> object.
- * This method handles <code>null</code> for either the <code>left</code>
- * or <code>right</code> object.
- *
- * @param left the first object to compare; may be <code>null</code>.
- * @param right the second object to compare; may be <code>null</code>.
- * @return <code>true</code> if the two objects are equivalent;
- * <code>false</code> otherwise.
- *
- * @since 3.2
- */
- protected static final boolean equals(final Object left, final Object right) {
- return left == null ? right == null : ((right != null) && left
- .equals(right));
- }
-
- /**
- * Tests whether two arrays of objects are equal to each other. The arrays
- * must not be <code>null</code>, but their elements may be
- * <code>null</code>.
- *
- * @param leftArray the left array to compare; may be <code>null</code>, and
- * may be empty and may contain <code>null</code> elements.
- * @param rightArray the right array to compare; may be <code>null</code>,
- * and may be empty and may contain <code>null</code> elements.
- *
- * @return <code>true</code> if the arrays are equal length and the elements
- * at the same position are equal; <code>false</code> otherwise.
- *
- * @since 3.2
- */
- protected static final boolean equals(final Object[] leftArray, final Object[] rightArray) {
- if (leftArray == rightArray) {
- return true;
- }
-
- if (leftArray == null) {
- return (rightArray == null);
- } else if (rightArray == null) {
- return false;
- }
-
- if (leftArray.length != rightArray.length) {
- return false;
- }
-
- for (int i= 0; i < leftArray.length; i++) {
- final Object left= leftArray[i];
- final Object right= rightArray[i];
- final boolean equal= (left == null) ? (right == null) : (left.equals(right));
- if (!equal) {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * Returns the hash code for the given <code>object</code>. This method
- * handles <code>null</code>.
- *
- * @param object the object for which the hash code is desired; may be
- * <code>null</code>.
- *
- * @return The hash code of the object; zero if the object is
- * <code>null</code>.
- *
- * @since 3.2
- */
- protected static final int hashCode(final Object object) {
- return object != null ? object.hashCode() : 0;
- }
-
- /**
- * Returns the hash code for the given array. This method handles
- * <code>null</code>.
- *
- * @param array the array for which the hash code is desired; may be
- * <code>null</code>.
- * @return the hash code of the array; zero if the object is
- * <code>null</code>.
- *
- * @since 3.2
- */
- protected static final int hashCode(final Object[] array) {
- if (array == null) {
- return 0;
- }
- int hashCode= array.getClass().getName().hashCode();
- for (int i= 0; i < array.length; i++) {
- hashCode= hashCode * HASH_FACTOR + hashCode(array[i]);
- }
- return hashCode;
- }
-
- /**
- * The constant integer hash code value meaning the hash code has not yet
- * been computed.
- */
- protected static final int HASH_CODE_NOT_COMPUTED = -1;
-
- /**
- * A factor for computing the hash code for all expressions.
- */
- protected static final int HASH_FACTOR = 89;
-
- /**
- * Name of the value attribute of an expression (value is <code>value</code>).
- */
- protected static final String ATT_VALUE= "value"; //$NON-NLS-1$
-
- /**
- * The expression corresponding to {@link EvaluationResult#TRUE}.
- */
- public static final Expression TRUE= new Expression() {
- public EvaluationResult evaluate(IEvaluationContext context) {
- return EvaluationResult.TRUE;
- }
- public void collectExpressionInfo(ExpressionInfo info) {
- }
- };
-
- /**
- * The expression corresponding to {@link EvaluationResult#FALSE}.
- */
- public static final Expression FALSE= new Expression() {
- public EvaluationResult evaluate(IEvaluationContext context) {
- return EvaluationResult.FALSE;
- }
- public void collectExpressionInfo(ExpressionInfo info) {
- }
- };
-
- /**
- * The hash code for this object. This value is computed lazily. If it is
- * not yet computed, it is equal to {@link #HASH_CODE_NOT_COMPUTED}.
- */
- private transient int fHashCode= HASH_CODE_NOT_COMPUTED;
-
- /**
- * Evaluates this expression.
- *
- * @param context an evaluation context providing information like variable,
- * name spaces, etc. necessary to evaluate this expression
- *
- * @return the result of the expression evaluation
- *
- * @throws CoreException if the evaluation failed. The concrete reason is
- * defined by the subclass implementing this method
- */
- public abstract EvaluationResult evaluate(IEvaluationContext context) throws CoreException;
-
- /**
- * Computes the expression information for the given expression tree.
- * <p>
- * This is a convenience method for collecting the expression information
- * using {@link Expression#collectExpressionInfo(ExpressionInfo)}.
- * </p>
- *
- * @return the expression information
- *
- * @since 3.2
- */
- public final ExpressionInfo computeExpressionInfo() {
- ExpressionInfo result= new ExpressionInfo();
- collectExpressionInfo(result);
- return result;
- }
-
- /**
- * Collects information about this expression tree. This default
- * implementation add the expression's type to the set of misbehaving
- * expression types.
- *
- * @param info the expression information object used
- * to collect the information
- *
- * @since 3.2
- */
- public void collectExpressionInfo(ExpressionInfo info) {
- info.addMisBehavingExpressionType(getClass());
- }
-
- /**
- * Method to compute the hash code for this object. The result
- * returned from this method in cached in the <code>fHashCode</code>
- * field. If the value returned from the method equals {@link #HASH_CODE_NOT_COMPUTED}
- * (e.g. <code>-1</code>) then the value is incremented by one.
- * <p>
- * This default implementation calls <code>super.hashCode()</code>
- * </p>
- * @return a hash code for this object.
- *
- * @since 3.2
- */
- protected int computeHashCode() {
- return super.hashCode();
- }
-
- /**
- * {@inheritDoc}
- */
- public int hashCode() {
- if (fHashCode != HASH_CODE_NOT_COMPUTED)
- return fHashCode;
- fHashCode= computeHashCode();
- if (fHashCode == HASH_CODE_NOT_COMPUTED)
- fHashCode++;
- return fHashCode;
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionConverter.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionConverter.java
deleted file mode 100644
index a0abdb3..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionConverter.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.core.internal.expressions.CompositeExpression;
-import org.eclipse.core.internal.expressions.ExpressionMessages;
-import org.eclipse.core.internal.expressions.ExpressionPlugin;
-import org.eclipse.core.internal.expressions.Messages;
-
-/**
- * An expression converter converts an XML expression represented by an
- * {@link IConfigurationElement} or {@link Element} (DOM) subtree into a
- * corresponding expression tree.
- *
- * <p>
- * An expression converter manages a list of {@link ElementHandler}s. Element
- * handlers are responsible to do the actual conversion. The element handlers
- * build a chain of responsibility.
- * </p>
- *
- * @since 3.0
- */
-public final class ExpressionConverter {
-
- private ElementHandler[] fHandlers;
- private static final ExpressionConverter INSTANCE= new ExpressionConverter(
- new ElementHandler[] { ElementHandler.getDefault() } );
-
- /**
- * Returns the default expression converter. The default expression converter
- * can cope with all expression elements defined by the common expression
- * language.
- *
- * @return the default expression converter
- */
- public static ExpressionConverter getDefault() {
- return INSTANCE;
- }
-
- /**
- * Creates a new expression converter with the given list of element
- * handlers. The element handlers build a chain of responsibility
- * meaning that the first handler in the list is first used to
- * convert the configuration element. If this handler isn't able
- * to convert the configuration element the next handler in the
- * array is used.
- *
- * @param handlers the array of element handlers
- */
- public ExpressionConverter(ElementHandler[] handlers) {
- Assert.isNotNull(handlers);
- fHandlers= handlers;
- }
-
- /**
- * Converts the tree of configuration elements represented by the given
- * root element and returns a corresponding expression tree.
- *
- * @param root the configuration element to be converted
- *
- * @return the corresponding expression tree or <code>null</code>
- * if the configuration element cannot be converted
- *
- * @throws CoreException if the configuration element can't be
- * converted. Reasons include: (a) no handler is available to
- * cope with a certain configuration element or (b) the XML
- * expression tree is malformed.
- */
- public Expression perform(IConfigurationElement root) throws CoreException {
- for (int i= 0; i < fHandlers.length; i++) {
- ElementHandler handler= fHandlers[i];
- Expression result= handler.create(this, root);
- if (result != null)
- return result;
- }
- return null;
- }
-
- /**
- * Converts the tree of DOM elements represented by the given
- * root element and returns a corresponding expression tree.
- *
- * @param root the element to be converted
- *
- * @return the corresponding expression tree or <code>null</code>
- * if the element cannot be converted
- *
- * @throws CoreException if the element can't be converted.
- * Reasons include: (a) no handler is available to cope with
- * a certain element or (b) the XML expression tree is malformed.
- *
- * @since 3.3
- */
- public Expression perform(Element root) throws CoreException {
- for (int i= 0; i < fHandlers.length; i++) {
- ElementHandler handler= fHandlers[i];
- Expression result= handler.create(this, root);
- if (result != null)
- return result;
- }
- return null;
- }
-
- /* package */ void processChildren(IConfigurationElement element, CompositeExpression result) throws CoreException {
- IConfigurationElement[] children= element.getChildren();
- if (children != null) {
- for (int i= 0; i < children.length; i++) {
- Expression child= perform(children[i]);
- if (child == null)
- throw new CoreException(new Status(IStatus.ERROR, ExpressionPlugin.getPluginId(),
- IStatus.ERROR,
- Messages.format(
- ExpressionMessages.Expression_unknown_element,
- getDebugPath(children[i])),
- null));
- result.add(child);
- }
- }
- }
-
- private String getDebugPath(IConfigurationElement configurationElement) {
- StringBuffer buf= new StringBuffer();
- buf.append(configurationElement.getName());
- Object parent= configurationElement.getParent();
- while (parent != null) {
- if (parent instanceof IConfigurationElement) {
- buf.append(" > "); //$NON-NLS-1$
- IConfigurationElement parent2= (IConfigurationElement) parent;
- buf.append(parent2.getName());
- parent= parent2.getParent();
- } else if (parent instanceof IExtension) {
- IExtension parent2= (IExtension) parent;
- buf.append(" : "); //$NON-NLS-1$
- buf.append(parent2.getExtensionPointUniqueIdentifier());
- buf.append(" @ "); //$NON-NLS-1$
- buf.append(parent2.getContributor().getName());
- parent= null;
- } else {
- parent= null;
- }
- }
- return buf.toString();
- }
-
- /* package */ void processChildren(Element element, CompositeExpression result) throws CoreException {
- Node child = element.getFirstChild();
- while (child != null) {
- if (child.getNodeType() == Node.ELEMENT_NODE) {
- Expression exp= perform((Element)child);
- if (exp == null)
- throw new CoreException(new Status(IStatus.ERROR, ExpressionPlugin.getPluginId(),
- IStatus.ERROR,
- Messages.format(
- ExpressionMessages.Expression_unknown_element,
- child.getNodeName()),
- null));
- result.add(exp);
- }
- child = child.getNextSibling();
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionInfo.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionInfo.java
deleted file mode 100644
index 8fb1971..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionInfo.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * A status object describing information about an expression tree.
- * This information can for example be used to decide whether an
- * expression tree has to be reevaluated if the value of some
- * variables changes.
- * <p>
- * This class is not intended to be extended by clients.
- * </p>
- *
- * @since 3.2
- *
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class ExpressionInfo {
-
- private boolean fHasDefaultVariableAccess;
- private boolean fHasSystemPropertyAccess;
-
- // Although we are using this as sets we use lists since
- // they are faster for smaller numbers of elements
- private List fAccessedVariableNames;
- private List fMisbehavingExpressionTypes;
- private List fAccessedPropertyNames;
-
- /**
- * Returns <code>true</code> if the default variable is accessed
- * by the expression tree.
- *
- * @return whether the default variable is accessed or not
- */
- public boolean hasDefaultVariableAccess() {
- return fHasDefaultVariableAccess;
- }
-
- /**
- * Marks the default variable as accessed.
- */
- public void markDefaultVariableAccessed() {
- fHasDefaultVariableAccess= true;
- }
-
- /**
- * Returns <code>true</code> if the system property is accessed
- * by the expression tree.
- *
- * @return whether the system property is accessed or not
- */
- public boolean hasSystemPropertyAccess() {
- return fHasSystemPropertyAccess;
- }
-
- /**
- * Marks the system property as accessed.
- */
- public void markSystemPropertyAccessed() {
- fHasSystemPropertyAccess= true;
- }
-
- /**
- * Returns the set of accessed variables.
- *
- * @return the set of accessed variables
- */
- public String[] getAccessedVariableNames() {
- if (fAccessedVariableNames == null)
- return new String[0];
- return (String[])fAccessedVariableNames.toArray(new String[fAccessedVariableNames.size()]);
- }
-
- /**
- * Marks the given variable as accessed.
- *
- * @param name the accessed variable
- */
- public void addVariableNameAccess(String name) {
- if (fAccessedVariableNames == null) {
- fAccessedVariableNames= new ArrayList(5);
- fAccessedVariableNames.add(name);
- } else {
- if (!fAccessedVariableNames.contains(name))
- fAccessedVariableNames.add(name);
- }
- }
-
- /**
- * Returns the set of accessed {@link PropertyTester} properties.
- *
- * @return the fully qualified names of accessed properties, or an empty array
- *
- * @see #hasSystemPropertyAccess() for system properties
- * @since 3.4
- */
- public String[] getAccessedPropertyNames() {
- if (fAccessedPropertyNames == null)
- return new String[0];
- return (String[])fAccessedPropertyNames.toArray(new String[fAccessedPropertyNames.size()]);
- }
-
- /**
- * Marks the given property (the fully qualified name of a
- * {@link PropertyTester} property) as accessed.
- *
- * @param name
- * the fully qualified property name
- *
- * @see #markSystemPropertyAccessed() for system properties
- * @since 3.4
- */
- public void addAccessedPropertyName(String name) {
- if (fAccessedPropertyNames == null) {
- fAccessedPropertyNames= new ArrayList(5);
- fAccessedPropertyNames.add(name);
- } else {
- if (!fAccessedPropertyNames.contains(name))
- fAccessedPropertyNames.add(name);
- }
- }
-
- /**
- * Returns the set of expression types which don't implement the
- * new (@link Expression#computeReevaluationInfo(IEvaluationContext)}
- * method. If one expression didn't implement the method the expression
- * tree no optimizations can be done. Returns <code>null</code> if
- * all expressions implement the method.
- *
- * @return the set of expression types which don't implement the
- * <code>computeReevaluationInfo</code> method.
- */
- public Class[] getMisbehavingExpressionTypes() {
- if (fMisbehavingExpressionTypes == null)
- return null;
- return (Class[])fMisbehavingExpressionTypes.toArray(new Class[fMisbehavingExpressionTypes.size()]);
- }
-
- /**
- * Adds the given class to the list of misbehaving classes.
- *
- * @param clazz the class to add.
- */
- public void addMisBehavingExpressionType(Class clazz) {
- if (fMisbehavingExpressionTypes == null) {
- fMisbehavingExpressionTypes= new ArrayList(2);
- fMisbehavingExpressionTypes.add(clazz);
- } else {
- if (!fMisbehavingExpressionTypes.contains(clazz))
- fMisbehavingExpressionTypes.add(clazz);
- }
- }
-
- /**
- * Merges this reevaluation information with the given info.
- *
- * @param other the information to merge with
- */
- public void merge(ExpressionInfo other) {
- mergeDefaultVariableAccess(other);
- mergeSystemPropertyAccess(other);
-
- mergeAccessedVariableNames(other);
- mergeAccessedPropertyNames(other);
- mergeMisbehavingExpressionTypes(other);
- }
-
- /**
- * Merges this reevaluation information with the given info
- * ignoring the default variable access.
- *
- * @param other the information to merge with
- */
- public void mergeExceptDefaultVariable(ExpressionInfo other) {
- mergeSystemPropertyAccess(other);
-
- mergeAccessedVariableNames(other);
- mergeAccessedPropertyNames(other);
- mergeMisbehavingExpressionTypes(other);
- }
-
- /**
- * Merges only the default variable access.
- *
- * @param other the information to merge with
- */
- private void mergeDefaultVariableAccess(ExpressionInfo other) {
- fHasDefaultVariableAccess= fHasDefaultVariableAccess || other.fHasDefaultVariableAccess;
- }
-
- /**
- * Merges only the system property access.
- *
- * @param other the information to merge with
- */
- private void mergeSystemPropertyAccess(ExpressionInfo other) {
- fHasSystemPropertyAccess= fHasSystemPropertyAccess || other.fHasSystemPropertyAccess;
- }
-
- /**
- * Merges only the accessed variable names.
- *
- * @param other the information to merge with
- */
- private void mergeAccessedVariableNames(ExpressionInfo other) {
- if (fAccessedVariableNames == null) {
- fAccessedVariableNames= other.fAccessedVariableNames; //TODO: shares the two lists! Can propagate further additions up into sibling branches.
- } else {
- if (other.fAccessedVariableNames != null) {
- for (Iterator iter= other.fAccessedVariableNames.iterator(); iter.hasNext();) {
- Object variableName= iter.next();
- if (!fAccessedVariableNames.contains(variableName))
- fAccessedVariableNames.add(variableName);
- }
- }
- }
- }
-
- /**
- * Merges only the accessed property names.
- *
- * @param other the information to merge with
- * @see #mergeSystemPropertyAccess(ExpressionInfo) for system properties
- * @since 3.4
- */
- private void mergeAccessedPropertyNames(ExpressionInfo other) {
- if (fAccessedPropertyNames == null) {
- fAccessedPropertyNames= other.fAccessedPropertyNames; //TODO: shares the two lists!
- } else {
- if (other.fAccessedPropertyNames != null) {
- for (Iterator iter= other.fAccessedPropertyNames.iterator(); iter.hasNext();) {
- Object variableName= iter.next();
- if (!fAccessedPropertyNames.contains(variableName))
- fAccessedPropertyNames.add(variableName);
- }
- }
- }
- }
-
- /**
- * Merges only the misbehaving expression types.
- *
- * @param other the information to merge with
- */
- private void mergeMisbehavingExpressionTypes(ExpressionInfo other) {
- if (fMisbehavingExpressionTypes == null) {
- fMisbehavingExpressionTypes= other.fMisbehavingExpressionTypes; //TODO: shares the two lists!
- } else {
- if (other.fMisbehavingExpressionTypes != null) {
- for (Iterator iter= other.fMisbehavingExpressionTypes.iterator(); iter.hasNext();) {
- Object clazz= iter.next();
- if (!fMisbehavingExpressionTypes.contains(clazz))
- fMisbehavingExpressionTypes.add(clazz);
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionTagNames.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionTagNames.java
deleted file mode 100644
index a2f97a5..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionTagNames.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-/**
- * Class defining the tag names of the XML elements of the common
- * expression language.
- *
- * @since 3.0
- */
-public final class ExpressionTagNames {
-
- /** The tag name of the enablement expression (value: <code>enablement</code>) */
- public static final String ENABLEMENT= "enablement"; //$NON-NLS-1$
-
- /** The tag name of the and expression (value: <code>and</code>) */
- public static final String AND= "and"; //$NON-NLS-1$
-
- /** The tag name of the or expression (value: <code>or</code>) */
- public static final String OR= "or"; //$NON-NLS-1$
-
- /** The tag name of the not expression (value: <code>not</code>) */
- public static final String NOT= "not"; //$NON-NLS-1$
-
- /** The tag name of the instanceof expression (value: <code>instanceof</code>) */
- public static final String INSTANCEOF= "instanceof"; //$NON-NLS-1$
-
- /** The tag name of the test expression (value: <code>test</code>) */
- public static final String TEST= "test"; //$NON-NLS-1$
-
- /** The tag name of the with expression (value: <code>with</code>) */
- public static final String WITH= "with"; //$NON-NLS-1$
-
- /** The tag name of the adapt expression (value: <code>adapt</code>) */
- public static final String ADAPT= "adapt"; //$NON-NLS-1$
-
- /** The tag name of the count expression (value: <code>count</code>) */
- public static final String COUNT= "count"; //$NON-NLS-1$
-
- /** The tag name of the adapt expression (value: <code>iterate</code>) */
- public static final String ITERATE= "iterate"; //$NON-NLS-1$
-
- /** The tag name of the resolve expression (value: <code>resolve</code>) */
- public static final String RESOLVE= "resolve"; //$NON-NLS-1$
-
- /** The tag name of the systemTest expression (value: <code>systemTest</code>) */
- public static final String SYSTEM_TEST= "systemTest"; //$NON-NLS-1$
-
- /** The tag name of the equals expression (value: <code>equals</code>) */
- public static final String EQUALS= "equals"; //$NON-NLS-1$
-
- /**
- * The tag name of the reference expression (value: <code>reference</code>)
- *
- * @since 3.3
- */
- public static final String REFERENCE= "reference"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ICountable.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ICountable.java
deleted file mode 100644
index cfcd519..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ICountable.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IAdapterManager;
-
-/**
- * Objects that are adaptable to <code>ICountable</code> can be used
- * as the default variable in a count expression.
- *
- * @see IAdaptable
- * @see IAdapterManager
- *
- * @since 3.3
- */
-public interface ICountable {
-
- /**
- * Returns the number of elements.
- *
- * @return the number of elements
- */
- public int count();
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IEvaluationContext.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IEvaluationContext.java
deleted file mode 100644
index 2d5c938..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IEvaluationContext.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * An evaluation context is used to manage a set of objects needed during
- * XML expression evaluation. A context has a parent context, can manage
- * a set of named variables and has a default variable. The default variable
- * is used during XML expression evaluation if no explicit variable is
- * referenced.
- * <p>
- * This interface is not intended to be implemented by clients. Clients
- * are allowed to instantiate <code>EvaluationContext</code>.
- * </p>
- *
- * @since 3.0
- *
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface IEvaluationContext {
-
- /**
- * Represents the value used by variables that exist but are not defined
- * in a evaluation context. When tested by the 'with' expression, <code>false</code>
- * will be returned.
- *
- * @since 3.4
- */
- public static Object UNDEFINED_VARIABLE = new Object();
-
- /**
- * Returns the parent context or <code>null</code> if
- * this is the root of the evaluation context hierarchy.
- *
- * @return the parent evaluation context or <code>null</code>
- */
- public IEvaluationContext getParent();
-
- /**
- * Returns the root evaluation context.
- *
- * @return the root evaluation context
- */
- public IEvaluationContext getRoot();
-
- /**
- * Specifies whether this evaluation context allows activation
- * of plug-ins for testers used in the expression tree. To actual
- * trigger the plug-in loading this flag has to be set to <code>
- * true</code> and the actual test expression must have the
- * attribute <code>forcePluginActivation</code> set to <code>
- * true</code> as well.
- *
- * @param value whether this evaluation context allows plug-in activation
- * @since 3.2
- */
- public void setAllowPluginActivation(boolean value);
-
- /**
- * Returns whether this evaluation context supports plug-in
- * activation. If not set via {@link #setAllowPluginActivation(boolean)}
- * the parent value is returned. If no parent is set <code>false</code>
- * is returned.
- *
- * @return whether plug-in activation is supported or not
- * @since 3.2
- */
- public boolean getAllowPluginActivation();
-
- /**
- * Returns the default variable.
- *
- * @return the default variable or <code>null</code> if
- * no default variable is managed.
- */
- public Object getDefaultVariable();
-
- /**
- * Adds a new named variable to this context. If a variable
- * with the name already exists the new one overrides the
- * existing one.
- *
- * @param name the variable's name
- * @param value the variable's value
- */
- public void addVariable(String name, Object value);
-
- /**
- * Removes the variable managed under the given name
- * from this evaluation context.
- *
- * @param name the variable's name
- * @return the currently stored value or <code>null</code> if
- * the variable doesn't exist
- */
- public Object removeVariable(String name);
-
- /**
- * Returns the variable managed under the given name.
- *
- * @param name the variable's name
- * @return the variable's value or <code>null</code> if the content
- * doesn't manage a variable with the given name
- */
- public Object getVariable(String name);
-
- /**
- * Resolves a variable for the given name and arguments. This
- * method can be used to dynamically resolve variable such as
- * plug-in descriptors, resources, etc. The method is used
- * by the <code>resolve</code> expression.
- *
- * @param name the variable to resolve
- * @param args an object array of arguments used to resolve the
- * variable
- * @return the variable's value or <code>null</code> if no variable
- * can be resolved for the given name and arguments
- * @exception CoreException if an errors occurs while resolving
- * the variable
- */
- public Object resolveVariable(String name, Object[] args) throws CoreException;
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IIterable.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IIterable.java
deleted file mode 100644
index 0a75649..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IIterable.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IAdapterManager;
-
-/**
- * Objects that are adaptable to <code>IIterable</code> can be used
- * as the default variable in an iterate expression.
- *
- * @see IAdaptable
- * @see IAdapterManager
- *
- * @since 3.3
- */
-public interface IIterable {
-
- /**
- * Returns an iterator to iterate over the elements.
- *
- * @return an iterator
- */
- public Iterator iterator();
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IPropertyTester.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IPropertyTester.java
deleted file mode 100644
index 2f2a701..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IPropertyTester.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * A property tester can be used to add additional properties to test to an
- * existing type.
- * <p>
- * This interface is not intended to be implemented by clients. Clients
- * should subclass type <code>PropertyTester</code>.
- * </p>
- *
- * @since 3.0
- *
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface IPropertyTester {
-
- /**
- * Returns whether the property tester can handle the given
- * property or not.
- *
- * @param namespace the name space to be considered
- * @param property the property to test
- * @return <code>true</code> if the tester provides an implementation
- * for the given property; otherwise <code>false</code> is returned
- */
- public boolean handles(String namespace, String property);
-
- /**
- * Returns whether the implementation class for this property tester is
- * loaded or not.
- *
- * @return <code>true</code>if the implementation class is loaded;
- * <code>false</code> otherwise
- */
- public boolean isInstantiated();
-
- /**
- * Returns <code>true</code> if the implementation class of this property
- * tester can be loaded. This is the case if the plug-in providing
- * the implementation class is active. Returns <code>false</code> otherwise.
- *
- * @return whether the implementation class can be loaded or not
- */
- public boolean isDeclaringPluginActive();
-
- /**
- * Loads the implementation class for this property tester and returns an
- * instance of this class.
- *
- * @return an instance of the implementation class for this property tester
- *
- * @throws CoreException if the implementation class cannot be loaded
- */
- public IPropertyTester instantiate() throws CoreException;
-
- /**
- * Executes the property test determined by the parameter <code>property</code>.
- *
- * @param receiver the receiver of the property test
- * @param property the property to test
- * @param args additional arguments to evaluate the property. If no arguments
- * are specified in the <code>test</code> expression an array of length 0
- * is passed
- * @param expectedValue the expected value of the property. The value is either
- * of type <code>java.lang.String</code> or a boxed base type. If no value was
- * specified in the <code>test</code> expressions then <code>null</code> is passed
- *
- * @return returns <code>true<code> if the property is equal to the expected value;
- * otherwise <code>false</code> is returned
- */
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue);
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IVariableResolver.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IVariableResolver.java
deleted file mode 100644
index 990a232..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IVariableResolver.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * A variable resolver can be used to add additional variable resolving
- * strategies to an {@link EvaluationContext}.
- *
- * @see org.eclipse.core.expressions.EvaluationContext#resolveVariable(String, Object[])
- *
- * @since 3.0
- */
-public interface IVariableResolver {
-
- /**
- * Resolves a variable for the given name and arguments. The
- * handler is allowed to return <code>null</code> to indicate
- * that it is not able to resolve the requested variable.
- *
- * @param name the variable to resolve
- * @param args an object array of arguments used to resolve the
- * variable
- * @return the variable's value or <code>null</code> if no variable
- * could be resolved
- * @exception CoreException if an errors occurs while resolving
- * the variable
- */
- public Object resolve(String name, Object[] args) throws CoreException;
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/PropertyTester.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/PropertyTester.java
deleted file mode 100644
index d5f367d..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/PropertyTester.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-import org.osgi.framework.Bundle;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.core.internal.expressions.PropertyTesterDescriptor;
-
-/**
- * Abstract superclass of all property testers. Implementation classes of
- * the extension point <code>org.eclipse.core.expresssions.propertyTesters
- * </code> must extend <code>PropertyTester</code>.
- * <p>
- * A property tester implements the property tests enumerated in the property
- * tester extension point. For the following property test extension
- * <pre>
- * <propertyTester
- * namespace="org.eclipse.jdt.core"
- * id="org.eclipse.jdt.core.IPackageFragmentTester"
- * properties="isDefaultPackage"
- * type="org.eclipse.jdt.core.IPackageFragment"
- * class="org.eclipse.demo.MyPackageFragmentTester">
- * </propertyTester>
- * </pre>
- * the corresponding implementation class looks like:
- * <pre>
- * public class MyPackageFragmentTester {
- * public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- * IPackageFragment fragement= (IPackageFragment)receiver;
- * if ("isDefaultPackage".equals(property)) {
- * return expectedValue == null
- * ? fragement.isDefaultPackage()
- * : fragement.isDefaultPackage() == ((Boolean)expectedValue).booleanValue();
- * }
- * Assert.isTrue(false);
- * return false;
- * }
- * }
- * </pre>
- * The property can then be used in a test expression as follows:
- * <pre>
- * <instanceof value="org.eclipse.core.IPackageFragment"/>
- * <test property="org.eclipse.jdt.core.isDefaultPackage"/>
- * </pre>
- * </p>
- * <p>
- * There is no guarantee that the same instance of a property tester is used
- * to handle <test property="..."/> requests. So property testers
- * should always be implemented in a stateless fashion.
- * </p>
- * @since 3.0
- */
-public abstract class PropertyTester implements IPropertyTester {
-
- private IConfigurationElement fConfigElement;
- private String fNamespace;
- private String fProperties;
-
- /**
- * Initialize the property tester with the given name space and property.
- * <p>
- * Note: this method is for internal use only. Clients must not call
- * this method.
- * </p>
- * @param descriptor the descriptor object for this tester
- *
- * @noreference This method is not intended to be referenced by clients.
- */
- public final void internalInitialize(PropertyTesterDescriptor descriptor) {
- fProperties= descriptor.getProperties();
- fNamespace= descriptor.getNamespace();
- fConfigElement= descriptor.getConfigurationElement();
- }
-
- /**
- * Note: this method is for internal use only. Clients must not call
- * this method.
- *
- * @return the property tester descriptor
- *
- * @noreference This method is not intended to be referenced by clients.
- */
- public final PropertyTesterDescriptor internalCreateDescriptor() {
- return new PropertyTesterDescriptor(fConfigElement, fNamespace, fProperties);
- }
-
- /**
- * {@inheritDoc}
- */
- public final boolean handles(String namespace, String property) {
- return fNamespace.equals(namespace) && fProperties.indexOf("," + property + ",") != -1; //$NON-NLS-1$//$NON-NLS-2$
- }
-
- /**
- * {@inheritDoc}
- */
- public final boolean isInstantiated() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isDeclaringPluginActive() {
- Bundle bundle= Platform.getBundle(fConfigElement.getContributor().getName());
- return bundle.getState() == Bundle.ACTIVE;
- }
-
- /**
- * {@inheritDoc}
- */
- public final IPropertyTester instantiate() {
- return this;
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/package.html b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/package.html
deleted file mode 100644
index a276e01..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/package.html
+++ /dev/null
@@ -1,269 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<title>Package-level Javadoc</title>
-<link rel="stylesheet" href="http://dev.eclipse.org/default_style.css"
- type="text/css">
-</head>
-<body style="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0)">
-Application programming interfaces for the expression language.
-<h2>Package Specification</h2>
-The package provides API and implementation classes to define a unified
-XML expression language. The expression language isn't only for extension
-points, it can be used in any XML document that supports enablement
-expressions.
-<h3>XML expression language</h3>
-The XML expression language consists of the following predefined
-expression tags. The set is open and can be extended to customize the
-expression language.
-<p><i><u>Boolean operators</u></i></p>
-<p>The expression language provides standard expressions for the Boolean
-operators and, or and not.</p>
-<p><i><u>Instanceof expression</u></i></p>
-<p>The most frequently used check in current extension points is one to
-test if an object conforms to a certain type. The common XML expression
-language provides a special XML element to represent instance of checks.
-A typical usage looks as follows:</p>
-<blockquote><pre><instanceof value="org.eclipse.jdt.core.IJavaElement"/></pre>
-</blockquote>
-<p>The above expression tests, if the object under inspection (in most
-cases the element selected in the user interface) is of instance
-"org.eclipse.jdt.core.IJavaElement".</p>
-<p><a name="test_expression0"><i><u>Test expression</u></i></a></p>
-<p>Besides instance of checks the new expression language defines an
-extensible <test> element to support property testing. The
-<test> element is comparable to the <filter> element used in
-Platform/UI. The test element is used as follows:</p>
-<blockquote><pre><and>
- <instanceof value="org.eclipse.core.resources.IFile"/>
- <test property="org.demo.matchesPattern" value="*.html"/>
-</and></pre></blockquote>
-<p>The above expression evaluates to true if the object under inspection
-is of type "org.eclipse.core.resources.IFile" and its file name matches
-the pattern "*.html". But who actually provides the code to do the name
-pattern test? Predefining a set of properties to test is too limiting.
-The set of tests must be open. Property testers are added to the system
-using a special extension point <code>propertyTesters</code>.
-The above matchesPattern property is added to the system in the
-following way:</p>
-<pre style="margin-left: 40px"><extension point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- id="org.eclipse.jdt.ui.IResourceTypeExtender"
- type="org.eclipse.core.resources.IResource"
- namespace="org.demo"
- properties="matchesPattern, ...."
- class="org.eclipse....ResourcePropertyTester">
- </propertyTester>
-</extension></pre>
-<p>The major characteristics of the extensible test mechanism are:</p>
-<ul>
- <li>types are enriched with new properties using a property tester,
- meaning that the code of the actual property test is provided by a
- different class.</li>
- <li>a property tester implements a set of properties.</li>
- <li>property testers and their properties are defined in XML as
- extension points. This is required to check if an extender provides a
- property without having to activate it (e.g. load the plug-in).</li>
- <li>properties belong to a name space. This ensures that two sibling
- plug-ins can define the same property without causing any ambiguity. If
- a property is defined more than once for a name space then one of the
- testers is randomly chosen to test the property. Inheritance only
- works within the same name space. If, for example, there is a property
- <code>isPublic</code> defined in the
- namespace <code>org.myNamespace</code> for type <code>org.eclipse.core.IMethod</code>
- then this property will not override the property <code>isPublic</code> in the namespace <code>org.yourNamespace</code>
- for type <code>org.eclipse.core.IMember</code>. </li>
- <li>testing for an unknown property results in a core exception. This
- is a programming error.</li>
-</ul>
-<p>The attributes of the propertyTester element have the following
-meaning:</p>
-<ul>
- <li>id: a unique id</li>
- <li>type: the type which gets "enriched" with new methods</li>
- <li>namespace: the name space the properties belong to</li>
- <li>properties: the comma separated list of properties provided by the
- tester.</li>
- <li>class: the implementing class</li>
-</ul>
-<p>The concrete implementation for the above property tester looks like
-this:</p>
-<blockquote><pre><font size="-1">public class ResourcePropertyTester extends PropertyTester {
- private static final String PROPERTY_MATCHES_PATTERN= "matchesPattern"; //$NON-NLS-1$
-
-
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- IResource resource= (IResource)receiver;
- if (PROPERTY_MATCHES_PATTERN.equals(method)) {
- String fileName= resource.getName();
- StringMatcher matcher= new StringMatcher((String)expectedValue, false, false);
- return expectedValue == null
- ? matcher.match(fileName)
- : matcher.match(filename) == ((Boolean)expectedValue).booleanValue();
- } else if (...) {
- }
- Assert.isTrue(false);
- return false;
- }
-</font>}</pre></blockquote>
-<p>The string value provided by the value attribute is converted into a
-Java object using the following rules:</p>
-<ul>
- <li>the string "true" is converted into Boolean.TRUE</li>
- <li>the string "false" is converted into Boolean.FALSE</li>
- <li>if the string contains a dot then the interpreter tries to convert
- the value into a Float object. If this fails the string is treated as a
- java.lang.String</li>
- <li>if the string only consists of numbers then the interpreter
- converts the value in an Integer object.</li>
- <li>in all other cases the string is treated as a java.lang.String</li>
- <li>the conversion of the string into a Boolean, Float, or Integer can
- be suppressed by surrounding the string with single quotes. For
- example, the attribute value="'true'" is converted into the
- string "true"</li>
-</ul>
-<p>Sometimes a property test needs additional arguments to determine the
-exact property to test. If this is the case the arguments can be passed
-using the additional args attribute. An example which validates a name
-using the method IWorkspace.validateName looks as follows:</p>
-<blockquote><pre><test property="org.demo.validateName" args="/org.eclipse.demo/A.java, FILE"/></pre></blockquote>
-<p><i><u>With expression</u></i></p>
-<p>Test expressions don't allow to specify the object they inspect. They
-work on a default object, which for most extension points is the object
-selected in the user interface. However, the enablement logic of some
-extension points need to test other objects as well. For example a Java
-refactoring participant tests if the list of affected projects contains
-a project with the Java nature:</p>
-<blockquote><pre><with variable="affectedProjects">
- <iterate operator="or">
- <test property="org.demo.projectNature" value="org.eclipse.jdt.core.javanature"/>
- </iterate>
-</with></pre></blockquote>
-<p>The plug-in that evaluates the extension point is responsible for
-providing the set of available variables. For example, the code that
-evaluates refactoring participants provides the follow variables:</p>
-<ul>
- <li><i>selection:</i> its value is a collection containing the objects
- to be refactored</li>
- <li><i>affectedProjects</i>: its value is a collection containing the
- projects affected by the refactoring</li>
- <li><i>defaultVariable</i>: will be used if no with expression element
- is active. Is an alias for the variable selection.</li>
-</ul>
-<p>If the variable doesn't exist, the with expression will throw a core
-exception.</p><p><u><i>Resolve expression</i></u></p>
-<p>The resolve expression is comparable to the with expression, but it allows resolving the variable dynamically and to pass additional arguments needed to resolve the argument. For example to resolve the plug-in descriptor for a specific plug-in the following XML element can be used:</p>
-<blockquote><pre><resolve variable="pluginDescriptor" args="org.eclipse.core.runtime">
- <test property="org.demo.isActive"/>
-</adapt></pre></blockquote>
-<p>The actual resolving is delegated to the evaluation context used to evaluate the expressions. See below on how to evaluate an expression and how to create an evaluation context.</p>
-<p><u><i>Adapt expression</i></u></p>
-<p>The adapt expression can be used to adapt the object to be inspected
-to an object of a different type using the adapter mechanism provided by
-the platform. The example below adapts the object to be inspected to an
-IType and then checks if the type is public:</p>
-<blockquote><pre><adapt type="org.eclipse.jdt.core.IType">
- <test property="org.demo.isPrivate"/>
-</adapt></pre></blockquote>
-<p>Like the with expression the adapt expression changes the object to
-inspect for all its children. The new object is the one returned from
-IAdapter.getAdapter(). If the adaption fails, the expression evaluates
-to false.</p>
-<p>The adapt expression is implemented based on the IAdapterManager API
-<code>hasAdapter(Object, String)</code> and <code>getAdapter(Object, String)</code>.
-This ensures that the right class loader is taken to convert the type name into a
-corresponding Class object.
-However, using this API requires that the adapter factory providing the actual adapter
-is registered in XML using the extension point "org.eclipse.core.runtime.adapters".
-Assuming that there is an adapter that converts resources with the extension .java into IType objects,
-the adapter must be declared in XML to make the above adapt expression work correctly.
-The corresponding adapter definition looks like this:</p>
-<blockquote><pre><extension point="org.eclipse.core.runtime.adapters">
- <factory
- class="org.demo.MyAdapterFactory"
- adaptableType="org.eclipse.core.resources.IFile">
- <adapter type="org.eclipse.jdt.core.IType"/>
- </factory>
-</extension></pre></blockquote>
-<p><u><i>SytemTest expression</i></u></p>
-<p>There is a special XML element to test system properties.</p>
-<blockquote>
-<p><code><systemTest property="os.name" value="Windows XP"/><br>
-<systemTest property="os.version" value="5.1"/></code></p>
-</blockquote>
-<p><u><i>Dealing with collection of elements</i></u></p>
-<p>Several expressions are evaluated on a collection of objects (for
-example refactoring participants, menu contributions, ...). Up to now, the
-iteration over collections was implicitly coded into the enclosing XML
-element, which isn't part of the expression itself. The new mechanism
-provides explicit expression elements to deal with collections of
-objects. The following element</p>
-<blockquote><pre><count value="*"/></pre></blockquote>
-<p>is used to check the number of objects in a collection, and the syntax
-of the attribute value is equal to the enablesFor attribute used for
-object contributions. To iterate over a collection, an element</p>
-<blockquote><pre><iterate operator="..."></pre></blockquote>
-<p>is provided. The operator attribute can either be "and" or "or". It
-determines how the evaluation results of all objects in the list are
-combined. The default operator is "and". Using these expression the
-enablement of a typical contribution can be described as follows:</p>
-<blockquote><pre><with variable="selection"><br> <count value="+"/><br> <iterate operator="and"/><br> <adapt type="org.eclipse.core.resources.IFile"><br> <test property="matchesName" value="*.gif"/><br> <test property="canDelete"/><br> </adapt><br> </iterate><br></with></pre>
-</blockquote>
-<p>The expression only evaluates to true if the selection contains one
-or more objects and all objects fulfill the expression defined by the
-adapt element.</p>
-<p><u><i>Enablement expression</i></u></p>
-<p>XML expressions are mostly used to define the availability of an
-extension point contribution, but they can be used in any XML document
-that allows expressions. To separate the expression from other
-child elements the common expression language provides an enablement
-element. Its use is as follows:</p>
-<blockquote><pre><renameParticipant<br> id="launchConfigUpdater"<br> class="org.eclipse...LaunchConfigUpdater"><br> <enablement><br> ...<br> </enablement><br></renameParticipant></pre>
-</blockquote>
-<p>Most of the time child expression will be combined using the and
-operator. To avoid deep nesting XML "and" will be the default for
-combining children. It can therefore be omitted. The same applies to the
-adapt, iterate, and enablement expression defined in the following
-sections.</p>
-<p><u><i>Extension Point Schema</i></u></p>
-
-<p>An extension point schema exists for the property tester extension
-point and for the expression language itself. The schema for the
-expression language can be included into other schema files using
-the following include element:
-</p>
-<blockquote><pre>
-<include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
-</pre></blockquote>
-<p><a name="converting"><u><i>Converting XML elements into expressions</i></u></a></p>
-<p>XML elements can be converted into corresponding expression objects using the class ExpressionConverter.
-If only expression tags from the common expression language are used, then the standard expression converter can be used.
-The following example converts the configuration element representing an enablement element into an expression:</p>
-<blockquote>
-<p><code>IConfigurationElement enablementElement= ...;<br>
-Expression expression=
-ExpressionConverter.getDefault().perform(enablementElement);</code></p>
-</blockquote>
-<p><i><u>Evaluating an expression</u></i></p>
-<p>Expressions are evaluated by calling <code>Expression.evaluate(...);</code>. The evaluation
-context passed to the evaluate method has to be set up by the plug-in that reads an extension point.
-The plug-in is responsible to set up the default variable and all the other variable used in
-with expressions. The example below creates a special evaluation context and uses this context to
-evaluate an expression:
-</p><blockquote>
-<pre>
-<code>
-EvaluationContext context= new EvaluationContext(null, defaultVariable) {
- public Object resolveVariable(String name, Object[] args) throws CoreException {
- // do special resolving
- }
-}</code></pre>
-</blockquote>
-<p>The actual evaluation is done by calling:</p>
-<blockquote><pre>
-<code>
-EvaluationResult= expression.evaluate(context);</code></pre></blockquote>
-</body>
-</html>
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AdaptExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AdaptExpression.java
deleted file mode 100644
index 91a5df5..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AdaptExpression.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.w3c.dom.Element;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.ExpressionInfo;
-import org.eclipse.core.expressions.IEvaluationContext;
-
-public class AdaptExpression extends CompositeExpression {
-
- private static final String ATT_TYPE= "type"; //$NON-NLS-1$
-
- /**
- * The seed for the hash code for all adapt expressions.
- */
- private static final int HASH_INITIAL= AdaptExpression.class.getName().hashCode();
-
- private String fTypeName;
-
- public AdaptExpression(IConfigurationElement configElement) throws CoreException {
- fTypeName= configElement.getAttribute(ATT_TYPE);
- Expressions.checkAttribute(ATT_TYPE, fTypeName);
- }
-
- public AdaptExpression(Element element) throws CoreException {
- fTypeName= element.getAttribute(ATT_TYPE);
- Expressions.checkAttribute(ATT_TYPE, fTypeName.length() > 0 ? fTypeName : null);
- }
-
- public AdaptExpression(String typeName) {
- Assert.isNotNull(typeName);
- fTypeName= typeName;
- }
-
- public boolean equals(final Object object) {
- if (!(object instanceof AdaptExpression))
- return false;
-
- final AdaptExpression that= (AdaptExpression)object;
- return this.fTypeName.equals(that.fTypeName)
- && equals(this.fExpressions, that.fExpressions);
- }
-
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + hashCode(fExpressions)
- * HASH_FACTOR + fTypeName.hashCode();
- }
-
- /* (non-Javadoc)
- * @see Expression#evaluate(IVariablePool)
- */
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- if (fTypeName == null)
- return EvaluationResult.FALSE;
- Object var= context.getDefaultVariable();
- Object adapted= null;
- IAdapterManager manager= Platform.getAdapterManager();
- if (Expressions.isInstanceOf(var, fTypeName)) {
- adapted= var;
- } else {
- if (!manager.hasAdapter(var, fTypeName))
- return EvaluationResult.FALSE;
-
- adapted= manager.getAdapter(var, fTypeName);
- }
- // the adapted result is null but hasAdapter returned true check
- // if the adapter is loaded.
- if (adapted == null) {
- if (manager.queryAdapter(var, fTypeName) == IAdapterManager.NOT_LOADED) {
- return EvaluationResult.NOT_LOADED;
- } else {
- return EvaluationResult.FALSE;
- }
- }
- return evaluateAnd(new DefaultVariable(context, adapted));
- }
-
- public void collectExpressionInfo(ExpressionInfo info) {
- // Although the default variable is passed to the children of this
- // expression as an instance of the adapted type it is OK to only
- // mark a default variable access.
- info.markDefaultVariableAccessed();
- super.collectExpressionInfo(info);
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AndExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AndExpression.java
deleted file mode 100644
index a6cc0be..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AndExpression.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.IEvaluationContext;
-
-public class AndExpression extends CompositeExpression {
-
- public boolean equals(final Object object) {
- if (!(object instanceof AndExpression))
- return false;
-
- final AndExpression that= (AndExpression)object;
- return equals(this.fExpressions, that.fExpressions);
- }
-
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- return evaluateAnd(context);
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CompositeExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CompositeExpression.java
deleted file mode 100644
index 7eaa2a4..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CompositeExpression.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionInfo;
-import org.eclipse.core.expressions.IEvaluationContext;
-
-public abstract class CompositeExpression extends Expression {
-
- private static final Expression[] EMPTY_ARRAY = new Expression[0];
-
- /**
- * The seed for the hash code for all composite expressions.
- */
- private static final int HASH_INITIAL= CompositeExpression.class.getName().hashCode();
-
- protected List fExpressions;
-
- public void add(Expression expression) {
- if (fExpressions == null)
- fExpressions= new ArrayList(2);
- fExpressions.add(expression);
- }
-
- public Expression[] getChildren() {
- if (fExpressions == null)
- return EMPTY_ARRAY;
- return (Expression[])fExpressions.toArray(new Expression[fExpressions.size()]);
- }
-
- protected EvaluationResult evaluateAnd(IEvaluationContext scope) throws CoreException {
- if (fExpressions == null)
- return EvaluationResult.TRUE;
- EvaluationResult result= EvaluationResult.TRUE;
- for (Iterator iter= fExpressions.iterator(); iter.hasNext();) {
- Expression expression= (Expression)iter.next();
- result= result.and(expression.evaluate(scope));
- // keep iterating even if we have a not loaded found. It can be
- // that we find a false which will result in a better result.
- if (result == EvaluationResult.FALSE)
- return result;
- }
- return result;
- }
-
- protected EvaluationResult evaluateOr(IEvaluationContext scope) throws CoreException {
- if (fExpressions == null)
- return EvaluationResult.TRUE;
- EvaluationResult result= EvaluationResult.FALSE;
- for (Iterator iter= fExpressions.iterator(); iter.hasNext();) {
- Expression expression= (Expression)iter.next();
- result= result.or(expression.evaluate(scope));
- if (result == EvaluationResult.TRUE)
- return result;
- }
- return result;
- }
-
- public void collectExpressionInfo(ExpressionInfo info) {
- if (fExpressions == null)
- return;
- for (Iterator iter= fExpressions.iterator(); iter.hasNext();) {
- Expression expression= (Expression)iter.next();
- expression.collectExpressionInfo(info);
- }
- }
-
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + hashCode(fExpressions);
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CountExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CountExpression.java
deleted file mode 100644
index eb63d3c..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CountExpression.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import java.util.Collection;
-
-import org.w3c.dom.Element;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionInfo;
-import org.eclipse.core.expressions.ICountable;
-import org.eclipse.core.expressions.IEvaluationContext;
-
-
-public class CountExpression extends Expression {
-
- private static final int ANY_NUMBER= 5;
- private static final int EXACT= 4;
- private static final int ONE_OR_MORE= 3;
- private static final int NONE_OR_ONE= 2;
- private static final int NONE= 1;
- private static final int UNKNOWN= 0;
-
- /**
- * The seed for the hash code for all count expressions.
- */
- private static final int HASH_INITIAL= CountExpression.class.getName().hashCode();
-
- private int fMode;
- private int fSize;
-
- public CountExpression(IConfigurationElement configElement) {
- String size = configElement.getAttribute(ATT_VALUE);
- initializeSize(size);
- }
-
- public CountExpression(Element element) {
- String size = element.getAttribute(ATT_VALUE);
- initializeSize(size.length() > 0 ? size : null);
- }
-
- public CountExpression(String size) {
- initializeSize(size);
- }
-
- private void initializeSize(String size) {
- if (size == null)
- size= "*"; //$NON-NLS-1$
- if (size.equals("*")) //$NON-NLS-1$
- fMode= ANY_NUMBER;
- else if (size.equals("?")) //$NON-NLS-1$
- fMode= NONE_OR_ONE;
- else if (size.equals("!")) //$NON-NLS-1$
- fMode= NONE;
- else if (size.equals("+")) //$NON-NLS-1$
- fMode= ONE_OR_MORE;
- else {
- try {
- fSize= Integer.parseInt(size);
- fMode= EXACT;
- } catch (NumberFormatException e) {
- fMode= UNKNOWN;
- }
- }
- }
-
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- Object var= context.getDefaultVariable();
- int size;
- if (var instanceof Collection) {
- size= ((Collection)var).size();
- } else {
- ICountable countable= Expressions.getAsICountable(var, this);
- if (countable == null)
- return EvaluationResult.NOT_LOADED;
- size= countable.count();
- }
- switch (fMode) {
- case UNKNOWN:
- return EvaluationResult.FALSE;
- case NONE:
- return EvaluationResult.valueOf(size == 0);
- case NONE_OR_ONE:
- return EvaluationResult.valueOf(size == 0 || size == 1);
- case ONE_OR_MORE:
- return EvaluationResult.valueOf(size >= 1);
- case EXACT:
- return EvaluationResult.valueOf(fSize == size);
- case ANY_NUMBER:
- return EvaluationResult.TRUE;
- }
- return EvaluationResult.FALSE;
- }
-
- public void collectExpressionInfo(ExpressionInfo info) {
- info.markDefaultVariableAccessed();
- }
-
- public boolean equals(final Object object) {
- if (!(object instanceof CountExpression))
- return false;
-
- final CountExpression that= (CountExpression)object;
- return (this.fMode == that.fMode) && (this.fSize == that.fSize);
- }
-
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + fMode
- * HASH_FACTOR + fSize;
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefaultVariable.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefaultVariable.java
deleted file mode 100644
index 2dc280f..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefaultVariable.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.core.expressions.IEvaluationContext;
-
-/**
- * An evaluation context that can be used to add a new default variable
- * to a hierarchy of evaluation contexts.
- *
- * @since 3.0
- */
-public final class DefaultVariable implements IEvaluationContext {
-
- private Object fDefaultVariable;
- private IEvaluationContext fParent;
- private IEvaluationContext fManagedPool;
-
- /**
- * Constructs a new variable pool for a single default variable.
- *
- * @param parent the parent context for the default variable. Must not
- * be <code>null</code>.
- * @param defaultVariable the default variable
- */
- public DefaultVariable(IEvaluationContext parent, Object defaultVariable) {
- Assert.isNotNull(parent);
- Assert.isNotNull(defaultVariable);
- fParent= parent;
- while (parent instanceof DefaultVariable) {
- parent= parent.getParent();
- }
- fManagedPool= parent;
- fDefaultVariable= defaultVariable;
- }
-
- /**
- * {@inheritDoc}
- */
- public IEvaluationContext getParent() {
- return fParent;
- }
-
- /**
- * {@inheritDoc}
- */
- public IEvaluationContext getRoot() {
- return fParent.getRoot();
- }
-
- /**
- * {@inheritDoc}
- */
- public Object getDefaultVariable() {
- return fDefaultVariable;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setAllowPluginActivation(boolean value) {
- fParent.setAllowPluginActivation(value);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean getAllowPluginActivation() {
- return fParent.getAllowPluginActivation();
- }
-
- /**
- * {@inheritDoc}
- */
- public void addVariable(String name, Object value) {
- fManagedPool.addVariable(name, value);
- }
-
- /**
- * {@inheritDoc}
- */
- public Object removeVariable(String name) {
- return fManagedPool.removeVariable(name);
- }
-
- /**
- * {@inheritDoc}
- */
- public Object getVariable(String name) {
- return fManagedPool.getVariable(name);
- }
-
- /**
- * {@inheritDoc}
- */
- public Object resolveVariable(String name, Object[] args) throws CoreException {
- return fManagedPool.resolveVariable(name, args);
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefinitionRegistry.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefinitionRegistry.java
deleted file mode 100644
index 2d8a8c1..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefinitionRegistry.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionDelta;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IRegistryChangeEvent;
-import org.eclipse.core.runtime.IRegistryChangeListener;
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionConverter;
-
-/**
- * This manages the extension point that allows core expression reuse.
- *
- * @since 3.3
- */
-public class DefinitionRegistry implements IRegistryChangeListener {
- private Map cache= null;
-
- private Map getCache() {
- if (cache == null) {
- cache= new HashMap();
- }
- return cache;
- }
-
- public DefinitionRegistry() {
- Platform.getExtensionRegistry().addRegistryChangeListener(this, "org.eclipse.core.expressions"); //$NON-NLS-1$
- }
-
- /**
- * Get the expression with the id defined by an extension. This class will
- * cache the expressions when appropriate, so it's OK to always ask the
- * registry.
- *
- * @param id The unique ID of the expression definition
- * @return the expression
- * @throws CoreException If the expression cannot be found.
- */
- public Expression getExpression(String id) throws CoreException {
- Expression cachedExpression= (Expression)getCache().get(id);
- if (cachedExpression != null) {
- return cachedExpression;
- }
-
- IExtensionRegistry registry= Platform.getExtensionRegistry();
- IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions", "definitions"); //$NON-NLS-1$ //$NON-NLS-2$
-
- Expression foundExpression= null;
- for (int i= 0; i < ces.length; i++) {
- String cid= ces[i].getAttribute("id"); //$NON-NLS-1$
- if (cid != null && cid.equals(id)) {
- try {
- foundExpression= getExpression(id, ces[i]);
- break;
- } catch (InvalidRegistryObjectException e) {
- throw new CoreException(new ExpressionStatus(ExpressionStatus.MISSING_EXPRESSION, Messages.format(
- ExpressionMessages.Missing_Expression, id)));
- }
- }
- }
- if (foundExpression == null) {
- throw new CoreException(new ExpressionStatus(ExpressionStatus.MISSING_EXPRESSION, Messages.format(
- ExpressionMessages.Missing_Expression, id)));
- }
- return foundExpression;
- }
-
- private Expression getExpression(String id, IConfigurationElement element) throws InvalidRegistryObjectException,
- CoreException {
- Expression expr= ExpressionConverter.getDefault().perform(element.getChildren()[0]);
- if (expr != null) {
- getCache().put(id, expr);
- }
- return expr;
- }
-
- public void registryChanged(IRegistryChangeEvent event) {
- IExtensionDelta[] extensionDeltas= event.getExtensionDeltas("org.eclipse.core.expressions", "definitions"); //$NON-NLS-1$//$NON-NLS-2$
- for (int i= 0; i < extensionDeltas.length; i++) {
- if (extensionDeltas[i].getKind() == IExtensionDelta.REMOVED) {
- IConfigurationElement[] ces= extensionDeltas[i].getExtension().getConfigurationElements();
- for (int j= 0; j < ces.length; j++) {
- String id= ces[j].getAttribute("id"); //$NON-NLS-1$
- if (id != null) {
- getCache().remove(id);
- }
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EnablementExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EnablementExpression.java
deleted file mode 100644
index aa2844b..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EnablementExpression.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.w3c.dom.Element;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.IEvaluationContext;
-
-public class EnablementExpression extends CompositeExpression {
-
- /**
- * Creates a {@link EnablementExpression}.
- *
- * @param configElement the configuration element
- */
- public EnablementExpression(IConfigurationElement configElement) {
- // config element not used yet.
- }
-
- /**
- * Creates a {@link EnablementExpression}.
- *
- * @param element the XML element
- */
- public EnablementExpression(Element element) {
- // element not used yet.
- }
-
- public boolean equals(final Object object) {
- if (!(object instanceof EnablementExpression))
- return false;
-
- final EnablementExpression that= (EnablementExpression)object;
- return equals(this.fExpressions, that.fExpressions);
- }
-
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- long start= 0;
- if (Expressions.TRACING)
- start= System.currentTimeMillis();
- EvaluationResult result= evaluateAnd(context);
- if (Expressions.TRACING) {
- System.out.println("[Enablement Expression] - evaluation time: " + //$NON-NLS-1$
- (System.currentTimeMillis() - start) + " ms."); //$NON-NLS-1$
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EqualsExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EqualsExpression.java
deleted file mode 100644
index 04abcad..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EqualsExpression.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.w3c.dom.Element;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionInfo;
-import org.eclipse.core.expressions.IEvaluationContext;
-
-public class EqualsExpression extends Expression {
- /**
- * The seed for the hash code for all equals expressions.
- */
- private static final int HASH_INITIAL= EqualsExpression.class.getName().hashCode();
-
- private Object fExpectedValue;
-
- public EqualsExpression(Object expectedValue) {
- Assert.isNotNull(expectedValue);
- fExpectedValue= expectedValue;
- }
-
- public EqualsExpression(IConfigurationElement element) throws CoreException {
- String value= element.getAttribute(ATT_VALUE);
- Expressions.checkAttribute(ATT_VALUE, value);
- fExpectedValue= Expressions.convertArgument(value);
- }
-
- public EqualsExpression(Element element) throws CoreException {
- String value= element.getAttribute(ATT_VALUE);
- Expressions.checkAttribute(ATT_VALUE, value.length() > 0 ? value : null);
- fExpectedValue= Expressions.convertArgument(value);
- }
-
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- Object element= context.getDefaultVariable();
- return EvaluationResult.valueOf(element.equals(fExpectedValue));
- }
-
- public void collectExpressionInfo(ExpressionInfo info) {
- info.markDefaultVariableAccessed();
- }
-
- public boolean equals(final Object object) {
- if (!(object instanceof EqualsExpression))
- return false;
-
- final EqualsExpression that= (EqualsExpression)object;
- return this.fExpectedValue.equals(that.fExpectedValue);
- }
-
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + fExpectedValue.hashCode();
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.java
deleted file mode 100644
index f5bdd2d..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.eclipse.osgi.util.NLS;
-
-public final class ExpressionMessages extends NLS {
-
- private static final String BUNDLE_NAME= "org.eclipse.core.internal.expressions.ExpressionMessages";//$NON-NLS-1$
-
- private ExpressionMessages() {
- // Do not instantiate
- }
-
- public static String Expression_attribute_missing;
- public static String Expression_attribute_invalid_value;
- public static String Expression_variable_not_a_collection;
- public static String Expression_variable_not_a_list;
-
- public static String Expression_variable_not_iterable;
- public static String Expression_variable_not_countable;
-
- public static String Expression_unknown_element;
- public static String Missing_Expression;
- public static String Expression_string_not_correctly_escaped;
- public static String Expression_string_not_terminated;
-
- public static String TypeExtender_unknownMethod;
- public static String TypeExtender_incorrectType;
-
- public static String TestExpression_no_name_space;
-
- public static String WithExpression_variable_not_defined;
-
- public static String ResolveExpression_variable_not_defined;
-
- public static String PropertyTesterDescriptor_no_namespace;
- public static String PropertyTesterDescritpri_no_properties;
-
- public static String PropertyTester_error_activating_plugin;
-
- public static String ElementHandler_unsupported_element;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, ExpressionMessages.class);
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.properties b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.properties
deleted file mode 100644
index 4127a90..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.properties
+++ /dev/null
@@ -1,41 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2007 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-Expression_attribute_missing=Mandatory attribute {0} is missing
-Expression_attribute_invalid_value=Attribute value {0} is not valid
-
-Expression_variable_not_a_collection= The default variable is not of type java.util.Collection. Failed expression: \n{0}
-Expression_variable_not_a_list= The default variable is not of type java.util.List. Failed expression: \n{0}
-
-Expression_variable_not_iterable= The default variable is not iterable. Failed expression: \n{0}
-Expression_variable_not_countable= The default variable is not countable. Failed expression: \n{0}
-
-Expression_unknown_element= Unknown expression element {0}
-Missing_Expression= Unable to locate expression definition {0}
-
-Expression_string_not_correctly_escaped= The String {0} is not correctly escaped. Wrong number of apostrophe characters.
-Expression_string_not_terminated= The String {0} is not correctly terminated with an apostrophe character.
-
-TypeExtender_unknownMethod= No property tester contributes a property {0} to type {1}
-TypeExtender_incorrectType=The implementation class is not a sub type of org.eclipse.core.expressions.PropertyTester
-
-TestExpression_no_name_space= The property attribute of the test expression must be qualified by a name space.
-
-WithExpression_variable_not_defined= The variable {0} is not defined
-
-ResolveExpression_variable_not_defined= The variable {0} is not defined
-
-PropertyTesterDescriptor_no_namespace= The mandatory attribute namespace is missing. Tester has been disabled.
-PropertyTesterDescritpri_no_properties= The mandatory attribute properties is missing. Tester has been disabled.
-
-PropertyTester_error_activating_plugin=Internal error activating plug-in {0}
-
-ElementHandler_unsupported_element=The element handler does not support DOM element conversion.
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionPlugin.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionPlugin.java
deleted file mode 100644
index c4cee1c..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionPlugin.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.osgi.framework.BundleContext;
-
-import org.eclipse.core.runtime.Plugin;
-
-public class ExpressionPlugin extends Plugin {
-
- private static ExpressionPlugin fgDefault;
-
- private BundleContext fBundleContext;
-
- public ExpressionPlugin() {
- fgDefault= this;
- }
-
- public static ExpressionPlugin getDefault() {
- return fgDefault;
- }
-
- public static String getPluginId() {
- return "org.eclipse.core.expressions"; //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- fBundleContext= context;
- }
-
- /**
- * {@inheritDoc}
- */
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
-
- public BundleContext getBundleContext() {
- return fBundleContext;
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionStatus.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionStatus.java
deleted file mode 100644
index 47ab18e..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionStatus.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-/**
- * Represents the outcome of an expression evaluation. Status objects are
- * used inside {@link org.eclipse.core.runtime.CoreException} objects to
- * indicate what went wrong.
- *
- * @see org.eclipse.core.runtime.CoreException
- *
- * @since 3.0
- */
-public class ExpressionStatus extends Status {
-
- /** Error code indicating that the variable in focus in not a collection */
- public static final int VARIABLE_IS_NOT_A_COLLECTION= 3;
-
- /** Error code indicating that the variable in focus in not a list */
- public static final int VARIABLE_IS_NOT_A_LIST= 4;
-
- /** Error code indicating that an attribute value doesn't present an integer */
- public static final int VALUE_IS_NOT_AN_INTEGER= 5;
-
- /** Error code indicating that a mandatory attribute is missing */
- public static final int MISSING_ATTRIBUTE= 50;
-
- /** Error code indicating that the value specified for an attribute is invalid */
- public static final int WRONG_ATTRIBUTE_VALUE= 51;
-
- /** Error code indicating that we are unable to find an expression */
- public static final int MISSING_EXPRESSION = 52;
-
- /** Error code indicating that the number of arguments passed to resolve variable is incorrect. */
- public static final int VARAIBLE_POOL_WRONG_NUMBER_OF_ARGUMENTS= 100;
-
- /** Error code indicating that the argument passed to resolve a variable is not of type java.lang.String */
- public static final int VARAIBLE_POOL_ARGUMENT_IS_NOT_A_STRING= 101;
-
- /** Error code indicating that a plugin providing a certain type extender isn't loaded yet */
- public static final int TYPE_EXTENDER_PLUGIN_NOT_LOADED= 200;
-
- /** Error indicating that a property referenced in a test expression can't be resolved */
- public static final int TYPE_EXTENDER_UNKOWN_METHOD= 201;
-
- /** Error code indicating that the implementation class of a type extender is not of type TypeExtender */
- public static final int TYPE_EXTENDER_INCORRECT_TYPE= 202;
-
- /** Error indicating that the value returned from a type extender isn't of type boolean */
- public static final int TEST_EXPRESSION_NOT_A_BOOLEAN= 203;
-
- /** Error indicating that the property attribute of the test element doesn't have a name space */
- public static final int NO_NAMESPACE_PROVIDED= 300;
-
- /** Error indicating that a variable accessed in a with expression isn't available in the evaluation context */
- public static final int VARIABLE_NOT_DEFINED= 301;
-
- /** Error indicating that in a string passed via a arg attribute the apostrophe character isn't correctly escaped */
- public static final int STRING_NOT_CORRECT_ESCAPED= 302;
-
- /** Error indicating that a string passed via a arg attribute isn't correctly terminated with an apostrophe */
- public static final int STRING_NOT_TERMINATED= 303;
-
- /**
- * Creates a new expression status.
- *
- * @param errorCode the error code of the status
- * @param message a human-readable message, localized to the current locale
- */
- public ExpressionStatus(int errorCode, String message) {
- this(errorCode, message, null);
- }
-
- /**
- * Creates a new expression status.
- *
- * @param errorCode the error code of the status
- * @param message a human-readable message, localized to the current locale
- * @param exception a low-level exception, or <code>null</code> if not applicable
- */
- public ExpressionStatus(int errorCode, String message, Throwable exception) {
- super(IStatus.ERROR, ExpressionPlugin.getPluginId(), errorCode, message, exception);
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Expressions.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Expressions.java
deleted file mode 100644
index 8c39ed7..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Expressions.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.w3c.dom.Element;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ICountable;
-import org.eclipse.core.expressions.IIterable;
-
-public class Expressions {
-
- /* debugging flag to enable tracing */
- public static final boolean TRACING;
- static {
- String value= Platform.getDebugOption("org.eclipse.core.expressions/tracePropertyResolving"); //$NON-NLS-1$
- TRACING= value != null && value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
-
- private Expressions() {
- // no instance
- }
-
- public static boolean isInstanceOf(Object element, String type) {
- // null isn't an instanceof of anything.
- if (element == null)
- return false;
- return isSubtype(element.getClass(), type);
- }
-
- private static boolean isSubtype(Class clazz, String type) {
- if (clazz.getName().equals(type))
- return true;
- Class superClass= clazz.getSuperclass();
- if (superClass != null && isSubtype(superClass, type))
- return true;
- Class[] interfaces= clazz.getInterfaces();
- for (int i= 0; i < interfaces.length; i++) {
- if (isSubtype(interfaces[i], type))
- return true;
- }
- return false;
- }
-
- public static void checkAttribute(String name, String value) throws CoreException {
- if (value == null) {
- throw new CoreException(new ExpressionStatus(
- ExpressionStatus.MISSING_ATTRIBUTE,
- Messages.format(ExpressionMessages.Expression_attribute_missing, name)));
- }
- }
-
- public static void checkAttribute(String name, String value, String[] validValues) throws CoreException {
- checkAttribute(name, value);
- for (int i= 0; i < validValues.length; i++) {
- if (value.equals(validValues[i]))
- return;
- }
- throw new CoreException(new ExpressionStatus(
- ExpressionStatus.WRONG_ATTRIBUTE_VALUE,
- Messages.format(ExpressionMessages.Expression_attribute_invalid_value, value)));
- }
-
- public static void checkCollection(Object var, Expression expression) throws CoreException {
- if (var instanceof Collection)
- return;
- throw new CoreException(new ExpressionStatus(
- ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION,
- Messages.format(ExpressionMessages.Expression_variable_not_a_collection, expression.toString())));
- }
-
- public static void checkList(Object var, Expression expression) throws CoreException {
- if (var instanceof List)
- return;
- throw new CoreException(new ExpressionStatus(
- ExpressionStatus.VARIABLE_IS_NOT_A_LIST,
- Messages.format(ExpressionMessages.Expression_variable_not_a_list, expression.toString())));
- }
-
- /**
- * Converts the given variable into an <code>IIterable</code>. If a corresponding adapter can't be found an
- * exception is thrown. If the corresponding adapter isn't loaded yet, <code>null</code> is returned.
- *
- * @param var the variable to turn into an <code>IIterable</code>
- * @param expression the expression referring to the variable
- *
- * @return the <code>IIterable</code> or <code>null<code> if a corresponding adapter isn't loaded yet
- *
- * @throws CoreException if the var can't be adapted to an <code>IIterable</code>
- */
- public static IIterable getAsIIterable(Object var, Expression expression) throws CoreException {
- if (var instanceof IIterable) {
- return (IIterable)var;
- } else {
- IAdapterManager manager= Platform.getAdapterManager();
- IIterable result= (IIterable)manager.getAdapter(var, IIterable.class);
- if (result != null)
- return result;
-
- if (manager.queryAdapter(var, IIterable.class.getName()) == IAdapterManager.NOT_LOADED)
- return null;
-
- throw new CoreException(new ExpressionStatus(
- ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION,
- Messages.format(ExpressionMessages.Expression_variable_not_iterable, expression.toString())));
- }
- }
-
- /**
- * Converts the given variable into an <code>ICountable</code>. If a corresponding adapter can't be found an
- * exception is thrown. If the corresponding adapter isn't loaded yet, <code>null</code> is returned.
- *
- * @param var the variable to turn into an <code>ICountable</code>
- * @param expression the expression referring to the variable
- *
- * @return the <code>ICountable</code> or <code>null<code> if a corresponding adapter isn't loaded yet
- *
- * @throws CoreException if the var can't be adapted to an <code>ICountable</code>
- */
- public static ICountable getAsICountable(Object var, Expression expression) throws CoreException {
- if (var instanceof ICountable) {
- return (ICountable)var;
- } else {
- IAdapterManager manager= Platform.getAdapterManager();
- ICountable result= (ICountable)manager.getAdapter(var, ICountable.class);
- if (result != null)
- return result;
-
- if (manager.queryAdapter(var, ICountable.class.getName()) == IAdapterManager.NOT_LOADED)
- return null;
-
- throw new CoreException(new ExpressionStatus(
- ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION,
- Messages.format(ExpressionMessages.Expression_variable_not_countable, expression.toString())));
- }
- }
-
- public static boolean getOptionalBooleanAttribute(IConfigurationElement element, String attributeName) {
- String value= element.getAttribute(attributeName);
- if (value == null)
- return false;
- return Boolean.valueOf(value).booleanValue();
- }
-
- public static boolean getOptionalBooleanAttribute(Element element, String attributeName) {
- String value= element.getAttribute(attributeName);
- if (value.length() == 0)
- return false;
- return Boolean.valueOf(value).booleanValue();
- }
-
- //---- Argument parsing --------------------------------------------
-
- public static final Object[] EMPTY_ARGS= new Object[0];
-
- public static Object[] getArguments(IConfigurationElement element, String attributeName) throws CoreException {
- String args= element.getAttribute(attributeName);
- if (args != null) {
- return parseArguments(args);
- } else {
- return EMPTY_ARGS;
- }
- }
-
- public static Object[] getArguments(Element element, String attributeName) throws CoreException {
- String args= element.getAttribute(attributeName);
- if (args.length() > 0) {
- return parseArguments(args);
- } else {
- return EMPTY_ARGS;
- }
- }
-
- public static Object[] parseArguments(String args) throws CoreException {
- List result= new ArrayList();
- int start= 0;
- int comma;
- while ((comma= findNextComma(args, start)) != -1) {
- result.add(convertArgument(args.substring(start, comma).trim()));
- start= comma + 1;
- }
- result.add(convertArgument(args.substring(start).trim()));
- return result.toArray();
- }
-
- private static int findNextComma(String str, int start) throws CoreException {
- boolean inString= false;
- for (int i= start; i < str.length(); i++) {
- char ch= str.charAt(i);
- if (ch == ',' && ! inString)
- return i;
- if (ch == '\'') {
- if (!inString) {
- inString= true;
- } else {
- if (i + 1 < str.length() && str.charAt(i + 1) == '\'') {
- i++;
- } else {
- inString= false;
- }
- }
- } else if (ch == ',' && !inString) {
- return i;
- }
- }
- if (inString)
- throw new CoreException(new ExpressionStatus(
- ExpressionStatus.STRING_NOT_TERMINATED,
- Messages.format(ExpressionMessages.Expression_string_not_terminated, str)));
-
- return -1;
- }
-
- public static Object convertArgument(String arg) throws CoreException {
- if (arg == null) {
- return null;
- } else if (arg.length() == 0) {
- return arg;
- } else if (arg.charAt(0) == '\'' && arg.charAt(arg.length() - 1) == '\'') {
- return unEscapeString(arg.substring(1, arg.length() - 1));
- } else if ("true".equals(arg)) { //$NON-NLS-1$
- return Boolean.TRUE;
- } else if ("false".equals(arg)) { //$NON-NLS-1$
- return Boolean.FALSE;
- } else if (arg.indexOf('.') != -1) {
- try {
- return Float.valueOf(arg);
- } catch (NumberFormatException e) {
- return arg;
- }
- } else {
- try {
- return Integer.valueOf(arg);
- } catch (NumberFormatException e) {
- return arg;
- }
- }
- }
-
- public static String unEscapeString(String str) throws CoreException {
- StringBuffer result= new StringBuffer();
- for (int i= 0; i < str.length(); i++) {
- char ch= str.charAt(i);
- if (ch == '\'') {
- if (i == str.length() - 1 || str.charAt(i + 1) != '\'')
- throw new CoreException(new ExpressionStatus(
- ExpressionStatus.STRING_NOT_CORRECT_ESCAPED,
- Messages.format(ExpressionMessages.Expression_string_not_correctly_escaped, str)));
- result.append('\'');
- i++;
- } else {
- result.append(ch);
- }
- }
- return result.toString();
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/InstanceofExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/InstanceofExpression.java
deleted file mode 100644
index 54ddc1c..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/InstanceofExpression.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.w3c.dom.Element;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionInfo;
-import org.eclipse.core.expressions.IEvaluationContext;
-
-public class InstanceofExpression extends Expression {
- /**
- * The seed for the hash code for all instance of expressions.
- */
- private static final int HASH_INITIAL= InstanceofExpression.class.getName().hashCode();
-
- private String fTypeName;
-
- public InstanceofExpression(IConfigurationElement element) throws CoreException {
- fTypeName= element.getAttribute(ATT_VALUE);
- Expressions.checkAttribute(ATT_VALUE, fTypeName);
- }
-
- public InstanceofExpression(Element element) throws CoreException {
- fTypeName= element.getAttribute(ATT_VALUE);
- Expressions.checkAttribute(ATT_VALUE, fTypeName.length() > 0 ? fTypeName : null);
- }
-
- public InstanceofExpression(String typeName) {
- Assert.isNotNull(typeName);
- fTypeName= typeName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jdt.internal.corext.refactoring.participants.Expression#evaluate(java.lang.Object)
- */
- public EvaluationResult evaluate(IEvaluationContext context) {
- Object element= context.getDefaultVariable();
- return EvaluationResult.valueOf(Expressions.isInstanceOf(element, fTypeName));
- }
-
- public void collectExpressionInfo(ExpressionInfo info) {
- info.markDefaultVariableAccessed();
- }
-
- public boolean equals(final Object object) {
- if (!(object instanceof InstanceofExpression))
- return false;
-
- final InstanceofExpression that= (InstanceofExpression) object;
- return this.fTypeName.equals(that.fTypeName);
- }
-
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + fTypeName.hashCode();
- }
-
- //---- Debugging ---------------------------------------------------
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return "<instanceof value=\"" + fTypeName + "\"/>"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/IterateExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/IterateExpression.java
deleted file mode 100644
index 1d516e7..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/IterateExpression.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.w3c.dom.Element;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.ExpressionInfo;
-import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.core.expressions.IIterable;
-
-public class IterateExpression extends CompositeExpression {
-
- private static class IteratePool implements IEvaluationContext {
-
- private Iterator fIterator;
- private Object fDefaultVariable;
- private IEvaluationContext fParent;
-
- public IteratePool(IEvaluationContext parent, Iterator iterator) {
- Assert.isNotNull(parent);
- Assert.isNotNull(iterator);
- fParent= parent;
- fIterator= iterator;
- }
- public IEvaluationContext getParent() {
- return fParent;
- }
- public IEvaluationContext getRoot() {
- return fParent.getRoot();
- }
- public Object getDefaultVariable() {
- return fDefaultVariable;
- }
- public boolean getAllowPluginActivation() {
- return fParent.getAllowPluginActivation();
- }
- public void setAllowPluginActivation(boolean value) {
- fParent.setAllowPluginActivation(value);
- }
- public void addVariable(String name, Object value) {
- fParent.addVariable(name, value);
- }
- public Object removeVariable(String name) {
- return fParent.removeVariable(name);
- }
- public Object getVariable(String name) {
- return fParent.getVariable(name);
- }
- public Object resolveVariable(String name, Object[] args) throws CoreException {
- return fParent.resolveVariable(name, args);
- }
- public Object next() {
- fDefaultVariable= fIterator.next();
- return fDefaultVariable;
- }
- public boolean hasNext() {
- return fIterator.hasNext();
- }
- }
-
- private static final String ATT_OPERATOR= "operator"; //$NON-NLS-1$
- private static final String ATT_IF_EMPTY= "ifEmpty"; //$NON-NLS-1$
- private static final int OR= 1;
- private static final int AND= 2;
-
- /**
- * The seed for the hash code for all iterate expressions.
- */
- private static final int HASH_INITIAL= IterateExpression.class.getName().hashCode();
-
- private int fOperator;
- private Boolean fEmptyResult;
-
- public IterateExpression(IConfigurationElement configElement) throws CoreException {
- String opValue= configElement.getAttribute(ATT_OPERATOR);
- initializeOperatorValue(opValue);
- initializeEmptyResultValue(configElement.getAttribute(ATT_IF_EMPTY));
- }
-
- public IterateExpression(Element element) throws CoreException {
- String opValue= element.getAttribute(ATT_OPERATOR);
- initializeOperatorValue(opValue.length() > 0 ? opValue : null);
- String ifEmpty= element.getAttribute(ATT_IF_EMPTY);
- initializeEmptyResultValue(ifEmpty.length() > 0 ? ifEmpty : null);
- }
-
- public IterateExpression(String opValue) throws CoreException {
- initializeOperatorValue(opValue);
- }
-
- public IterateExpression(String opValue, String ifEmpty) throws CoreException {
- initializeOperatorValue(opValue);
- initializeEmptyResultValue(ifEmpty);
- }
-
- private void initializeOperatorValue(String opValue) throws CoreException {
- if (opValue == null) {
- fOperator= AND;
- } else {
- Expressions.checkAttribute(ATT_OPERATOR, opValue, new String[] {"and", "or"}); //$NON-NLS-1$//$NON-NLS-2$
- if ("and".equals(opValue)) { //$NON-NLS-1$
- fOperator= AND;
- } else {
- fOperator= OR;
- }
- }
- }
-
- private void initializeEmptyResultValue(String value) {
- if (value == null) {
- fEmptyResult= null;
- } else {
- fEmptyResult= Boolean.valueOf(value);
- }
- }
-
- /* (non-Javadoc)
- * @see Expression#evaluate(IVariablePool)
- */
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- Object var= context.getDefaultVariable();
- if (var instanceof Collection) {
- Collection col= (Collection)var;
- switch (col.size()) {
- case 0:
- if (fEmptyResult == null) {
- return fOperator == AND ? EvaluationResult.TRUE : EvaluationResult.FALSE;
- } else {
- return fEmptyResult.booleanValue() ? EvaluationResult.TRUE : EvaluationResult.FALSE;
- }
- case 1:
- if (col instanceof List)
- return evaluateAnd(new DefaultVariable(context, ((List)col).get(0)));
- // fall through
- default:
- IteratePool iter= new IteratePool(context, col.iterator());
- EvaluationResult result= fOperator == AND ? EvaluationResult.TRUE : EvaluationResult.FALSE;
- while (iter.hasNext()) {
- iter.next();
- switch(fOperator) {
- case OR:
- result= result.or(evaluateAnd(iter));
- if (result == EvaluationResult.TRUE)
- return result;
- break;
- case AND:
- result= result.and(evaluateAnd(iter));
- if (result != EvaluationResult.TRUE)
- return result;
- break;
- }
- }
- return result;
- }
- } else {
- IIterable iterable= Expressions.getAsIIterable(var, this);
- if (iterable == null)
- return EvaluationResult.NOT_LOADED;
- int count= 0;
- IteratePool iter= new IteratePool(context, iterable.iterator());
- EvaluationResult result= fOperator == AND ? EvaluationResult.TRUE : EvaluationResult.FALSE;
- while (iter.hasNext()) {
- iter.next();
- count++;
- switch(fOperator) {
- case OR:
- result= result.or(evaluateAnd(iter));
- if (result == EvaluationResult.TRUE)
- return result;
- break;
- case AND:
- result= result.and(evaluateAnd(iter));
- if (result != EvaluationResult.TRUE)
- return result;
- break;
- }
- }
- if (count > 0) {
- return result;
- } else {
- if (fEmptyResult == null) {
- return fOperator == AND ? EvaluationResult.TRUE : EvaluationResult.FALSE;
- } else {
- return fEmptyResult.booleanValue() ? EvaluationResult.TRUE : EvaluationResult.FALSE;
- }
- }
- }
- }
-
- public void collectExpressionInfo(ExpressionInfo info) {
- // Although we access every single variable we only mark the default
- // variable as accessed since we don't have single variables for the
- // elements.
- info.markDefaultVariableAccessed();
- super.collectExpressionInfo(info);
- }
-
- public boolean equals(final Object object) {
- if (!(object instanceof IterateExpression))
- return false;
-
- final IterateExpression that= (IterateExpression)object;
- return (this.fOperator == that.fOperator) && equals(this.fExpressions, that.fExpressions);
- }
-
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + hashCode(fExpressions)
- * HASH_FACTOR + fOperator;
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Messages.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Messages.java
deleted file mode 100644
index 813a2f7..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Messages.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.eclipse.osgi.util.NLS;
-
-
-/**
- * Helper class to format message strings.
- *
- * @since 3.1
- */
-public class Messages {
-
- public static String format(String message, Object object) {
- return NLS.bind(message, object);
- }
-
- public static String format(String message, Object[] objects) {
- return NLS.bind(message, objects);
- }
-
- private Messages() {
- // Not for instantiation
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/NotExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/NotExpression.java
deleted file mode 100644
index 53d0aec..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/NotExpression.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionInfo;
-import org.eclipse.core.expressions.IEvaluationContext;
-
-public class NotExpression extends Expression {
- /**
- * The seed for the hash code for all not expressions.
- */
- private static final int HASH_INITIAL= NotExpression.class.getName().hashCode();
-
- private Expression fExpression;
-
- public NotExpression(Expression expression) {
- Assert.isNotNull(expression);
- fExpression= expression;
- }
-
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- return fExpression.evaluate(context).not();
- }
-
- public void collectExpressionInfo(ExpressionInfo info) {
- fExpression.collectExpressionInfo(info);
- }
-
- public boolean equals(final Object object) {
- if (!(object instanceof NotExpression))
- return false;
-
- final NotExpression that= (NotExpression)object;
- return this.fExpression.equals(that.fExpression);
- }
-
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + fExpression.hashCode();
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/OrExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/OrExpression.java
deleted file mode 100644
index b19e28b..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/OrExpression.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.IEvaluationContext;
-
-public class OrExpression extends CompositeExpression {
-
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- return evaluateOr(context);
- }
-
- public boolean equals(final Object object) {
- if (!(object instanceof OrExpression))
- return false;
-
- final OrExpression that= (OrExpression)object;
- return equals(this.fExpressions, that.fExpressions);
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Property.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Property.java
deleted file mode 100644
index 4624303..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Property.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.eclipse.core.runtime.Assert;
-
-import org.eclipse.core.expressions.IPropertyTester;
-
-public class Property {
-
- private Class fType;
- private String fNamespace;
- private String fName;
-
- private IPropertyTester fTester;
-
- /* package */ Property(Class type, String namespace, String name) {
- Assert.isNotNull(type);
- Assert.isNotNull(namespace);
- Assert.isNotNull(name);
-
- fType= type;
- fNamespace= namespace;
- fName= name;
- }
-
- /* package */ void setPropertyTester(IPropertyTester tester) {
- Assert.isNotNull(tester);
- fTester= tester;
- }
-
- public boolean isInstantiated() {
- return fTester.isInstantiated();
- }
-
- public boolean isDeclaringPluginActive() {
- return fTester.isDeclaringPluginActive();
- }
-
- public boolean isValidCacheEntry(boolean forcePluginActivation) {
- if (forcePluginActivation) {
- return isInstantiated() && isDeclaringPluginActive();
- } else {
- return (isInstantiated() && isDeclaringPluginActive()) ||
- (!isInstantiated() && !isDeclaringPluginActive());
- }
- }
-
- public boolean test(Object receiver, Object[] args, Object expectedValue) {
- return fTester.test(receiver, fName, args, expectedValue);
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof Property))
- return false;
- Property other= (Property)obj;
- return fType.equals(other.fType) && fNamespace.equals(other.fNamespace) && fName.equals(other.fName);
- }
-
- public int hashCode() {
- return (fType.hashCode() << 16) | fNamespace.hashCode() << 8 | fName.hashCode();
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyCache.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyCache.java
deleted file mode 100644
index 4840827..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyCache.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.eclipse.core.internal.expressions.util.LRUCache;
-
-/* package */ class PropertyCache {
-
- private LRUCache fCache;
-
- public PropertyCache(final int cacheSize) {
- fCache= new LRUCache(100);
- fCache.setSpaceLimit(cacheSize);
- }
-
- public Property get(Property key) {
- return (Property)fCache.get(key);
- }
-
- public void put(Property method) {
- fCache.put(method, method);
- }
-
- public void remove(Property method) {
- fCache.removeKey(method);
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyTesterDescriptor.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyTesterDescriptor.java
deleted file mode 100644
index 10adaa5..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyTesterDescriptor.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.osgi.framework.Bundle;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.core.expressions.IPropertyTester;
-
-public class PropertyTesterDescriptor implements IPropertyTester {
-
- private IConfigurationElement fConfigElement;
- private String fNamespace;
- private String fProperties;
-
- private static final String PROPERTIES= "properties"; //$NON-NLS-1$
- private static final String NAMESPACE= "namespace"; //$NON-NLS-1$
- private static final String CLASS= "class"; //$NON-NLS-1$
-
- public PropertyTesterDescriptor(IConfigurationElement element) throws CoreException {
- fConfigElement= element;
- fNamespace= fConfigElement.getAttribute(NAMESPACE);
- if (fNamespace == null) {
- throw new CoreException(new Status(IStatus.ERROR, ExpressionPlugin.getPluginId(),
- IStatus.ERROR,
- ExpressionMessages.PropertyTesterDescriptor_no_namespace,
- null));
- }
- StringBuffer buffer= new StringBuffer(","); //$NON-NLS-1$
- String properties= element.getAttribute(PROPERTIES);
- if (properties == null) {
- throw new CoreException(new Status(IStatus.ERROR, ExpressionPlugin.getPluginId(),
- IStatus.ERROR,
- ExpressionMessages.PropertyTesterDescritpri_no_properties,
- null));
- }
- for (int i= 0; i < properties.length(); i++) {
- char ch= properties.charAt(i);
- if (!Character.isWhitespace(ch))
- buffer.append(ch);
- }
- buffer.append(',');
- fProperties= buffer.toString();
- }
-
- public PropertyTesterDescriptor(IConfigurationElement element, String namespace, String properties) {
- fConfigElement= element;
- fNamespace= namespace;
- fProperties= properties;
- }
-
- public String getProperties() {
- return fProperties;
- }
-
- public String getNamespace() {
- return fNamespace;
- }
-
- public IConfigurationElement getConfigurationElement() {
- return fConfigElement;
- }
-
- public boolean handles(String namespace, String property) {
- return fNamespace.equals(namespace) && fProperties.indexOf("," + property + ",") != -1; //$NON-NLS-1$//$NON-NLS-2$
- }
-
- public boolean isInstantiated() {
- return false;
- }
-
- public boolean isDeclaringPluginActive() {
- Bundle fBundle= Platform.getBundle(fConfigElement.getContributor().getName());
- return fBundle.getState() == Bundle.ACTIVE;
- }
-
- public IPropertyTester instantiate() throws CoreException {
- return (IPropertyTester)fConfigElement.createExecutableExtension(CLASS);
- }
-
- public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
- Assert.isTrue(false, "Method should never be called"); //$NON-NLS-1$
- return false;
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ReferenceExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ReferenceExpression.java
deleted file mode 100644
index 68cc402..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ReferenceExpression.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.w3c.dom.Element;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionInfo;
-import org.eclipse.core.expressions.IEvaluationContext;
-
-/**
- * This class makes use of the <b>org.eclipse.core.expressions.definitions</b>
- * extension point to evaluate the current context against pre-defined
- * expressions. It provides core expression re-use.
- *
- * @since 3.3
- */
-public class ReferenceExpression extends Expression {
-
- // consider making this a more general extension manager
- // for now it's just part of the reference expression
- private static DefinitionRegistry fgDefinitionRegistry= null;
-
- private static DefinitionRegistry getDefinitionRegistry() {
- if (fgDefinitionRegistry == null) {
- fgDefinitionRegistry= new DefinitionRegistry();
- }
- return fgDefinitionRegistry;
- }
-
- private static final String ATT_DEFINITION_ID= "definitionId"; //$NON-NLS-1$
-
- /**
- * The seed for the hash code for all equals expressions.
- */
- private static final int HASH_INITIAL= ReferenceExpression.class.getName().hashCode();
-
- private String fDefinitionId;
-
- public ReferenceExpression(String definitionId) {
- Assert.isNotNull(definitionId);
- fDefinitionId= definitionId;
- }
-
- public ReferenceExpression(IConfigurationElement element) throws CoreException {
- fDefinitionId= element.getAttribute(ATT_DEFINITION_ID);
- Expressions.checkAttribute(ATT_DEFINITION_ID, fDefinitionId);
- }
-
- public ReferenceExpression(Element element) throws CoreException {
- fDefinitionId= element.getAttribute(ATT_DEFINITION_ID);
- Expressions.checkAttribute(ATT_DEFINITION_ID, fDefinitionId.length() > 0 ? fDefinitionId : null);
- }
-
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- Expression expr= getDefinitionRegistry().getExpression(fDefinitionId);
- return expr.evaluate(context);
- }
-
- public void collectExpressionInfo(ExpressionInfo info) {
- Expression expr;
- try {
- expr= getDefinitionRegistry().getExpression(fDefinitionId);
- } catch (CoreException e) {
- // We didn't find the expression definition. So no
- // expression info can be collected.
- return;
- }
- expr.collectExpressionInfo(info);
- }
-
- public boolean equals(final Object object) {
- if (!(object instanceof ReferenceExpression))
- return false;
-
- final ReferenceExpression that= (ReferenceExpression)object;
- return this.fDefinitionId.equals(that.fDefinitionId);
- }
-
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + fDefinitionId.hashCode();
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ResolveExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ResolveExpression.java
deleted file mode 100644
index da1a5f8..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ResolveExpression.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.w3c.dom.Element;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.ExpressionInfo;
-import org.eclipse.core.expressions.IEvaluationContext;
-
-public class ResolveExpression extends CompositeExpression {
-
- private String fVariable;
- private Object[] fArgs;
-
- private static final String ATT_VARIABLE= "variable"; //$NON-NLS-1$
- private static final String ATT_ARGS= "args"; //$NON-NLS-1$
-
- /**
- * The seed for the hash code for all resolve expressions.
- */
- private static final int HASH_INITIAL= ResolveExpression.class.getName().hashCode();
-
- public ResolveExpression(IConfigurationElement configElement) throws CoreException {
- fVariable= configElement.getAttribute(ATT_VARIABLE);
- Expressions.checkAttribute(ATT_VARIABLE, fVariable);
- fArgs= Expressions.getArguments(configElement, ATT_ARGS);
- }
-
- public ResolveExpression(Element element) throws CoreException {
- fVariable= element.getAttribute(ATT_VARIABLE);
- Expressions.checkAttribute(ATT_VARIABLE, fVariable.length() > 0 ? fVariable : null);
- fArgs= Expressions.getArguments(element, ATT_ARGS);
- }
-
- public ResolveExpression(String variable, Object[] args) {
- Assert.isNotNull(variable);
- fVariable= variable;
- fArgs= args;
- }
-
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- Object variable= context.resolveVariable(fVariable, fArgs);
- if (variable == null) {
- throw new CoreException(new ExpressionStatus(
- ExpressionStatus.VARIABLE_NOT_DEFINED,
- Messages.format(ExpressionMessages.ResolveExpression_variable_not_defined, fVariable)));
- }
- return evaluateAnd(new EvaluationContext(context, variable));
- }
-
- public void collectExpressionInfo(ExpressionInfo info) {
- ExpressionInfo other= new ExpressionInfo();
- super.collectExpressionInfo(other);
- if (other.hasDefaultVariableAccess()) {
- info.addVariableNameAccess(fVariable);
- }
- info.mergeExceptDefaultVariable(other);
- }
-
- public boolean equals(final Object object) {
- if (!(object instanceof ResolveExpression))
- return false;
-
- final ResolveExpression that= (ResolveExpression)object;
- return this.fVariable.equals(that.fVariable)
- && equals(this.fArgs, that.fArgs)
- && equals(this.fExpressions, that.fExpressions);
- }
-
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + hashCode(fExpressions)
- * HASH_FACTOR + hashCode(fArgs)
- * HASH_FACTOR + fVariable.hashCode();
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/StandardElementHandler.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/StandardElementHandler.java
deleted file mode 100644
index 2f7d5be..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/StandardElementHandler.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.core.expressions.ElementHandler;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionConverter;
-import org.eclipse.core.expressions.ExpressionTagNames;
-
-public class StandardElementHandler extends ElementHandler {
-
- public Expression create(ExpressionConverter converter, IConfigurationElement element) throws CoreException {
- String name= element.getName();
- if (ExpressionTagNames.INSTANCEOF.equals(name)) {
- return new InstanceofExpression(element);
- } else if (ExpressionTagNames.TEST.equals(name)) {
- return new TestExpression(element);
- } else if (ExpressionTagNames.OR.equals(name)) {
- OrExpression result= new OrExpression();
- processChildren(converter, element, result);
- return result;
- } else if (ExpressionTagNames.AND.equals(name)) {
- AndExpression result= new AndExpression();
- processChildren(converter, element, result);
- return result;
- } else if (ExpressionTagNames.NOT.equals(name)) {
- return new NotExpression(converter.perform(element.getChildren()[0]));
- } else if (ExpressionTagNames.WITH.equals(name)) {
- WithExpression result= new WithExpression(element);
- processChildren(converter, element, result);
- return result;
- } else if (ExpressionTagNames.ADAPT.equals(name)) {
- AdaptExpression result= new AdaptExpression(element);
- processChildren(converter, element, result);
- return result;
- } else if (ExpressionTagNames.ITERATE.equals(name)) {
- IterateExpression result= new IterateExpression(element);
- processChildren(converter, element, result);
- return result;
- } else if (ExpressionTagNames.COUNT.equals(name)) {
- return new CountExpression(element);
- } else if (ExpressionTagNames.SYSTEM_TEST.equals(name)) {
- return new SystemTestExpression(element);
- } else if (ExpressionTagNames.RESOLVE.equals(name)) {
- ResolveExpression result= new ResolveExpression(element);
- processChildren(converter, element, result);
- return result;
- } else if (ExpressionTagNames.ENABLEMENT.equals(name)) {
- EnablementExpression result= new EnablementExpression(element);
- processChildren(converter, element, result);
- return result;
- } else if (ExpressionTagNames.EQUALS.equals(name)) {
- return new EqualsExpression(element);
- } else if (ExpressionTagNames.REFERENCE.equals(name)) {
- return new ReferenceExpression(element);
- }
- return null;
- }
-
- public Expression create(ExpressionConverter converter, Element element) throws CoreException {
- String name= element.getNodeName();
- if (ExpressionTagNames.INSTANCEOF.equals(name)) {
- return new InstanceofExpression(element);
- } else if (ExpressionTagNames.TEST.equals(name)) {
- return new TestExpression(element);
- } else if (ExpressionTagNames.OR.equals(name)) {
- OrExpression result= new OrExpression();
- processChildren(converter, element, result);
- return result;
- } else if (ExpressionTagNames.AND.equals(name)) {
- AndExpression result= new AndExpression();
- processChildren(converter, element, result);
- return result;
- } else if (ExpressionTagNames.NOT.equals(name)) {
- Node child = element.getFirstChild();
- while (child != null) {
- if (child.getNodeType() == Node.ELEMENT_NODE) {
- return new NotExpression(converter.perform((Element)child));
- }
- child = child.getNextSibling();
- }
- } else if (ExpressionTagNames.WITH.equals(name)) {
- WithExpression result= new WithExpression(element);
- processChildren(converter, element, result);
- return result;
- } else if (ExpressionTagNames.ADAPT.equals(name)) {
- AdaptExpression result= new AdaptExpression(element);
- processChildren(converter, element, result);
- return result;
- } else if (ExpressionTagNames.ITERATE.equals(name)) {
- IterateExpression result= new IterateExpression(element);
- processChildren(converter, element, result);
- return result;
- } else if (ExpressionTagNames.COUNT.equals(name)) {
- return new CountExpression(element);
- } else if (ExpressionTagNames.SYSTEM_TEST.equals(name)) {
- return new SystemTestExpression(element);
- } else if (ExpressionTagNames.RESOLVE.equals(name)) {
- ResolveExpression result= new ResolveExpression(element);
- processChildren(converter, element, result);
- return result;
- } else if (ExpressionTagNames.ENABLEMENT.equals(name)) {
- EnablementExpression result= new EnablementExpression(element);
- processChildren(converter, element, result);
- return result;
- } else if (ExpressionTagNames.EQUALS.equals(name)) {
- return new EqualsExpression(element);
- } else if (ExpressionTagNames.REFERENCE.equals(name)) {
- return new ReferenceExpression(element);
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/SystemTestExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/SystemTestExpression.java
deleted file mode 100644
index 2b649ea..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/SystemTestExpression.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.w3c.dom.Element;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionInfo;
-import org.eclipse.core.expressions.IEvaluationContext;
-
-public class SystemTestExpression extends Expression {
-
- private String fProperty;
- private String fExpectedValue;
-
- private static final String ATT_PROPERTY= "property"; //$NON-NLS-1$
-
- /**
- * The seed for the hash code for all system test expressions.
- */
- private static final int HASH_INITIAL= SystemTestExpression.class.getName().hashCode();
-
- public SystemTestExpression(IConfigurationElement element) throws CoreException {
- fProperty= element.getAttribute(ATT_PROPERTY);
- Expressions.checkAttribute(ATT_PROPERTY, fProperty);
- fExpectedValue= element.getAttribute(ATT_VALUE);
- Expressions.checkAttribute(ATT_VALUE, fExpectedValue);
- }
-
- public SystemTestExpression(Element element) throws CoreException {
- fProperty= element.getAttribute(ATT_PROPERTY);
- Expressions.checkAttribute(ATT_PROPERTY, fProperty.length() > 0 ? fProperty : null);
- fExpectedValue= element.getAttribute(ATT_VALUE);
- Expressions.checkAttribute(ATT_VALUE, fExpectedValue.length() > 0 ? fExpectedValue : null);
- }
-
- public SystemTestExpression(String property, String expectedValue) {
- Assert.isNotNull(property);
- Assert.isNotNull(expectedValue);
- fProperty= property;
- fExpectedValue= expectedValue;
- }
-
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- String str= System.getProperty(fProperty);
- if (str == null)
- return EvaluationResult.FALSE;
- return EvaluationResult.valueOf(str.equals(fExpectedValue));
- }
-
- public void collectExpressionInfo(ExpressionInfo info) {
- info.markSystemPropertyAccessed();
- }
-
- public boolean equals(final Object object) {
- if (!(object instanceof SystemTestExpression))
- return false;
-
- final SystemTestExpression that= (SystemTestExpression)object;
- return this.fProperty.equals(that.fProperty)
- && this.fExpectedValue.equals(that.fExpectedValue);
- }
-
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + fExpectedValue.hashCode()
- * HASH_FACTOR + fProperty.hashCode();
- }
-
- // ---- Debugging ---------------------------------------------------
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return "<systemTest property=\"" + fProperty + //$NON-NLS-1$
- "\" value=\"" + fExpectedValue + "\""; //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TestExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TestExpression.java
deleted file mode 100644
index fa870b0..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TestExpression.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.w3c.dom.Element;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionInfo;
-import org.eclipse.core.expressions.IEvaluationContext;
-
-public class TestExpression extends Expression {
-
- private String fNamespace;
- private String fProperty;
- private Object[] fArgs;
- private Object fExpectedValue;
- private boolean fForcePluginActivation;
-
- private static final char PROP_SEP = '.';
- private static final String ATT_PROPERTY= "property"; //$NON-NLS-1$
- private static final String ATT_ARGS= "args"; //$NON-NLS-1$
- private static final String ATT_FORCE_PLUGIN_ACTIVATION= "forcePluginActivation"; //$NON-NLS-1$
- /**
- * The seed for the hash code for all test expressions.
- */
- private static final int HASH_INITIAL= TestExpression.class.getName().hashCode();
-
- private static final TypeExtensionManager fgTypeExtensionManager= new TypeExtensionManager("propertyTesters"); //$NON-NLS-1$
-
- public TestExpression(IConfigurationElement element) throws CoreException {
- String property= element.getAttribute(ATT_PROPERTY);
- int pos= property.lastIndexOf(PROP_SEP);
- if (pos == -1) {
- throw new CoreException(new ExpressionStatus(
- ExpressionStatus.NO_NAMESPACE_PROVIDED,
- ExpressionMessages.TestExpression_no_name_space));
- }
- fNamespace= property.substring(0, pos);
- fProperty= property.substring(pos + 1);
- fArgs= Expressions.getArguments(element, ATT_ARGS);
- fExpectedValue= Expressions.convertArgument(element.getAttribute(ATT_VALUE));
- fForcePluginActivation= Expressions.getOptionalBooleanAttribute(element, ATT_FORCE_PLUGIN_ACTIVATION);
- }
-
- public TestExpression(Element element) throws CoreException {
- String property= element.getAttribute(ATT_PROPERTY);
- int pos= property.lastIndexOf(PROP_SEP);
- if (pos == -1) {
- throw new CoreException(new ExpressionStatus(
- ExpressionStatus.NO_NAMESPACE_PROVIDED,
- ExpressionMessages.TestExpression_no_name_space));
- }
- fNamespace= property.substring(0, pos);
- fProperty= property.substring(pos + 1);
- fArgs= Expressions.getArguments(element, ATT_ARGS);
- String value = element.getAttribute(ATT_VALUE);
- fExpectedValue= Expressions.convertArgument(value.length() > 0 ? value : null);
- fForcePluginActivation= Expressions.getOptionalBooleanAttribute(element, ATT_FORCE_PLUGIN_ACTIVATION);
- }
-
- public TestExpression(String namespace, String property, Object[] args, Object expectedValue) {
- this(namespace, property, args, expectedValue, false);
- }
-
- public TestExpression(String namespace, String property, Object[] args, Object expectedValue, boolean forcePluginActivation) {
- Assert.isNotNull(namespace);
- Assert.isNotNull(property);
- fNamespace= namespace;
- fProperty= property;
- fArgs= args != null ? args : Expressions.EMPTY_ARGS;
- fExpectedValue= expectedValue;
- fForcePluginActivation= forcePluginActivation;
- }
-
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- Object element= context.getDefaultVariable();
- if (System.class.equals(element)) {
- String str= System.getProperty(fProperty);
- if (str == null)
- return EvaluationResult.FALSE;
- return EvaluationResult.valueOf(str.equals(fArgs[0]));
- }
- Property property= fgTypeExtensionManager.getProperty(element, fNamespace, fProperty, context.getAllowPluginActivation() && fForcePluginActivation);
- if (!property.isInstantiated())
- return EvaluationResult.NOT_LOADED;
- return EvaluationResult.valueOf(property.test(element, fArgs, fExpectedValue));
- }
-
- public void collectExpressionInfo(ExpressionInfo info) {
- info.markDefaultVariableAccessed();
- info.addAccessedPropertyName(fNamespace + PROP_SEP + fProperty);
- }
-
- public boolean equals(final Object object) {
- if (!(object instanceof TestExpression))
- return false;
-
- final TestExpression that= (TestExpression)object;
- return this.fNamespace.equals(that.fNamespace) && this.fProperty.equals(that.fProperty)
- && this.fForcePluginActivation == that.fForcePluginActivation
- && equals(this.fArgs, that.fArgs) && equals(this.fExpectedValue, that.fExpectedValue);
- }
-
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + hashCode(fArgs)
- * HASH_FACTOR + hashCode(fExpectedValue)
- * HASH_FACTOR + fNamespace.hashCode()
- * HASH_FACTOR + fProperty.hashCode()
- * HASH_FACTOR + (fForcePluginActivation ? 1 : 0);
- }
-
- //---- Debugging ---------------------------------------------------
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString() {
- StringBuffer args= new StringBuffer();
- for (int i= 0; i < fArgs.length; i++) {
- Object arg= fArgs[i];
- if (arg instanceof String) {
- args.append('\'');
- args.append(arg);
- args.append('\'');
- } else {
- args.append(arg.toString());
- }
- if (i < fArgs.length - 1)
- args.append(", "); //$NON-NLS-1$
- }
- return "<test property=\"" + fProperty + //$NON-NLS-1$
- (fArgs.length != 0 ? "\" args=\"" + args + "\"" : "\"") + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- (fExpectedValue != null ? "\" value=\"" + fExpectedValue + "\"" : "\"") + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- " plug-in activation: " + (fForcePluginActivation ? "eager" : "lazy") + //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- "/>"; //$NON-NLS-1$
- }
-
- //---- testing ---------------------------------------------------
-
- public boolean testGetForcePluginActivation() {
- return fForcePluginActivation;
- }
-
- public static TypeExtensionManager testGetTypeExtensionManager() {
- return fgTypeExtensionManager;
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtension.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtension.java
deleted file mode 100644
index c8433a1..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtension.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.core.expressions.IPropertyTester;
-import org.eclipse.core.expressions.PropertyTester;
-
-public class TypeExtension {
-
- private static final TypeExtension[] EMPTY_TYPE_EXTENSION_ARRAY= new TypeExtension[0];
-
- /* a special property tester instance that is used to signal that method searching has to continue */
- /* package */ static final IPropertyTester CONTINUE= new IPropertyTester() {
- public boolean handles(String namespace, String method) {
- return false;
- }
- public boolean isInstantiated() {
- return true;
- }
- public boolean isDeclaringPluginActive() {
- return true;
- }
- public IPropertyTester instantiate() {
- return this;
- }
- public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
- return false;
- }
- };
-
- /* a special type extension instance that marks the end of an evaluation chain */
- private static final TypeExtension END_POINT= new TypeExtension() {
- /* package */ IPropertyTester findTypeExtender(TypeExtensionManager manager, String namespace, String name, boolean staticMethod, boolean forcePluginActivation) throws CoreException {
- return CONTINUE;
- }
- };
-
- /* the type this extension is extending */
- private Class fType;
- /* the list of associated extenders */
- private IPropertyTester[] fExtenders;
-
- /* the extension associated with <code>fType</code>'s super class */
- private TypeExtension fExtends;
- /* the extensions associated with <code>fTypes</code>'s interfaces */
- private TypeExtension[] fImplements;
-
- private TypeExtension() {
- // special constructor to create the CONTINUE instance
- }
-
- /* package */ TypeExtension(Class type) {
- Assert.isNotNull(type);
- fType= type;
- }
-
- /* package */ IPropertyTester findTypeExtender(TypeExtensionManager manager, String namespace, String method, boolean staticMethod, boolean forcePluginActivation) throws CoreException {
- if (fExtenders == null) {
- fExtenders= manager.loadTesters(fType);
- }
- IPropertyTester result;
-
- // handle extenders associated with this type extender
- for (int i= 0; i < fExtenders.length; i++) {
- IPropertyTester extender= fExtenders[i];
- if (extender == null || !extender.handles(namespace, method))
- continue;
- if (extender.isInstantiated()) {
- // There is no need to check for an active plug-in here. If a plug-in
- // gets uninstalled we receive an registry event which will flush the whole
- // type extender cache and will reinstantiate the testers. However Bundle#stop
- // isn't handled by this. According to bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=130338
- // we don't have to support stop in 3.2. If we have to in the future we have to
- // reactivate the stopped plug-in if we are in forcePluginActivation mode.
- return extender;
- } else {
- if (extender.isDeclaringPluginActive() || forcePluginActivation) {
- try {
- PropertyTesterDescriptor descriptor= (PropertyTesterDescriptor)extender;
- IPropertyTester inst= descriptor.instantiate();
- ((PropertyTester)inst).internalInitialize(descriptor);
- fExtenders[i]= extender= inst;
- return extender;
- } catch (CoreException e) {
- fExtenders[i]= null;
- throw e;
- } catch (ClassCastException e) {
- fExtenders[i]= null;
- throw new CoreException(new ExpressionStatus(
- ExpressionStatus.TYPE_EXTENDER_INCORRECT_TYPE,
- ExpressionMessages.TypeExtender_incorrectType,
- e));
- }
- } else {
- return extender;
- }
- }
- }
-
- // there is no inheritance for static methods
- if (staticMethod)
- return CONTINUE;
-
- // handle extends chain
- if (fExtends == null) {
- Class superClass= fType.getSuperclass();
- if (superClass != null) {
- fExtends= manager.get(superClass);
- } else {
- fExtends= END_POINT;
- }
- }
- result= fExtends.findTypeExtender(manager, namespace, method, staticMethod, forcePluginActivation);
- if (result != CONTINUE)
- return result;
-
- // handle implements chain
- if (fImplements == null) {
- Class[] interfaces= fType.getInterfaces();
- if (interfaces.length == 0) {
- fImplements= EMPTY_TYPE_EXTENSION_ARRAY;
- } else {
- fImplements= new TypeExtension[interfaces.length];
- for (int i= 0; i < interfaces.length; i++) {
- fImplements[i]= manager.get(interfaces[i]);
- }
- }
- }
- for (int i= 0; i < fImplements.length; i++) {
- result= fImplements[i].findTypeExtender(manager, namespace, method, staticMethod, forcePluginActivation);
- if (result != CONTINUE)
- return result;
- }
- return CONTINUE;
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtensionManager.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtensionManager.java
deleted file mode 100644
index b1487d8..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtensionManager.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionDelta;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IRegistryChangeEvent;
-import org.eclipse.core.runtime.IRegistryChangeListener;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.core.expressions.IPropertyTester;
-
-public class TypeExtensionManager implements IRegistryChangeListener {
-
- private String fExtensionPoint;
-
- private static final String TYPE= "type"; //$NON-NLS-1$
-
- private static final IPropertyTester[] EMPTY_PROPERTY_TESTER_ARRAY= new IPropertyTester[0];
-
- private static final IPropertyTester NULL_PROPERTY_TESTER= new IPropertyTester() {
- public boolean handles(String namespace, String property) {
- return false;
- }
- public boolean isInstantiated() {
- return true;
- }
- public boolean isDeclaringPluginActive() {
- return true;
- }
- public IPropertyTester instantiate() throws CoreException {
- return this;
- }
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- return false;
- }
- };
-
- /*
- * Map containing all already created type extension object.
- */
- private Map/*<Class, TypeExtension>*/ fTypeExtensionMap;
-
- /*
- * Table containing mapping of class name to configuration element
- */
- private Map/*<String, List<IConfigurationElement>>*/ fConfigurationElementMap;
-
- /*
- * A cache to give fast access to the last 1000 method invocations.
- */
- private PropertyCache fPropertyCache;
-
-
- public TypeExtensionManager(String extensionPoint) {
- Assert.isNotNull(extensionPoint);
- fExtensionPoint= extensionPoint;
- Platform.getExtensionRegistry().addRegistryChangeListener(this);
- initializeCaches();
- }
-
- public Property getProperty(Object receiver, String namespace, String method) throws CoreException {
- return getProperty(receiver, namespace, method, false);
- }
-
- public synchronized Property getProperty(Object receiver, String namespace, String method, boolean forcePluginActivation) throws CoreException {
- long start= 0;
- if (Expressions.TRACING)
- start= System.currentTimeMillis();
-
- // if we call a static method than the receiver is the class object
- Class clazz= receiver instanceof Class ? (Class)receiver : receiver.getClass();
- Property result= new Property(clazz, namespace, method);
- Property cached= fPropertyCache.get(result);
- if (cached != null) {
- if (cached.isValidCacheEntry(forcePluginActivation)) {
- if (Expressions.TRACING) {
- System.out.println("[Type Extension] - method " + //$NON-NLS-1$
- clazz.getName() + "#" + method + //$NON-NLS-1$
- " found in cache: " + //$NON-NLS-1$
- (System.currentTimeMillis() - start) + " ms."); //$NON-NLS-1$
- }
- return cached;
- }
- // The type extender isn't loaded in the cached method but can be loaded
- // now. So remove method from cache and do the normal look up so that the
- // implementation class gets loaded.
- fPropertyCache.remove(cached);
- }
- TypeExtension extension= get(clazz);
- IPropertyTester extender= extension.findTypeExtender(this, namespace, method, receiver instanceof Class, forcePluginActivation);
- if (extender == TypeExtension.CONTINUE || extender == null) {
- throw new CoreException(new ExpressionStatus(
- ExpressionStatus.TYPE_EXTENDER_UNKOWN_METHOD,
- Messages.format(
- ExpressionMessages.TypeExtender_unknownMethod,
- new Object[] {method, clazz.toString()})));
- }
- result.setPropertyTester(extender);
- fPropertyCache.put(result);
- if (Expressions.TRACING) {
- System.out.println("[Type Extension] - method " + //$NON-NLS-1$
- clazz.getName() + "#" + method + //$NON-NLS-1$
- " not found in cache: " + //$NON-NLS-1$
- (System.currentTimeMillis() - start) + " ms."); //$NON-NLS-1$
- }
- return result;
- }
-
- /*
- * This method doesn't need to be synchronized since it is called
- * from withing the getProperty method which is synchronized
- */
- /* package */ TypeExtension get(Class clazz) {
- TypeExtension result= (TypeExtension)fTypeExtensionMap.get(clazz);
- if (result == null) {
- result= new TypeExtension(clazz);
- fTypeExtensionMap.put(clazz, result);
- }
- return result;
- }
-
- /*
- * This method doesn't need to be synchronized since it is called
- * from withing the getProperty method which is synchronized
- */
- /* package */ IPropertyTester[] loadTesters(Class type) {
- if (fConfigurationElementMap == null) {
- fConfigurationElementMap= new HashMap();
- IExtensionRegistry registry= Platform.getExtensionRegistry();
- IConfigurationElement[] ces= registry.getConfigurationElementsFor(
- ExpressionPlugin.getPluginId(),
- fExtensionPoint);
- for (int i= 0; i < ces.length; i++) {
- IConfigurationElement config= ces[i];
- String typeAttr= config.getAttribute(TYPE);
- List typeConfigs= (List)fConfigurationElementMap.get(typeAttr);
- if (typeConfigs == null) {
- typeConfigs= new ArrayList();
- fConfigurationElementMap.put(typeAttr, typeConfigs);
- }
- typeConfigs.add(config);
- }
- }
- String typeName= type.getName();
- List typeConfigs= (List)fConfigurationElementMap.get(typeName);
- if (typeConfigs == null)
- return EMPTY_PROPERTY_TESTER_ARRAY;
- else {
- IPropertyTester[] result= new IPropertyTester[typeConfigs.size()];
- for (int i= 0; i < result.length; i++) {
- IConfigurationElement config= (IConfigurationElement)typeConfigs.get(i);
- try {
- result[i]= new PropertyTesterDescriptor(config);
- } catch (CoreException e) {
- ExpressionPlugin.getDefault().getLog().log(e.getStatus());
- result[i]= NULL_PROPERTY_TESTER;
- }
- }
- fConfigurationElementMap.remove(typeName);
- return result;
- }
- }
-
- public void registryChanged(IRegistryChangeEvent event) {
- IExtensionDelta[] deltas= event.getExtensionDeltas(ExpressionPlugin.getPluginId(), fExtensionPoint);
- if (deltas.length > 0) {
- initializeCaches();
- }
- }
-
- private synchronized void initializeCaches() {
- fTypeExtensionMap= new HashMap();
- fConfigurationElementMap= null;
- fPropertyCache= new PropertyCache(1000);
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/WithExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/WithExpression.java
deleted file mode 100644
index 996d055..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/WithExpression.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.w3c.dom.Element;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.ExpressionInfo;
-import org.eclipse.core.expressions.IEvaluationContext;
-
-public class WithExpression extends CompositeExpression {
-
- private String fVariable;
- private static final String ATT_VARIABLE= "variable"; //$NON-NLS-1$
-
- /**
- * The seed for the hash code for all with expressions.
- */
- private static final int HASH_INITIAL= WithExpression.class.getName().hashCode();
-
- public WithExpression(IConfigurationElement configElement) throws CoreException {
- fVariable= configElement.getAttribute(ATT_VARIABLE);
- Expressions.checkAttribute(ATT_VARIABLE, fVariable);
- }
-
- public WithExpression(Element element) throws CoreException {
- fVariable= element.getAttribute(ATT_VARIABLE);
- Expressions.checkAttribute(ATT_VARIABLE, fVariable.length() > 0 ? fVariable : null);
- }
-
- public WithExpression(String variable) {
- Assert.isNotNull(variable);
- fVariable= variable;
- }
-
- public boolean equals(final Object object) {
- if (!(object instanceof WithExpression))
- return false;
-
- final WithExpression that= (WithExpression)object;
- return this.fVariable.equals(that.fVariable) && equals(this.fExpressions, that.fExpressions);
- }
-
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + hashCode(fExpressions)
- * HASH_FACTOR + fVariable.hashCode();
- }
-
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- Object variable= context.getVariable(fVariable);
- if (variable == null) {
- throw new CoreException(new ExpressionStatus(
- ExpressionStatus.VARIABLE_NOT_DEFINED,
- Messages.format(ExpressionMessages.WithExpression_variable_not_defined, fVariable)));
- }
- if (variable == IEvaluationContext.UNDEFINED_VARIABLE) {
- return EvaluationResult.FALSE;
- }
- return evaluateAnd(new EvaluationContext(context, variable));
- }
-
- public void collectExpressionInfo(ExpressionInfo info) {
- ExpressionInfo other= new ExpressionInfo();
- super.collectExpressionInfo(other);
- if (other.hasDefaultVariableAccess()) {
- info.addVariableNameAccess(fVariable);
- }
- info.mergeExceptDefaultVariable(other);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/propertytester/PlatformPropertyTester.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/propertytester/PlatformPropertyTester.java
deleted file mode 100644
index e2dc9f7..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/propertytester/PlatformPropertyTester.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.propertytester;
-
-import org.eclipse.core.runtime.IProduct;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.core.expressions.PropertyTester;
-
-/**
- * A property tester for testing platform properties. Can test whether or
- * not a given bundle is installed in the running environment, as well as
- * the id of the currently active product.
- *
- * For example:
- * <test property="org.eclipse.core.runtime.product" args="org.eclipse.sdk.ide"/>
- * <test property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.core.expressions"/>
- */
-public class PlatformPropertyTester extends PropertyTester {
-
- private static final String PROPERTY_PRODUCT = "product"; //$NON-NLS-1$
- private static final String PROPERTY_IS_BUNDLE_INSTALLED = "isBundleInstalled"; //$NON-NLS-1$
-
- /* (non-Javadoc)
- * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
- */
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (Platform.class.equals(receiver)) {
- if (PROPERTY_PRODUCT.equals(property)) {
- IProduct product= Platform.getProduct();
- if (product != null) {
- return product.getId().equals(expectedValue);
- }
- return false;
- } else if (PROPERTY_IS_BUNDLE_INSTALLED.equals(property) && args.length >= 1 && args[0] instanceof String) {
- return Platform.getBundle((String)args[0]) != null;
- }
- }
- return false;
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/LRUCache.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/LRUCache.java
deleted file mode 100644
index f738078..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/LRUCache.java
+++ /dev/null
@@ -1,504 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.util;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-/**
- * Copied from JDT/Core to get a cache which is independent from
- * JDK 1.4.
- */
-public class LRUCache implements Cloneable {
-
- /**
- * This type is used internally by the LRUCache to represent entries
- * stored in the cache.
- * It is static because it does not require a pointer to the cache
- * which contains it.
- *
- * @see LRUCache
- */
- protected static class LRUCacheEntry {
-
- /**
- * Hash table key
- */
- public Object _fKey;
-
- /**
- * Hash table value (an LRUCacheEntry object)
- */
- public Object _fValue;
-
- /**
- * Time value for queue sorting
- */
- public int _fTimestamp;
-
- /**
- * Cache footprint of this entry
- */
- public int _fSpace;
-
- /**
- * Previous entry in queue
- */
- public LRUCacheEntry _fPrevious;
-
- /**
- * Next entry in queue
- */
- public LRUCacheEntry _fNext;
-
- /**
- * Creates a new instance of the receiver with the provided values
- * for key, value, and space.
- * @param key
- * @param value
- * @param space
- */
- public LRUCacheEntry (Object key, Object value, int space) {
- _fKey = key;
- _fValue = value;
- _fSpace = space;
- }
-
- /**
- * Returns a String that represents the value of this object.
- * @return a string
- */
- public String toString() {
-
- return "LRUCacheEntry [" + _fKey + "-->" + _fValue + "]"; //$NON-NLS-3$ //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Amount of cache space used so far
- */
- protected int fCurrentSpace;
-
- /**
- * Maximum space allowed in cache
- */
- protected int fSpaceLimit;
-
- /**
- * Counter for handing out sequential timestamps
- */
- protected int fTimestampCounter;
-
- /**
- * Hash table for fast random access to cache entries
- */
- protected Hashtable fEntryTable;
-
- /**
- * Start of queue (most recently used entry)
- */
- protected LRUCacheEntry fEntryQueue;
-
- /**
- * End of queue (least recently used entry)
- */
- protected LRUCacheEntry fEntryQueueTail;
-
- /**
- * Default amount of space in the cache
- */
- protected static final int DEFAULT_SPACELIMIT = 100;
- /**
- * Creates a new cache. Size of cache is defined by
- * <code>DEFAULT_SPACELIMIT</code>.
- */
- public LRUCache() {
-
- this(DEFAULT_SPACELIMIT);
- }
- /**
- * Creates a new cache.
- * @param size Size of Cache
- */
- public LRUCache(int size) {
-
- fTimestampCounter = fCurrentSpace = 0;
- fEntryQueue = fEntryQueueTail = null;
- fEntryTable = new Hashtable(size);
- fSpaceLimit = size;
- }
- /**
- * Returns a new cache containing the same contents.
- *
- * @return New copy of object.
- */
- public Object clone() {
-
- LRUCache newCache = newInstance(fSpaceLimit);
- LRUCacheEntry qEntry;
-
- /* Preserve order of entries by copying from oldest to newest */
- qEntry = this.fEntryQueueTail;
- while (qEntry != null) {
- newCache.privateAdd (qEntry._fKey, qEntry._fValue, qEntry._fSpace);
- qEntry = qEntry._fPrevious;
- }
- return newCache;
- }
- public double fillingRatio() {
- return (fCurrentSpace) * 100.0 / fSpaceLimit;
- }
- /**
- * Flushes all entries from the cache.
- */
- public void flush() {
-
- fCurrentSpace = 0;
- LRUCacheEntry entry = fEntryQueueTail; // Remember last entry
- fEntryTable = new Hashtable(); // Clear it out
- fEntryQueue = fEntryQueueTail = null;
- while (entry != null) { // send deletion notifications in LRU order
- privateNotifyDeletionFromCache(entry);
- entry = entry._fPrevious;
- }
- }
- /**
- * Flushes the given entry from the cache. Does nothing if entry does not
- * exist in cache.
- *
- * @param key Key of object to flush
- */
- public void flush (Object key) {
-
- LRUCacheEntry entry;
-
- entry = (LRUCacheEntry) fEntryTable.get(key);
-
- /* If entry does not exist, return */
- if (entry == null) return;
-
- this.privateRemoveEntry (entry, false);
- }
- /**
- * Answers the value in the cache at the given key.
- * If the value is not in the cache, returns null
- *
- * @param key Hash table key of object to retrieve
- * @return Retreived object, or null if object does not exist
- */
- public Object get(Object key) {
-
- LRUCacheEntry entry = (LRUCacheEntry) fEntryTable.get(key);
- if (entry == null) {
- return null;
- }
-
- this.updateTimestamp (entry);
- return entry._fValue;
- }
- /**
- * Returns the amount of space that is current used in the cache.
- * @return an int
- */
- public int getCurrentSpace() {
- return fCurrentSpace;
- }
- /**
- * Returns the maximum amount of space available in the cache.
- * @return an int
- */
- public int getSpaceLimit() {
- return fSpaceLimit;
- }
- /**
- * Returns an Enumeration of the keys currently in the cache.
- * @return an enumeration
- */
- public Enumeration keys() {
- return fEntryTable.keys();
- }
- /**
- * Ensures there is the specified amount of free space in the receiver,
- * by removing old entries if necessary. Returns true if the requested space was
- * made available, false otherwise.
- *
- * @param space Amount of space to free up
- * @return a boolean
- */
- protected boolean makeSpace (int space) {
-
- int limit;
-
- limit = this.getSpaceLimit();
-
- /* if space is already available */
- if (fCurrentSpace + space <= limit) {
- return true;
- }
-
- /* if entry is too big for cache */
- if (space > limit) {
- return false;
- }
-
- /* Free up space by removing oldest entries */
- while (fCurrentSpace + space > limit && fEntryQueueTail != null) {
- this.privateRemoveEntry (fEntryQueueTail, false);
- }
- return true;
- }
- /**
- * Returns a new LRUCache instance
- * @param size the size
- * @return a cache
- */
- protected LRUCache newInstance(int size) {
- return new LRUCache(size);
- }
- /**
- * Answers the value in the cache at the given key.
- * If the value is not in the cache, returns null
- *
- * This function does not modify timestamps.
- * @param key the key
- * @return the object
- */
- public Object peek(Object key) {
-
- LRUCacheEntry entry = (LRUCacheEntry) fEntryTable.get(key);
- if (entry == null) {
- return null;
- }
- return entry._fValue;
- }
- /**
- * Adds an entry for the given key/value/space.
- * @param key
- * @param value
- * @param space
- */
- protected void privateAdd (Object key, Object value, int space) {
-
- LRUCacheEntry entry;
-
- entry = new LRUCacheEntry(key, value, space);
- this.privateAddEntry (entry, false);
- }
- /**
- * Adds the given entry from the receiver.
- * @param entry
- * @param shuffle Indicates whether we are just shuffling the queue
- * (in which case, the entry table is not modified).
- */
- protected void privateAddEntry (LRUCacheEntry entry, boolean shuffle) {
-
- if (!shuffle) {
- fEntryTable.put (entry._fKey, entry);
- fCurrentSpace += entry._fSpace;
- }
-
- entry._fTimestamp = fTimestampCounter++;
- entry._fNext = this.fEntryQueue;
- entry._fPrevious = null;
-
- if (fEntryQueue == null) {
- /* this is the first and last entry */
- fEntryQueueTail = entry;
- } else {
- fEntryQueue._fPrevious = entry;
- }
-
- fEntryQueue = entry;
- }
- /**
- * An entry has been removed from the cache, for example because it has
- * fallen off the bottom of the LRU queue.
- * Subclasses could over-ride this to implement a persistent cache below the LRU cache.
- * @param entry
- */
- protected void privateNotifyDeletionFromCache(LRUCacheEntry entry) {
- // Default is NOP.
- }
- /**
- * Removes the entry from the entry queue.
- * @param entry
- * @param shuffle indicates whether we are just shuffling the queue
- * (in which case, the entry table is not modified).
- */
- protected void privateRemoveEntry (LRUCacheEntry entry, boolean shuffle) {
-
- LRUCacheEntry previous, next;
-
- previous = entry._fPrevious;
- next = entry._fNext;
-
- if (!shuffle) {
- fEntryTable.remove(entry._fKey);
- fCurrentSpace -= entry._fSpace;
- privateNotifyDeletionFromCache(entry);
- }
-
- /* if this was the first entry */
- if (previous == null) {
- fEntryQueue = next;
- } else {
- previous._fNext = next;
- }
-
- /* if this was the last entry */
- if (next == null) {
- fEntryQueueTail = previous;
- } else {
- next._fPrevious = previous;
- }
- }
- /**
- * Sets the value in the cache at the given key. Returns the value.
- *
- * @param key Key of object to add.
- * @param value Value of object to add.
- * @return added value.
- */
- public Object put(Object key, Object value) {
-
- int newSpace, oldSpace, newTotal;
- LRUCacheEntry entry;
-
- /* Check whether there's an entry in the cache */
- newSpace = spaceFor(value);
- entry = (LRUCacheEntry) fEntryTable.get (key);
-
- if (entry != null) {
-
- /**
- * Replace the entry in the cache if it would not overflow
- * the cache. Otherwise flush the entry and re-add it so as
- * to keep cache within budget
- */
- oldSpace = entry._fSpace;
- newTotal = getCurrentSpace() - oldSpace + newSpace;
- if (newTotal <= getSpaceLimit()) {
- updateTimestamp (entry);
- entry._fValue = value;
- entry._fSpace = newSpace;
- this.fCurrentSpace = newTotal;
- return value;
- } else {
- privateRemoveEntry (entry, false);
- }
- }
- if (makeSpace(newSpace)) {
- privateAdd (key, value, newSpace);
- }
- return value;
- }
- /**
- * Removes and returns the value in the cache for the given key.
- * If the key is not in the cache, returns null.
- *
- * @param key Key of object to remove from cache.
- * @return Value removed from cache.
- */
- public Object removeKey (Object key) {
-
- LRUCacheEntry entry = (LRUCacheEntry) fEntryTable.get(key);
- if (entry == null) {
- return null;
- }
- Object value = entry._fValue;
- this.privateRemoveEntry (entry, false);
- return value;
- }
- /**
- * Sets the maximum amount of space that the cache can store
- *
- * @param limit Number of units of cache space
- */
- public void setSpaceLimit(int limit) {
- if (limit < fSpaceLimit) {
- makeSpace(fSpaceLimit - limit);
- }
- fSpaceLimit = limit;
- }
- /**
- * Returns the space taken by the given value.
- * @param value
- * @return an int
- */
- protected int spaceFor (Object value) {
- return 1;
- }
-
- /**
- * Returns a String that represents the value of this object. This method
- * is for debugging purposes only.
- * @return a string
- */
- public String toString() {
- return
- toStringFillingRation("LRUCache") + //$NON-NLS-1$
- toStringContents();
- }
-
- /**
- * Returns a String that represents the contents of this object. This method
- * is for debugging purposes only.
- * @return a string
- */
- protected String toStringContents() {
- StringBuffer result = new StringBuffer();
- int length = fEntryTable.size();
- Object[] unsortedKeys = new Object[length];
- String[] unsortedToStrings = new String[length];
- Enumeration e = this.keys();
- for (int i = 0; i < length; i++) {
- Object key = e.nextElement();
- unsortedKeys[i] = key;
- unsortedToStrings[i] = key.toString();
- }
- ToStringSorter sorter = new ToStringSorter();
- sorter.sort(unsortedKeys, unsortedToStrings);
- for (int i = 0; i < length; i++) {
- String toString = sorter.sortedStrings[i];
- Object value = this.get(sorter.sortedObjects[i]);
- result.append(toString);
- result.append(" -> "); //$NON-NLS-1$
- result.append(value);
- result.append("\n"); //$NON-NLS-1$
- }
- return result.toString();
- }
-
- public String toStringFillingRation(String cacheName) {
- StringBuffer buffer = new StringBuffer(cacheName);
- buffer.append('[');
- buffer.append(getSpaceLimit());
- buffer.append("]: "); //$NON-NLS-1$
- buffer.append(fillingRatio());
- buffer.append("% full"); //$NON-NLS-1$
- return buffer.toString();
- }
-
- /**
- * Updates the timestamp for the given entry, ensuring that the queue is
- * kept in correct order. The entry must exist
- * @param entry
- */
- protected void updateTimestamp (LRUCacheEntry entry) {
-
- entry._fTimestamp = fTimestampCounter++;
- if (fEntryQueue != entry) {
- this.privateRemoveEntry (entry, true);
- this.privateAddEntry (entry, true);
- }
- return;
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/ToStringSorter.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/ToStringSorter.java
deleted file mode 100644
index ccc011e..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/ToStringSorter.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.util;
-
-/**
- * The SortOperation takes a collection of objects and returns a sorted
- * collection of these objects. The sorting of these objects is based on their
- * toString(). They are sorted in alphabetical order.
- * <p>
- * This is a copy from JDT/Core. The copy is necessary to get an LRU cache which
- * is independent from JDK 1.4
- * </p>
- */
-public class ToStringSorter {
- Object[] sortedObjects;
- String[] sortedStrings;
-
- /**
- * Returns true if stringTwo is 'greater than' stringOne This is the
- * 'ordering' method of the sort operation.
- * @param stringOne
- * @param stringTwo
- * @return a boolean
- */
- public boolean compare(String stringOne, String stringTwo) {
- return stringOne.compareTo(stringTwo) < 0;
- }
-
- /**
- * Sort the objects in sorted collection and return that collection.
- * @param left
- * @param right
- */
- private void quickSort(int left, int right) {
- int originalLeft= left;
- int originalRight= right;
- int midIndex= (left + right) / 2;
- String midToString= this.sortedStrings[midIndex];
-
- do {
- while (compare(this.sortedStrings[left], midToString))
- left++;
- while (compare(midToString, this.sortedStrings[right]))
- right--;
- if (left <= right) {
- Object tmp= this.sortedObjects[left];
- this.sortedObjects[left]= this.sortedObjects[right];
- this.sortedObjects[right]= tmp;
- String tmpToString= this.sortedStrings[left];
- this.sortedStrings[left]= this.sortedStrings[right];
- this.sortedStrings[right]= tmpToString;
- left++;
- right--;
- }
- } while (left <= right);
-
- if (originalLeft < right)
- quickSort(originalLeft, right);
- if (left < originalRight)
- quickSort(left, originalRight);
- }
-
- /**
- * Return a new sorted collection from this unsorted collection. Sort using
- * quick sort.
- * @param unSortedObjects
- * @param unsortedStrings
- */
- public void sort(Object[] unSortedObjects, String[] unsortedStrings) {
- int size= unSortedObjects.length;
- this.sortedObjects= new Object[size];
- this.sortedStrings= new String[size];
-
- // copy the array so can return a new sorted collection
- System.arraycopy(unSortedObjects, 0, this.sortedObjects, 0, size);
- System.arraycopy(unsortedStrings, 0, this.sortedStrings, 0, size);
- if (size > 1)
- quickSort(0, size - 1);
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/.classpath b/bundles/org.eclipse.core.jobs/.classpath
deleted file mode 100644
index ce0c7a5..0000000
--- a/bundles/org.eclipse.core.jobs/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.0%Foundation-1.0"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.core.jobs/.cvsignore b/bundles/org.eclipse.core.jobs/.cvsignore
deleted file mode 100644
index ba077a4..0000000
--- a/bundles/org.eclipse.core.jobs/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/bundles/org.eclipse.core.jobs/.options b/bundles/org.eclipse.core.jobs/.options
deleted file mode 100644
index 994faa5..0000000
--- a/bundles/org.eclipse.core.jobs/.options
+++ /dev/null
@@ -1,19 +0,0 @@
-# Debugging options for the org.eclipse.core.runtime plugin
-
-# NOTE: There is a deadlock risk when using these debug flags in a workspace
-# launched from Eclipse due to interaction with a lock in the debugger console.
-# For details: https://bugs.eclipse.org/bugs/show_bug.cgi?id=93968
-
-# Prints debug information on running background jobs
-org.eclipse.core.jobs/jobs=false
-# Includes current date and time in job debug information
-org.eclipse.core.jobs/jobs/timing=false
-# Computes location of error on mismatched IJobManager.beginRule/endRule
-org.eclipse.core.jobs/jobs/beginend=false
-# Pedantic assertion checking on locks and deadlock reporting
-org.eclipse.core.jobs/jobs/locks=false
-# Throws an IllegalStateException when deadlock occurs
-org.eclipse.core.jobs/jobs/errorondeadlock=false
-# Debug shutdown behaviour
-org.eclipse.core.jobs/jobs/shutdown=false
-
diff --git a/bundles/org.eclipse.core.jobs/.project b/bundles/org.eclipse.core.jobs/.project
deleted file mode 100644
index 06b10a8..0000000
--- a/bundles/org.eclipse.core.jobs/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.jobs</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.core.jobs/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.core.jobs/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 16532b2..0000000
--- a/bundles/org.eclipse.core.jobs/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue May 25 15:00:03 EDT 2004
-encoding/<project>=ISO-8859-1
-eclipse.preferences.version=1
diff --git a/bundles/org.eclipse.core.jobs/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.jobs/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index d5137f2..0000000
--- a/bundles/org.eclipse.core.jobs/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,326 +0,0 @@
-#Mon Oct 22 13:17:28 EDT 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
-org.eclipse.jdt.core.compiler.compliance=1.3
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=false
-org.eclipse.jdt.core.formatter.comment.format_comments=false
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=80
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=800
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
diff --git a/bundles/org.eclipse.core.jobs/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.core.jobs/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 52991ab..0000000
--- a/bundles/org.eclipse.core.jobs/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,10 +0,0 @@
-#Fri Feb 23 16:59:25 EST 2007
-eclipse.preferences.version=1
-formatter_profile=_core
-formatter_settings_version=11
-internal.default.compliance=default
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=;
-org.eclipse.jdt.ui.ondemandthreshold=3
-org.eclipse.jdt.ui.staticondemandthreshold=99
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return Returns the ${bare_field_name}.\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} The ${bare_field_name} to set.\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Copyright (c) ${year} IBM Corporation and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n ******************************************************************************/\r\n</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @since 3.2\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="New classes and interfaces" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} IBM Corporation and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n *******************************************************************************/\r\n${filecomment}\r\n${package_declaration}\r\n\r\n/**\r\n * \r\n */\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block&\#13;\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/bundles/org.eclipse.core.jobs/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.jobs/META-INF/MANIFEST.MF
deleted file mode 100644
index e4bd73e..0000000
--- a/bundles/org.eclipse.core.jobs/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,19 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.core.jobs; singleton:=true
-Bundle-Version: 3.4.0.qualifier
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Export-Package: org.eclipse.core.internal.jobs;x-internal:=true,
- org.eclipse.core.runtime.jobs
-Bundle-Activator: org.eclipse.core.internal.jobs.JobActivator
-Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.2.0,4.0.0)"
-Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,
- J2SE-1.3
-Eclipse-LazyStart: true
-Import-Package: org.eclipse.osgi.service.debug,
- org.eclipse.osgi.util,
- org.osgi.framework;version="1.3.0",
- org.osgi.service.packageadmin,
- org.osgi.util.tracker
diff --git a/bundles/org.eclipse.core.jobs/about.html b/bundles/org.eclipse.core.jobs/about.html
deleted file mode 100644
index 4602330..0000000
--- a/bundles/org.eclipse.core.jobs/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.jobs/build.properties b/bundles/org.eclipse.core.jobs/build.properties
deleted file mode 100644
index 730faf8..0000000
--- a/bundles/org.eclipse.core.jobs/build.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.properties,\
- .options,\
- about.html
-src.includes = about.html
diff --git a/bundles/org.eclipse.core.jobs/plugin.properties b/bundles/org.eclipse.core.jobs/plugin.properties
deleted file mode 100644
index 7db1f71..0000000
--- a/bundles/org.eclipse.core.jobs/plugin.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# Copyright (c) 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-pluginName = Eclipse Jobs Mechanism
-providerName = Eclipse.org
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Deadlock.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Deadlock.java
deleted file mode 100644
index 8ddf89a..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Deadlock.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-
-/**
- * The deadlock class stores information about a deadlock that just occurred.
- * It contains an array of the threads that were involved in the deadlock
- * as well as the thread that was chosen to be suspended and an array of locks
- * held by that thread that are going to be suspended to resolve the deadlock.
- */
-class Deadlock {
- //all the threads which are involved in the deadlock
- private Thread[] threads;
- //the thread whose locks will be suspended to resolve deadlock
- private Thread candidate;
- //the locks that will be suspended
- private ISchedulingRule[] locks;
-
- public Deadlock(Thread[] threads, ISchedulingRule[] locks, Thread candidate) {
- this.threads = threads;
- this.locks = locks;
- this.candidate = candidate;
- }
-
- public ISchedulingRule[] getLocks() {
- return locks;
- }
-
- public Thread getCandidate() {
- return candidate;
- }
-
- public Thread[] getThreads() {
- return threads;
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/DeadlockDetector.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/DeadlockDetector.java
deleted file mode 100644
index 938b728..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/DeadlockDetector.java
+++ /dev/null
@@ -1,700 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import org.eclipse.core.internal.runtime.RuntimeLog;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ILock;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-
-/**
- * Stores all the relationships between locks (rules are also considered locks),
- * and the threads that own them. All the relationships are stored in a 2D integer array.
- * The rows in the array are threads, while the columns are locks.
- * Two corresponding arrayLists store the actual threads and locks.
- * The index of a thread in the first arrayList is the index of the row in the graph.
- * The index of a lock in the second arrayList is the index of the column in the graph.
- * An entry greater than 0 in the graph is the number of times a thread in the entry's row
- * acquired the lock in the entry's column.
- * An entry of -1 means that the thread is waiting to acquire the lock.
- * An entry of 0 means that the thread and the lock have no relationship.
- *
- * The difference between rules and locks is that locks can be suspended, while
- * rules are implicit locks and as such cannot be suspended.
- * To resolve deadlock, the graph will first try to find a thread that only owns
- * locks. Failing that, it will find a thread in the deadlock that owns at least
- * one lock and suspend it.
- *
- * Deadlock can only occur among locks, or among locks in combination with rules.
- * Deadlock among rules only is impossible. Therefore, in any deadlock one can always
- * find a thread that owns at least one lock that can be suspended.
- *
- * The implementation of the graph assumes that a thread can only own 1 rule at
- * any one time. It can acquire that rule several times, but a thread cannot
- * acquire 2 non-conflicting rules at the same time.
- *
- * The implementation of the graph will sometimes also find and resolve bogus deadlocks.
- * graph: assuming this rule hierarchy:
- * R2 R3 L1 R1
- * J1 1 0 0 / \
- * J2 0 1 -1 R2 R3
- * J3 -1 0 1
- *
- * If in the above situation job4 decides to acquire rule1, then the graph will transform
- * to the following:
- * R2 R3 R1 L1
- * J1 1 0 1 0
- * J2 1 1 1 -1
- * J3 -1 0 0 1
- * J4 0 0 -1 0
- *
- * and the graph will assume that job2 and job3 are deadlocked and suspend lock1 of job3.
- * The reason the deadlock is bogus is that the deadlock is unlikely to actually happen (the threads
- * are currently not deadlocked, but might deadlock later on when it is too late to detect it)
- * Therefore, in order to make sure that no deadlock is possible,
- * the deadlock will still be resolved at this point.
- */
-class DeadlockDetector {
- private static int NO_STATE = 0;
- //state variables in the graph
- private static int WAITING_FOR_LOCK = -1;
- //empty matrix
- private static final int[][] EMPTY_MATRIX = new int[0][0];
- //matrix of relationships between threads and locks
- private int[][] graph = EMPTY_MATRIX;
- //index is column in adjacency matrix for the lock
- private final ArrayList locks = new ArrayList();
- //index is row in adjacency matrix for the thread
- private final ArrayList lockThreads = new ArrayList();
- //whether the graph needs to be resized
- private boolean resize = false;
-
- /**
- * Recursively check if any of the threads that prevent the current thread from running
- * are actually deadlocked with the current thread.
- * Add the threads that form deadlock to the deadlockedThreads list.
- */
- private boolean addCycleThreads(ArrayList deadlockedThreads, Thread next) {
- //get the thread that block the given thread from running
- Thread[] blocking = blockingThreads(next);
- //if the thread is not blocked by other threads, then it is not part of a deadlock
- if (blocking.length == 0)
- return false;
- boolean inCycle = false;
- for (int i = 0; i < blocking.length; i++) {
- //if we have already visited the given thread, then we found a cycle
- if (deadlockedThreads.contains(blocking[i])) {
- inCycle = true;
- } else {
- //otherwise, add the thread to our list and recurse deeper
- deadlockedThreads.add(blocking[i]);
- //if the thread is not part of a cycle, remove it from the list
- if (addCycleThreads(deadlockedThreads, blocking[i]))
- inCycle = true;
- else
- deadlockedThreads.remove(blocking[i]);
- }
- }
- return inCycle;
- }
-
- /**
- * Get the thread(s) that own the lock this thread is waiting for.
- */
- private Thread[] blockingThreads(Thread current) {
- //find the lock this thread is waiting for
- ISchedulingRule lock = (ISchedulingRule) getWaitingLock(current);
- return getThreadsOwningLock(lock);
- }
-
- /**
- * Check that the addition of a waiting thread did not produce deadlock.
- * If deadlock is detected return true, else return false.
- */
- private boolean checkWaitCycles(int[] waitingThreads, int lockIndex) {
- /**
- * find the lock that this thread is waiting for
- * recursively check if this is a cycle (i.e. a thread waiting on itself)
- */
- for (int i = 0; i < graph.length; i++) {
- if (graph[i][lockIndex] > NO_STATE) {
- if (waitingThreads[i] > NO_STATE) {
- return true;
- }
- //keep track that we already visited this thread
- waitingThreads[i]++;
- for (int j = 0; j < graph[i].length; j++) {
- if (graph[i][j] == WAITING_FOR_LOCK) {
- if (checkWaitCycles(waitingThreads, j))
- return true;
- }
- }
- //this thread is not involved in a cycle yet, so remove the visited flag
- waitingThreads[i]--;
- }
- }
- return false;
- }
-
- /**
- * Returns true IFF the matrix contains a row for the given thread.
- * (meaning the given thread either owns locks or is waiting for locks)
- */
- boolean contains(Thread t) {
- return lockThreads.contains(t);
- }
-
- /**
- * A new rule was just added to the graph.
- * Find a rule it conflicts with and update the new rule with the number of times
- * it was acquired implicitly when threads acquired conflicting rule.
- */
- private void fillPresentEntries(ISchedulingRule newLock, int lockIndex) {
- //fill in the entries for the new rule from rules it conflicts with
- for (int j = 0; j < locks.size(); j++) {
- if ((j != lockIndex) && (newLock.isConflicting((ISchedulingRule) locks.get(j)))) {
- for (int i = 0; i < graph.length; i++) {
- if ((graph[i][j] > NO_STATE) && (graph[i][lockIndex] == NO_STATE))
- graph[i][lockIndex] = graph[i][j];
- }
- }
- }
- //now back fill the entries for rules the current rule conflicts with
- for (int j = 0; j < locks.size(); j++) {
- if ((j != lockIndex) && (newLock.isConflicting((ISchedulingRule) locks.get(j)))) {
- for (int i = 0; i < graph.length; i++) {
- if ((graph[i][lockIndex] > NO_STATE) && (graph[i][j] == NO_STATE))
- graph[i][j] = graph[i][lockIndex];
- }
- }
- }
- }
-
- /**
- * Returns all the locks owned by the given thread
- */
- private Object[] getOwnedLocks(Thread current) {
- ArrayList ownedLocks = new ArrayList(1);
- int index = indexOf(current, false);
-
- for (int j = 0; j < graph[index].length; j++) {
- if (graph[index][j] > NO_STATE)
- ownedLocks.add(locks.get(j));
- }
- if (ownedLocks.size() == 0)
- Assert.isLegal(false, "A thread with no locks is part of a deadlock."); //$NON-NLS-1$
- return ownedLocks.toArray();
- }
-
- /**
- * Returns an array of threads that form the deadlock (usually 2).
- */
- private Thread[] getThreadsInDeadlock(Thread cause) {
- ArrayList deadlockedThreads = new ArrayList(2);
- /**
- * if the thread that caused deadlock doesn't own any locks, then it is not part
- * of the deadlock (it just caused it because of a rule it tried to acquire)
- */
- if (ownsLocks(cause))
- deadlockedThreads.add(cause);
- addCycleThreads(deadlockedThreads, cause);
- return (Thread[]) deadlockedThreads.toArray(new Thread[deadlockedThreads.size()]);
- }
-
- /**
- * Returns the thread(s) that own the given lock.
- */
- private Thread[] getThreadsOwningLock(ISchedulingRule rule) {
- if (rule == null)
- return new Thread[0];
- int lockIndex = indexOf(rule, false);
- ArrayList blocking = new ArrayList(1);
- for (int i = 0; i < graph.length; i++) {
- if (graph[i][lockIndex] > NO_STATE)
- blocking.add(lockThreads.get(i));
- }
- if ((blocking.size() == 0) && (JobManager.DEBUG_LOCKS))
- System.out.println("Lock " + rule + " is involved in deadlock but is not owned by any thread."); //$NON-NLS-1$ //$NON-NLS-2$
- if ((blocking.size() > 1) && (rule instanceof ILock) && (JobManager.DEBUG_LOCKS))
- System.out.println("Lock " + rule + " is owned by more than 1 thread, but it is not a rule."); //$NON-NLS-1$ //$NON-NLS-2$
- return (Thread[]) blocking.toArray(new Thread[blocking.size()]);
- }
-
- /**
- * Returns the lock the given thread is waiting for.
- */
- private Object getWaitingLock(Thread current) {
- int index = indexOf(current, false);
- //find the lock that this thread is waiting for
- for (int j = 0; j < graph[index].length; j++) {
- if (graph[index][j] == WAITING_FOR_LOCK)
- return locks.get(j);
- }
- //it can happen that a thread is not waiting for any lock (it is not really part of the deadlock)
- return null;
- }
-
- /**
- * Returns the index of the given lock in the lock array. If the lock is
- * not present in the array, it is added to the end.
- */
- private int indexOf(ISchedulingRule lock, boolean add) {
- int index = locks.indexOf(lock);
- if ((index < 0) && add) {
- locks.add(lock);
- resize = true;
- index = locks.size() - 1;
- }
- return index;
- }
-
- /**
- * Returns the index of the given thread in the thread array. If the thread
- * is not present in the array, it is added to the end.
- */
- private int indexOf(Thread owner, boolean add) {
- int index = lockThreads.indexOf(owner);
- if ((index < 0) && add) {
- lockThreads.add(owner);
- resize = true;
- index = lockThreads.size() - 1;
- }
- return index;
- }
-
- /**
- * Returns true IFF the adjacency matrix is empty.
- */
- boolean isEmpty() {
- return (locks.size() == 0) && (lockThreads.size() == 0) && (graph.length == 0);
- }
-
- /**
- * The given lock was acquired by the given thread.
- */
- void lockAcquired(Thread owner, ISchedulingRule lock) {
- int lockIndex = indexOf(lock, true);
- int threadIndex = indexOf(owner, true);
- if (resize)
- resizeGraph();
- if (graph[threadIndex][lockIndex] == WAITING_FOR_LOCK)
- graph[threadIndex][lockIndex] = NO_STATE;
- /**
- * acquire all locks that conflict with the given lock
- * or conflict with a lock the given lock will acquire implicitly
- * (locks are acquired implicitly when a conflicting lock is acquired)
- */
- ArrayList conflicting = new ArrayList(1);
- //only need two passes through all the locks to pick up all conflicting rules
- int NUM_PASSES = 2;
- conflicting.add(lock);
- graph[threadIndex][lockIndex]++;
- for (int i = 0; i < NUM_PASSES; i++) {
- for (int k = 0; k < conflicting.size(); k++) {
- ISchedulingRule current = (ISchedulingRule) conflicting.get(k);
- for (int j = 0; j < locks.size(); j++) {
- ISchedulingRule possible = (ISchedulingRule) locks.get(j);
- if (current.isConflicting(possible) && !conflicting.contains(possible)) {
- conflicting.add(possible);
- graph[threadIndex][j]++;
- }
- }
- }
- }
- }
-
- /**
- * The given lock was released by the given thread. Update the graph.
- */
- void lockReleased(Thread owner, ISchedulingRule lock) {
- int lockIndex = indexOf(lock, false);
- int threadIndex = indexOf(owner, false);
- //make sure the lock and thread exist in the graph
- if (threadIndex < 0) {
- if (JobManager.DEBUG_LOCKS)
- System.out.println("[lockReleased] Lock " + lock + " was already released by thread " + owner.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- if (lockIndex < 0) {
- if (JobManager.DEBUG_LOCKS)
- System.out.println("[lockReleased] Thread " + owner.getName() + " already released lock " + lock); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- //if this lock was suspended, set it to NO_STATE
- if ((lock instanceof ILock) && (graph[threadIndex][lockIndex] == WAITING_FOR_LOCK)) {
- graph[threadIndex][lockIndex] = NO_STATE;
- return;
- }
- //release all locks that conflict with the given lock
- //or release all rules that are owned by the given thread, if we are releasing a rule
- for (int j = 0; j < graph[threadIndex].length; j++) {
- if ((lock.isConflicting((ISchedulingRule) locks.get(j))) || (!(lock instanceof ILock) && !(locks.get(j) instanceof ILock) && (graph[threadIndex][j] > NO_STATE))) {
- if (graph[threadIndex][j] == NO_STATE) {
- if (JobManager.DEBUG_LOCKS)
- System.out.println("[lockReleased] More releases than acquires for thread " + owner.getName() + " and lock " + lock); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- graph[threadIndex][j]--;
- }
- }
- }
- //if this thread just released the given lock, try to simplify the graph
- if (graph[threadIndex][lockIndex] == NO_STATE)
- reduceGraph(threadIndex, lock);
- }
-
- /**
- * The given scheduling rule is no longer used because the job that invoked it is done.
- * Release this rule regardless of how many times it was acquired.
- */
- void lockReleasedCompletely(Thread owner, ISchedulingRule rule) {
- int ruleIndex = indexOf(rule, false);
- int threadIndex = indexOf(owner, false);
- //need to make sure that the given thread and rule were not already removed from the graph
- if (threadIndex < 0) {
- if (JobManager.DEBUG_LOCKS)
- System.out.println("[lockReleasedCompletely] Lock " + rule + " was already released by thread " + owner.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- if (ruleIndex < 0) {
- if (JobManager.DEBUG_LOCKS)
- System.out.println("[lockReleasedCompletely] Thread " + owner.getName() + " already released lock " + rule); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- /**
- * set all rules that are owned by the given thread to NO_STATE
- * (not just rules that conflict with the rule we are releasing)
- * if we are releasing a lock, then only update the one entry for the lock
- */
- for (int j = 0; j < graph[threadIndex].length; j++) {
- if (!(locks.get(j) instanceof ILock) && (graph[threadIndex][j] > NO_STATE))
- graph[threadIndex][j] = NO_STATE;
- }
- reduceGraph(threadIndex, rule);
- }
-
- /**
- * The given thread could not get the given lock and is waiting for it.
- * Update the graph.
- */
- Deadlock lockWaitStart(Thread client, ISchedulingRule lock) {
- setToWait(client, lock, false);
- int lockIndex = indexOf(lock, false);
- int[] temp = new int[lockThreads.size()];
- //check if the addition of the waiting thread caused deadlock
- if (!checkWaitCycles(temp, lockIndex))
- return null;
- //there is a deadlock in the graph
- Thread[] threads = getThreadsInDeadlock(client);
- Thread candidate = resolutionCandidate(threads);
- ISchedulingRule[] locksToSuspend = realLocksForThread(candidate);
- Deadlock deadlock = new Deadlock(threads, locksToSuspend, candidate);
- //find a thread whose locks can be suspended to resolve the deadlock
- if (JobManager.DEBUG_LOCKS)
- reportDeadlock(deadlock);
- if (JobManager.DEBUG_DEADLOCK)
- throw new IllegalStateException("Deadlock detected. Caused by thread " + client.getName() + '.'); //$NON-NLS-1$
- // Update the graph to indicate that the locks will now be suspended.
- // To indicate that the lock will be suspended, we set the thread to wait for the lock.
- // When the lock is forced to be released, the entry will be cleared.
- for (int i = 0; i < locksToSuspend.length; i++)
- setToWait(deadlock.getCandidate(), locksToSuspend[i], true);
- return deadlock;
- }
-
- /**
- * The given thread has stopped waiting for the given lock.
- * Update the graph.
- */
- void lockWaitStop(Thread owner, ISchedulingRule lock) {
- int lockIndex = indexOf(lock, false);
- int threadIndex = indexOf(owner, false);
- //make sure the thread and lock exist in the graph
- if (threadIndex < 0) {
- if (JobManager.DEBUG_LOCKS)
- System.out.println("Thread " + owner.getName() + " was already removed."); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- if (lockIndex < 0) {
- if (JobManager.DEBUG_LOCKS)
- System.out.println("Lock " + lock + " was already removed."); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- if (graph[threadIndex][lockIndex] != WAITING_FOR_LOCK)
- Assert.isTrue(false, "Thread " + owner.getName() + " was not waiting for lock " + lock.toString() + " so it could not time out."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- graph[threadIndex][lockIndex] = NO_STATE;
- reduceGraph(threadIndex, lock);
- }
-
- /**
- * Returns true IFF the given thread owns a single lock
- */
- private boolean ownsLocks(Thread cause) {
- int threadIndex = indexOf(cause, false);
- for (int j = 0; j < graph[threadIndex].length; j++) {
- if (graph[threadIndex][j] > NO_STATE)
- return true;
- }
- return false;
- }
-
- /**
- * Returns true IFF the given thread owns a single real lock.
- * A real lock is a lock that can be suspended.
- */
- private boolean ownsRealLocks(Thread owner) {
- int threadIndex = indexOf(owner, false);
- for (int j = 0; j < graph[threadIndex].length; j++) {
- if (graph[threadIndex][j] > NO_STATE) {
- Object lock = locks.get(j);
- if (lock instanceof ILock)
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return true IFF this thread owns rule locks (i.e. implicit locks which
- * cannot be suspended)
- */
- private boolean ownsRuleLocks(Thread owner) {
- int threadIndex = indexOf(owner, false);
- for (int j = 0; j < graph[threadIndex].length; j++) {
- if (graph[threadIndex][j] > NO_STATE) {
- Object lock = locks.get(j);
- if (!(lock instanceof ILock))
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns an array of real locks that are owned by the given thread.
- * Real locks are locks that implement the ILock interface and can be suspended.
- */
- private ISchedulingRule[] realLocksForThread(Thread owner) {
- int threadIndex = indexOf(owner, false);
- ArrayList ownedLocks = new ArrayList(1);
- for (int j = 0; j < graph[threadIndex].length; j++) {
- if ((graph[threadIndex][j] > NO_STATE) && (locks.get(j) instanceof ILock))
- ownedLocks.add(locks.get(j));
- }
- if (ownedLocks.size() == 0)
- Assert.isLegal(false, "A thread with no real locks was chosen to resolve deadlock."); //$NON-NLS-1$
- return (ISchedulingRule[]) ownedLocks.toArray(new ISchedulingRule[ownedLocks.size()]);
- }
-
- /**
- * The matrix has been simplified. Check if any unnecessary rows or columns
- * can be removed.
- */
- private void reduceGraph(int row, ISchedulingRule lock) {
- int numLocks = locks.size();
- boolean[] emptyColumns = new boolean[numLocks];
-
- /**
- * find all columns that could possibly be empty
- * (consist of locks which conflict with the given lock, or of locks which are rules)
- */
- for (int j = 0; j < numLocks; j++) {
- if ((lock.isConflicting((ISchedulingRule) locks.get(j))) || !(locks.get(j) instanceof ILock))
- emptyColumns[j] = true;
- }
-
- boolean rowEmpty = true;
- int numEmpty = 0;
- //check if the given row is empty
- for (int j = 0; j < graph[row].length; j++) {
- if (graph[row][j] != NO_STATE) {
- rowEmpty = false;
- break;
- }
- }
- /**
- * Check if the possibly empty columns are actually empty.
- * If a column is actually empty, remove the corresponding lock from the list of locks
- * Start at the last column so that when locks are removed from the list,
- * the index of the remaining locks is unchanged. Store the number of empty columns.
- */
- for (int j = emptyColumns.length - 1; j >= 0; j--) {
- for (int i = 0; i < graph.length; i++) {
- if (emptyColumns[j] && (graph[i][j] != NO_STATE)) {
- emptyColumns[j] = false;
- break;
- }
- }
- if (emptyColumns[j]) {
- locks.remove(j);
- numEmpty++;
- }
- }
- //if no columns or rows are empty, return right away
- if ((numEmpty == 0) && (!rowEmpty))
- return;
-
- if (rowEmpty)
- lockThreads.remove(row);
-
- //new graph (the list of locks and the list of threads are already updated)
- final int numThreads = lockThreads.size();
- numLocks = locks.size();
- //optimize empty graph case
- if (numThreads == 0 && numLocks == 0) {
- graph = EMPTY_MATRIX;
- return;
- }
- int[][] tempGraph = new int[numThreads][numLocks];
-
- //the number of rows we need to skip to get the correct entry from the old graph
- int numRowsSkipped = 0;
- for (int i = 0; i < graph.length - numRowsSkipped; i++) {
- if ((i == row) && rowEmpty) {
- numRowsSkipped++;
- //check if we need to skip the last row
- if (i >= graph.length - numRowsSkipped)
- break;
- }
- //the number of columns we need to skip to get the correct entry from the old graph
- //needs to be reset for every new row
- int numColsSkipped = 0;
- for (int j = 0; j < graph[i].length - numColsSkipped; j++) {
- while (emptyColumns[j + numColsSkipped]) {
- numColsSkipped++;
- //check if we need to skip the last column
- if (j >= graph[i].length - numColsSkipped)
- break;
- }
- //need to break out of the outer loop
- if (j >= graph[i].length - numColsSkipped)
- break;
- tempGraph[i][j] = graph[i + numRowsSkipped][j + numColsSkipped];
- }
- }
- graph = tempGraph;
- Assert.isTrue(numThreads == graph.length, "Rows and threads don't match."); //$NON-NLS-1$
- Assert.isTrue(numLocks == ((graph.length > 0) ? graph[0].length : 0), "Columns and locks don't match."); //$NON-NLS-1$
- }
-
- /**
- * Adds a 'deadlock detected' message to the log with a stack trace.
- */
- private void reportDeadlock(Deadlock deadlock) {
- String msg = "Deadlock detected. All locks owned by thread " + deadlock.getCandidate().getName() + " will be suspended."; //$NON-NLS-1$ //$NON-NLS-2$
- MultiStatus main = new MultiStatus(JobManager.PI_JOBS, JobManager.PLUGIN_ERROR, msg, new IllegalStateException());
- Thread[] threads = deadlock.getThreads();
- for (int i = 0; i < threads.length; i++) {
- Object[] ownedLocks = getOwnedLocks(threads[i]);
- Object waitLock = getWaitingLock(threads[i]);
- StringBuffer buf = new StringBuffer("Thread "); //$NON-NLS-1$
- buf.append(threads[i].getName());
- buf.append(" has locks: "); //$NON-NLS-1$
- for (int j = 0; j < ownedLocks.length; j++) {
- buf.append(ownedLocks[j]);
- buf.append((j < ownedLocks.length - 1) ? ", " : " "); //$NON-NLS-1$ //$NON-NLS-2$
- }
- buf.append("and is waiting for lock "); //$NON-NLS-1$
- buf.append(waitLock);
- Status child = new Status(IStatus.ERROR, JobManager.PI_JOBS, JobManager.PLUGIN_ERROR, buf.toString(), null);
- main.add(child);
- }
- RuntimeLog.log(main);
- }
-
- /**
- * The number of threads/locks in the graph has changed. Update the
- * underlying matrix.
- */
- private void resizeGraph() {
- // a new row and/or a new column was added to the graph.
- // since new rows/columns are always added to the end, just transfer
- // old entries to the new graph, with the same indices.
- final int newRows = lockThreads.size();
- final int newCols = locks.size();
- //optimize 0x0 and 1x1 matrices
- if (newRows == 0 && newCols == 0) {
- graph = EMPTY_MATRIX;
- return;
- }
- int[][] tempGraph = new int[newRows][newCols];
- for (int i = 0; i < graph.length; i++)
- System.arraycopy(graph[i], 0, tempGraph[i], 0, graph[i].length);
- graph = tempGraph;
- resize = false;
- }
-
- /**
- * Get the thread whose locks can be suspended. (i.e. all locks it owns are
- * actual locks and not rules). Return the first thread in the array by default.
- */
- private Thread resolutionCandidate(Thread[] candidates) {
- //first look for a candidate that has no scheduling rules
- for (int i = 0; i < candidates.length; i++) {
- if (!ownsRuleLocks(candidates[i]))
- return candidates[i];
- }
- //next look for any candidate with a real lock (a lock that can be suspended)
- for (int i = 0; i < candidates.length; i++) {
- if (ownsRealLocks(candidates[i]))
- return candidates[i];
- }
- //unnecessary, return the first entry in the array by default
- return candidates[0];
- }
-
- /**
- * The given thread is waiting for the given lock. Update the graph.
- */
- private void setToWait(Thread owner, ISchedulingRule lock, boolean suspend) {
- boolean needTransfer = false;
- /**
- * if we are adding an entry where a thread is waiting on a scheduling rule,
- * then we need to transfer all positive entries for a conflicting rule to the
- * newly added rule in order to synchronize the graph.
- */
- if (!suspend && !(lock instanceof ILock))
- needTransfer = true;
- int lockIndex = indexOf(lock, !suspend);
- int threadIndex = indexOf(owner, !suspend);
- if (resize)
- resizeGraph();
-
- graph[threadIndex][lockIndex] = WAITING_FOR_LOCK;
- if (needTransfer)
- fillPresentEntries(lock, lockIndex);
- }
-
- /**
- * Prints out the current matrix to standard output.
- * Only used for debugging.
- */
- public String toDebugString() {
- StringWriter sWriter = new StringWriter();
- PrintWriter out = new PrintWriter(sWriter, true);
- out.println(" :: "); //$NON-NLS-1$
- for (int j = 0; j < locks.size(); j++) {
- out.print(" " + locks.get(j) + ','); //$NON-NLS-1$
- }
- out.println();
- for (int i = 0; i < graph.length; i++) {
- out.print(" " + ((Thread) lockThreads.get(i)).getName() + " : "); //$NON-NLS-1$ //$NON-NLS-2$
- for (int j = 0; j < graph[i].length; j++) {
- out.print(" " + graph[i][j] + ','); //$NON-NLS-1$
- }
- out.println();
- }
- out.println("-------"); //$NON-NLS-1$
- return sWriter.toString();
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/ImplicitJobs.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/ImplicitJobs.java
deleted file mode 100644
index 162ab13..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/ImplicitJobs.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import java.util.*;
-import org.eclipse.core.internal.runtime.RuntimeLog;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- * Implicit jobs are jobs that are running by virtue of a JobManager.begin/end
- * pair. They act like normal jobs, except they are tied to an arbitrary thread
- * of the client's choosing, and they can be nested.
- */
-class ImplicitJobs {
- /**
- * Cached unused instance that can be reused
- */
- private ThreadJob jobCache = null;
- protected JobManager manager;
-
- /**
- * Set of suspended scheduling rules.
- */
- private final Set suspendedRules = new HashSet(20);
-
- /**
- * Maps (Thread->ThreadJob), threads to the currently running job for that
- * thread.
- */
- private final Map threadJobs = new HashMap(20);
-
- ImplicitJobs(JobManager manager) {
- this.manager = manager;
- }
-
- /* (Non-javadoc)
- * @see IJobManager#beginRule
- */
- void begin(ISchedulingRule rule, IProgressMonitor monitor, boolean suspend) {
- if (JobManager.DEBUG_BEGIN_END)
- JobManager.debug("Begin rule: " + rule); //$NON-NLS-1$
- final Thread currentThread = Thread.currentThread();
- ThreadJob threadJob;
- synchronized (this) {
- threadJob = (ThreadJob) threadJobs.get(currentThread);
- if (threadJob != null) {
- //nested rule, just push on stack and return
- threadJob.push(rule);
- return;
- }
- //no need to schedule a thread job for a null rule
- if (rule == null)
- return;
- //create a thread job for this thread, use the rule from the real job if it has one
- Job realJob = manager.currentJob();
- if (realJob != null && realJob.getRule() != null)
- threadJob = newThreadJob(realJob.getRule());
- else {
- threadJob = newThreadJob(rule);
- threadJob.acquireRule = true;
- }
- //don't acquire rule if it is a suspended rule
- if (isSuspended(rule))
- threadJob.acquireRule = false;
- //indicate if it is a system job to ensure isBlocking works correctly
- threadJob.setRealJob(realJob);
- threadJob.setThread(currentThread);
- }
- try {
- threadJob.push(rule);
- //join the thread job outside sync block
- if (threadJob.acquireRule) {
- //no need to re-acquire any locks because the thread did not wait to get this lock
- if (manager.runNow(threadJob))
- manager.getLockManager().addLockThread(Thread.currentThread(), rule);
- else
- threadJob = threadJob.joinRun(monitor);
- }
- } finally {
- //remember this thread job - only do this
- //after the rule is acquired because it is ok for this thread to acquire
- //and release other rules while waiting.
- synchronized (this) {
- threadJobs.put(currentThread, threadJob);
- if (suspend)
- suspendedRules.add(rule);
- }
- if (threadJob.isBlocked) {
- threadJob.isBlocked = false;
- manager.reportUnblocked(monitor);
- }
- }
- }
-
- /* (Non-javadoc)
- * @see IJobManager#endRule
- */
- synchronized void end(ISchedulingRule rule, boolean resume) {
- if (JobManager.DEBUG_BEGIN_END)
- JobManager.debug("End rule: " + rule); //$NON-NLS-1$
- ThreadJob threadJob = (ThreadJob) threadJobs.get(Thread.currentThread());
- if (threadJob == null)
- Assert.isLegal(rule == null, "endRule without matching beginRule: " + rule); //$NON-NLS-1$
- else if (threadJob.pop(rule)) {
- endThreadJob(threadJob, resume);
- }
- }
-
- /**
- * Called when a worker thread has finished running a job. At this
- * point, the worker thread must not own any scheduling rules
- * @param lastJob The last job to run in this thread
- */
- void endJob(InternalJob lastJob) {
- final Thread currentThread = Thread.currentThread();
- IStatus error;
- synchronized (this) {
- ThreadJob threadJob = (ThreadJob) threadJobs.get(currentThread);
- if (threadJob == null) {
- if (lastJob.getRule() != null)
- notifyWaitingThreadJobs();
- return;
- }
- String msg = "Worker thread ended job: " + lastJob + ", but still holds rule: " + threadJob; //$NON-NLS-1$ //$NON-NLS-2$
- error = new Status(IStatus.ERROR, JobManager.PI_JOBS, 1, msg, null);
- //end the thread job
- endThreadJob(threadJob, false);
- }
- try {
- RuntimeLog.log(error);
- } catch (RuntimeException e) {
- //failed to log, so print to console instead
- System.err.println(error.getMessage());
- }
- }
-
- private void endThreadJob(ThreadJob threadJob, boolean resume) {
- Thread currentThread = Thread.currentThread();
- //clean up when last rule scope exits
- threadJobs.remove(currentThread);
- ISchedulingRule rule = threadJob.getRule();
- if (resume && rule != null)
- suspendedRules.remove(rule);
- //if this job had a rule, then we are essentially releasing a lock
- //note it is safe to do this even if the acquire was aborted
- if (threadJob.acquireRule) {
- manager.getLockManager().removeLockThread(currentThread, rule);
- notifyWaitingThreadJobs();
- }
- //if the job was started, we need to notify job manager to end it
- if (threadJob.isRunning())
- manager.endJob(threadJob, Status.OK_STATUS, false);
- recycle(threadJob);
- }
-
- /**
- * Returns true if this rule has been suspended, and false otherwise.
- */
- private boolean isSuspended(ISchedulingRule rule) {
- if (suspendedRules.size() == 0)
- return false;
- for (Iterator it = suspendedRules.iterator(); it.hasNext();)
- if (((ISchedulingRule) it.next()).contains(rule))
- return true;
- return false;
- }
-
- /**
- * Returns a new or reused ThreadJob instance.
- */
- private ThreadJob newThreadJob(ISchedulingRule rule) {
- if (jobCache != null) {
- ThreadJob job = jobCache;
- job.setRule(rule);
- job.acquireRule = job.isRunning = false;
- job.realJob = null;
- jobCache = null;
- return job;
- }
- return new ThreadJob(manager, rule);
- }
-
- /**
- * A job has just finished that was holding a scheduling rule, and the
- * scheduling rule is now free. Wake any blocked thread jobs so they can
- * compete for the newly freed lock
- */
- private void notifyWaitingThreadJobs() {
- synchronized (ThreadJob.notifier) {
- ThreadJob.notifier.notifyAll();
- }
- }
-
- /**
- * Indicates that a thread job is no longer in use and can be reused.
- */
- private void recycle(ThreadJob job) {
- if (jobCache == null && job.recycle())
- jobCache = job;
- }
-
- /**
- * Implements IJobManager#resume(ISchedulingRule)
- * @param rule
- */
- void resume(ISchedulingRule rule) {
- //resume happens as a consequence of freeing the last rule in the stack
- end(rule, true);
- if (JobManager.DEBUG_BEGIN_END)
- JobManager.debug("Resume rule: " + rule); //$NON-NLS-1$
- }
-
- /**
- * Implements IJobManager#suspend(ISchedulingRule, IProgressMonitor)
- * @param rule
- * @param monitor
- */
- void suspend(ISchedulingRule rule, IProgressMonitor monitor) {
- if (JobManager.DEBUG_BEGIN_END)
- JobManager.debug("Suspend rule: " + rule); //$NON-NLS-1$
- //the suspend job will be remembered once the rule is acquired
- begin(rule, monitor, true);
- }
-
- /**
- * Implements IJobManager#transferRule(ISchedulingRule, Thread)
- */
- synchronized void transfer(ISchedulingRule rule, Thread destinationThread) {
- //nothing to do for null
- if (rule == null)
- return;
- final Thread currentThread = Thread.currentThread();
- //nothing to do if transferring to the same thread
- if (currentThread == destinationThread)
- return;
- //ensure destination thread doesn't already have a rule
- ThreadJob job = (ThreadJob) threadJobs.get(destinationThread);
- Assert.isLegal(job == null);
- //ensure calling thread owns the job being transferred
- job = (ThreadJob) threadJobs.get(currentThread);
- Assert.isNotNull(job);
- Assert.isLegal(job.getRule() == rule);
- //transfer the thread job without ending it
- job.setThread(destinationThread);
- threadJobs.remove(currentThread);
- threadJobs.put(destinationThread, job);
- //transfer lock
- if (job.acquireRule) {
- manager.getLockManager().removeLockThread(currentThread, rule);
- manager.getLockManager().addLockThread(destinationThread, rule);
- }
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/InternalJob.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/InternalJob.java
deleted file mode 100644
index 8246ba5..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/InternalJob.java
+++ /dev/null
@@ -1,563 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import java.util.Map;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.*;
-
-/**
- * Internal implementation class for jobs. Clients must not implement this class
- * directly. All jobs must be subclasses of the API <code>org.eclipse.core.runtime.jobs.Job</code> class.
- */
-public abstract class InternalJob extends PlatformObject implements Comparable {
- /**
- * Job state code (value 16) indicating that a job has been removed from
- * the wait queue and is about to start running. From an API point of view,
- * this is the same as RUNNING.
- */
- static final int ABOUT_TO_RUN = 0x10;
-
- /**
- * Job state code (value 32) indicating that a job has passed scheduling
- * precondition checks and is about to be added to the wait queue. From an API point of view,
- * this is the same as WAITING.
- */
- static final int ABOUT_TO_SCHEDULE = 0x20;
- /**
- * Job state code (value 8) indicating that a job is blocked by another currently
- * running job. From an API point of view, this is the same as WAITING.
- */
- static final int BLOCKED = 0x08;
-
- //flag mask bits
- private static final int M_STATE = 0xFF;
- private static final int M_SYSTEM = 0x0100;
- private static final int M_USER = 0x0200;
-
- /*
- * flag on a job indicating that it was about to run, but has been canceled
- */
- private static final int M_ABOUT_TO_RUN_CANCELED = 0x0400;
-
- protected static final JobManager manager = JobManager.getInstance();
- private static int nextJobNumber = 0;
-
- /**
- * Start time constant indicating a job should be started at
- * a time in the infinite future, causing it to sleep forever.
- */
- static final long T_INFINITE = Long.MAX_VALUE;
- /**
- * Start time constant indicating that the job has no start time.
- */
- static final long T_NONE = -1;
-
- private volatile int flags = Job.NONE;
- private final int jobNumber = nextJobNumber++;
- private ListenerList listeners = null;
- private IProgressMonitor monitor;
- private String name;
- /**
- * The job ahead of me in a queue or list.
- */
- private InternalJob next;
- /**
- * The job behind me in a queue or list.
- */
- private InternalJob previous;
- private int priority = Job.LONG;
- /**
- * Arbitrary properties (key,value) pairs, attached
- * to a job instance by a third party.
- */
- private ObjectMap properties;
- private IStatus result;
- private ISchedulingRule schedulingRule;
- /**
- * If the job is waiting, this represents the time the job should start by.
- * If this job is sleeping, this represents the time the job should wake up.
- * If this job is running, this represents the delay automatic rescheduling,
- * or -1 if the job should not be rescheduled.
- */
- private long startTime;
-
- /**
- * Stamp added when a job is added to the wait queue. Used to ensure
- * jobs in the wait queue maintain their insertion order even if they are
- * removed from the wait queue temporarily while blocked
- */
- private long waitQueueStamp = T_NONE;
-
- /*
- * The thread that is currently running this job
- */
- private volatile Thread thread = null;
-
- protected InternalJob(String name) {
- Assert.isNotNull(name);
- this.name = name;
- }
-
- /* (non-Javadoc)
- * @see Job#addJobListener(IJobChangeListener)
- */
- protected void addJobChangeListener(IJobChangeListener listener) {
- if (listeners == null)
- listeners = new ListenerList(ListenerList.IDENTITY);
- listeners.add(listener);
- }
-
- /**
- * Adds an entry at the end of the list of which this item is the head.
- */
- final void addLast(InternalJob entry) {
- InternalJob last = this;
- //find the end of the queue
- while (last.previous != null)
- last = last.previous;
- //add the new entry to the end of the queue
- last.previous = entry;
- entry.next = last;
- entry.previous = null;
- }
-
- /* (non-Javadoc)
- * @see Job#belongsTo(Object)
- */
- protected boolean belongsTo(Object family) {
- return false;
- }
-
- /* (non-Javadoc)
- * @see Job#cancel()
- */
- protected boolean cancel() {
- return manager.cancel(this);
- }
-
- /* (non-Javadoc)
- * @see Job#canceling()
- */
- protected void canceling() {
- //default implementation does nothing
- }
-
- /* (on-Javadoc)
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public final int compareTo(Object otherJob) {
- return ((InternalJob) otherJob).startTime >= startTime ? 1 : -1;
- }
-
- /* (non-Javadoc)
- * @see Job#done(IStatus)
- */
- protected void done(IStatus endResult) {
- manager.endJob(this, endResult, true);
- }
-
- /**
- * Returns the job listeners that are only listening to this job. Returns
- * <code>null</code> if this job has no listeners.
- */
- final ListenerList getListeners() {
- return listeners;
- }
-
- /* (non-Javadoc)
- * @see Job#getName()
- */
- protected String getName() {
- return name;
- }
-
- /* (non-Javadoc)
- * @see Job#getPriority()
- */
- protected int getPriority() {
- return priority;
- }
-
- /**
- * Returns the job's progress monitor, or null if it is not running.
- */
- final IProgressMonitor getProgressMonitor() {
- return monitor;
- }
-
- /* (non-Javadoc)
- * @see Job#getProperty
- */
- protected Object getProperty(QualifiedName key) {
- // thread safety: (Concurrency001 - copy on write)
- Map temp = properties;
- if (temp == null)
- return null;
- return temp.get(key);
- }
-
- /* (non-Javadoc)
- * @see Job#getResult
- */
- protected IStatus getResult() {
- return result;
- }
-
- /* (non-Javadoc)
- * @see Job#getRule
- */
- protected ISchedulingRule getRule() {
- return schedulingRule;
- }
-
- /**
- * Returns the time that this job should be started, awakened, or
- * rescheduled, depending on the current state.
- * @return time in milliseconds
- */
- final long getStartTime() {
- return startTime;
- }
-
- /* (non-Javadoc)
- * @see Job#getState()
- */
- protected int getState() {
- int state = flags & M_STATE;
- switch (state) {
- //blocked state is equivalent to waiting state for clients
- case BLOCKED :
- return Job.WAITING;
- case ABOUT_TO_RUN :
- return Job.RUNNING;
- case ABOUT_TO_SCHEDULE :
- return Job.WAITING;
- default :
- return state;
- }
- }
-
- /* (non-javadoc)
- * @see Job.getThread
- */
- protected Thread getThread() {
- return thread;
- }
-
- /**
- * Returns the raw job state, including internal states no exposed as API.
- */
- final int internalGetState() {
- return flags & M_STATE;
- }
-
- /**
- * Must be called from JobManager#setPriority
- */
- final void internalSetPriority(int newPriority) {
- this.priority = newPriority;
- }
-
- /**
- * Must be called from JobManager#setRule
- */
- final void internalSetRule(ISchedulingRule rule) {
- this.schedulingRule = rule;
- }
-
- /**
- * Must be called from JobManager#changeState
- */
- final void internalSetState(int i) {
- flags = (flags & ~M_STATE) | i;
- }
-
- /**
- * Returns whether this job was canceled when it was about to run
- */
- final boolean isAboutToRunCanceled() {
- return (flags & M_ABOUT_TO_RUN_CANCELED) != 0;
- }
-
- /* (non-Javadoc)
- * @see Job#isBlocking()
- */
- protected boolean isBlocking() {
- return manager.isBlocking(this);
- }
-
- /**
- * Returns true if this job conflicts with the given job, and false otherwise.
- */
- final boolean isConflicting(InternalJob otherJob) {
- ISchedulingRule otherRule = otherJob.getRule();
- if (schedulingRule == null || otherRule == null)
- return false;
- //if one of the rules is a compound rule, it must be asked the question.
- if (schedulingRule.getClass() == MultiRule.class)
- return schedulingRule.isConflicting(otherRule);
- return otherRule.isConflicting(schedulingRule);
- }
-
- /* (non-javadoc)
- * @see Job.isSystem()
- */
- protected boolean isSystem() {
- return (flags & M_SYSTEM) != 0;
- }
-
- /* (non-javadoc)
- * @see Job.isUser()
- */
- protected boolean isUser() {
- return (flags & M_USER) != 0;
- }
-
- /* (non-Javadoc)
- * @see Job#join()
- */
- protected void join() throws InterruptedException {
- manager.join(this);
- }
-
- /**
- * Returns the next entry (ahead of this one) in the list, or null if there is no next entry
- */
- final InternalJob next() {
- return next;
- }
-
- /**
- * Returns the previous entry (behind this one) in the list, or null if there is no previous entry
- */
- final InternalJob previous() {
- return previous;
- }
-
- /**
- * Removes this entry from any list it belongs to. Returns the receiver.
- */
- final InternalJob remove() {
- if (next != null)
- next.setPrevious(previous);
- if (previous != null)
- previous.setNext(next);
- next = previous = null;
- return this;
- }
-
- /* (non-Javadoc)
- * @see Job#removeJobListener(IJobChangeListener)
- */
- protected void removeJobChangeListener(IJobChangeListener listener) {
- if (listeners != null)
- listeners.remove(listener);
- }
-
- /* (non-Javadoc)
- * @see Job#run(IProgressMonitor)
- */
- protected abstract IStatus run(IProgressMonitor progressMonitor);
-
- /* (non-Javadoc)
- * @see Job#schedule(long)
- */
- protected void schedule(long delay) {
- if (shouldSchedule())
- manager.schedule(this, delay, false);
- }
-
- /**
- * Sets whether this job was canceled when it was about to run
- */
- final void setAboutToRunCanceled(boolean value) {
- flags = value ? flags | M_ABOUT_TO_RUN_CANCELED : flags & ~M_ABOUT_TO_RUN_CANCELED;
-
- }
-
- /* (non-Javadoc)
- * @see Job#setName(String)
- */
- protected void setName(String name) {
- Assert.isNotNull(name);
- this.name = name;
- }
-
- /**
- * Sets the next entry in this linked list of jobs.
- * @param entry
- */
- final void setNext(InternalJob entry) {
- this.next = entry;
- }
-
- /**
- * Sets the previous entry in this linked list of jobs.
- * @param entry
- */
- final void setPrevious(InternalJob entry) {
- this.previous = entry;
- }
-
- /* (non-Javadoc)
- * @see Job#setPriority(int)
- */
- protected void setPriority(int newPriority) {
- switch (newPriority) {
- case Job.INTERACTIVE :
- case Job.SHORT :
- case Job.LONG :
- case Job.BUILD :
- case Job.DECORATE :
- manager.setPriority(this, newPriority);
- break;
- default :
- throw new IllegalArgumentException(String.valueOf(newPriority));
- }
- }
-
- /* (non-Javadoc)
- * @see Job#setProgressGroup(IProgressMonitor, int)
- */
- protected void setProgressGroup(IProgressMonitor group, int ticks) {
- Assert.isNotNull(group);
- IProgressMonitor pm = manager.createMonitor(this, group, ticks);
- if (pm != null)
- setProgressMonitor(pm);
- }
-
- /**
- * Sets the progress monitor to use for the next execution of this job,
- * or for clearing the monitor when a job completes.
- * @param monitor a progress monitor
- */
- final void setProgressMonitor(IProgressMonitor monitor) {
- this.monitor = monitor;
- }
-
- /* (non-Javadoc)
- * @see Job#setProperty(QualifiedName,Object)
- */
- protected void setProperty(QualifiedName key, Object value) {
- // thread safety: (Concurrency001 - copy on write)
- if (value == null) {
- if (properties == null)
- return;
- ObjectMap temp = (ObjectMap) properties.clone();
- temp.remove(key);
- if (temp.isEmpty())
- properties = null;
- else
- properties = temp;
- } else {
- ObjectMap temp = properties;
- if (temp == null)
- temp = new ObjectMap(5);
- else
- temp = (ObjectMap) properties.clone();
- temp.put(key, value);
- properties = temp;
- }
- }
-
- /**
- * Sets or clears the result of an execution of this job.
- * @param result a result status, or <code>null</code>
- */
- final void setResult(IStatus result) {
- this.result = result;
- }
-
- /* (non-Javadoc)
- * @see Job#setRule(ISchedulingRule)
- */
- protected void setRule(ISchedulingRule rule) {
- manager.setRule(this, rule);
- }
-
- /**
- * Sets a time to start, wake up, or schedule this job,
- * depending on the current state
- * @param time a time in milliseconds
- */
- final void setStartTime(long time) {
- startTime = time;
- }
-
- /* (non-javadoc)
- * @see Job.setSystem
- */
- protected void setSystem(boolean value) {
- if (getState() != Job.NONE)
- throw new IllegalStateException();
- flags = value ? flags | M_SYSTEM : flags & ~M_SYSTEM;
- }
-
- /* (non-javadoc)
- * @see Job.setThread
- */
- protected void setThread(Thread thread) {
- this.thread = thread;
- }
-
- /* (non-javadoc)
- * @see Job.setUser
- */
- protected void setUser(boolean value) {
- if (getState() != Job.NONE)
- throw new IllegalStateException();
- flags = value ? flags | M_USER : flags & ~M_USER;
- }
-
- /* (Non-javadoc)
- * @see Job#shouldSchedule
- */
- protected boolean shouldSchedule() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see Job#sleep()
- */
- protected boolean sleep() {
- return manager.sleep(this);
- }
-
- /* (non-Javadoc)
- * Prints a string-based representation of this job instance.
- * For debugging purposes only.
- */
- public String toString() {
- return getName() + "(" + jobNumber + ")"; //$NON-NLS-1$//$NON-NLS-2$
- }
-
- /* (non-Javadoc)
- * @see Job#wakeUp(long)
- */
- protected void wakeUp(long delay) {
- manager.wakeUp(this, delay);
- }
-
- /**
- * @param waitQueueStamp The waitQueueStamp to set.
- */
- void setWaitQueueStamp(long waitQueueStamp) {
- this.waitQueueStamp = waitQueueStamp;
- }
-
- /**
- * @return Returns the waitQueueStamp.
- */
- long getWaitQueueStamp() {
- return waitQueueStamp;
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobActivator.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobActivator.java
deleted file mode 100644
index b738a6a..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobActivator.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import java.util.Hashtable;
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.osgi.framework.*;
-
-/**
- * The Jobs plugin class.
- */
-public class JobActivator implements BundleActivator {
-
- /**
- * Eclipse property. Set to <code>false</code> to avoid registering JobManager
- * as an OSGi service.
- */
- private static final String PROP_REGISTER_JOB_SERVICE = "eclipse.service.jobs"; //$NON-NLS-1$
-
- /**
- * The bundle associated this plug-in
- */
- private static BundleContext bundleContext;
-
- /**
- * This plugin provides a JobManager service.
- */
- private ServiceRegistration jobManagerService = null;
-
- /**
- * This method is called upon plug-in activation
- */
- public void start(BundleContext context) throws Exception {
- bundleContext = context;
- JobOSGiUtils.getDefault().openServices();
-
- boolean shouldRegister = !"false".equalsIgnoreCase(context.getProperty(PROP_REGISTER_JOB_SERVICE)); //$NON-NLS-1$
- if (shouldRegister)
- registerServices();
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- public void stop(BundleContext context) throws Exception {
- unregisterServices();
- JobManager.shutdown();
- JobOSGiUtils.getDefault().closeServices();
- bundleContext = null;
- }
-
- static BundleContext getContext() {
- return bundleContext;
- }
-
- private void registerServices() {
- jobManagerService = bundleContext.registerService(IJobManager.class.getName(), JobManager.getInstance(), new Hashtable());
- }
-
- private void unregisterServices() {
- if (jobManagerService != null) {
- jobManagerService.unregister();
- jobManagerService = null;
- }
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobChangeEvent.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobChangeEvent.java
deleted file mode 100644
index f2889d2..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobChangeEvent.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-
-public class JobChangeEvent implements IJobChangeEvent {
- /**
- * The job on which this event occurred.
- */
- Job job = null;
- /**
- * The result returned by the job's run method, or <code>null</code> if
- * not applicable.
- */
- IStatus result = null;
- /**
- * The amount of time to wait after scheduling the job before it should be run,
- * or <code>-1</code> if not applicable for this type of event.
- */
- long delay = -1;
- /**
- * Whether this job is being immediately rescheduled.
- */
- boolean reschedule = false;
-
- /* (non-Javadoc)
- * Method declared on IJobChangeEvent
- */
- public long getDelay() {
- return delay;
- }
-
- /* (non-Javadoc)
- * Method declared on IJobChangeEvent
- */
- public Job getJob() {
- return job;
- }
-
- /* (non-Javadoc)
- * Method declared on IJobChangeEvent
- */
- public IStatus getResult() {
- return result;
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobListeners.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobListeners.java
deleted file mode 100644
index f03b747..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobListeners.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import org.eclipse.core.internal.runtime.RuntimeLog;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Responsible for notifying all job listeners about job lifecycle events. Uses a
- * specialized iterator to ensure the complex iteration logic is contained in one place.
- */
-class JobListeners {
- interface IListenerDoit {
- public void notify(IJobChangeListener listener, IJobChangeEvent event);
- }
-
- private final IListenerDoit aboutToRun = new IListenerDoit() {
- public void notify(IJobChangeListener listener, IJobChangeEvent event) {
- listener.aboutToRun(event);
- }
- };
- private final IListenerDoit awake = new IListenerDoit() {
- public void notify(IJobChangeListener listener, IJobChangeEvent event) {
- listener.awake(event);
- }
- };
- private final IListenerDoit done = new IListenerDoit() {
- public void notify(IJobChangeListener listener, IJobChangeEvent event) {
- listener.done(event);
- }
- };
- private final IListenerDoit running = new IListenerDoit() {
- public void notify(IJobChangeListener listener, IJobChangeEvent event) {
- listener.running(event);
- }
- };
- private final IListenerDoit scheduled = new IListenerDoit() {
- public void notify(IJobChangeListener listener, IJobChangeEvent event) {
- listener.scheduled(event);
- }
- };
- private final IListenerDoit sleeping = new IListenerDoit() {
- public void notify(IJobChangeListener listener, IJobChangeEvent event) {
- listener.sleeping(event);
- }
- };
- /**
- * The global job listeners.
- */
- protected final ListenerList global = new ListenerList(ListenerList.IDENTITY);
-
- /**
- * TODO Could use an instance pool to re-use old event objects
- */
- static JobChangeEvent newEvent(Job job) {
- JobChangeEvent instance = new JobChangeEvent();
- instance.job = job;
- return instance;
- }
-
- static JobChangeEvent newEvent(Job job, IStatus result) {
- JobChangeEvent instance = new JobChangeEvent();
- instance.job = job;
- instance.result = result;
- return instance;
- }
-
- static JobChangeEvent newEvent(Job job, long delay) {
- JobChangeEvent instance = new JobChangeEvent();
- instance.job = job;
- instance.delay = delay;
- return instance;
- }
-
- /**
- * Process the given doit for all global listeners and all local listeners
- * on the given job.
- */
- private void doNotify(final IListenerDoit doit, final IJobChangeEvent event) {
- //notify all global listeners
- Object[] listeners = global.getListeners();
- int size = listeners.length;
- for (int i = 0; i < size; i++) {
- try {
- if (listeners[i] != null)
- doit.notify((IJobChangeListener) listeners[i], event);
- } catch (Exception e) {
- handleException(listeners[i], e);
- } catch (LinkageError e) {
- handleException(listeners[i], e);
- }
- }
- //notify all local listeners
- ListenerList list = ((InternalJob) event.getJob()).getListeners();
- listeners = list == null ? null : list.getListeners();
- if (listeners == null)
- return;
- size = listeners.length;
- for (int i = 0; i < size; i++) {
- try {
- if (listeners[i] != null)
- doit.notify((IJobChangeListener) listeners[i], event);
- } catch (Exception e) {
- handleException(listeners[i], e);
- } catch (LinkageError e) {
- handleException(listeners[i], e);
- }
- }
- }
-
- private void handleException(Object listener, Throwable e) {
- //this code is roughly copied from InternalPlatform.run(ISafeRunnable),
- //but in-lined here for performance reasons
- if (e instanceof OperationCanceledException)
- return;
- String pluginId = JobOSGiUtils.getDefault().getBundleId(listener);
- if (pluginId == null)
- pluginId = JobManager.PI_JOBS;
- String message = NLS.bind(JobMessages.meta_pluginProblems, pluginId);
- RuntimeLog.log(new Status(IStatus.ERROR, pluginId, JobManager.PLUGIN_ERROR, message, e));
- }
-
- public void add(IJobChangeListener listener) {
- global.add(listener);
- }
-
- public void remove(IJobChangeListener listener) {
- global.remove(listener);
- }
-
- public void aboutToRun(Job job) {
- doNotify(aboutToRun, newEvent(job));
- }
-
- public void awake(Job job) {
- doNotify(awake, newEvent(job));
- }
-
- public void done(Job job, IStatus result, boolean reschedule) {
- JobChangeEvent event = newEvent(job, result);
- event.reschedule = reschedule;
- doNotify(done, event);
- }
-
- public void running(Job job) {
- doNotify(running, newEvent(job));
- }
-
- public void scheduled(Job job, long delay, boolean reschedule) {
- JobChangeEvent event = newEvent(job, delay);
- event.reschedule = reschedule;
- doNotify(scheduled, event);
- }
-
- public void sleeping(Job job) {
- doNotify(sleeping, newEvent(job));
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobManager.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobManager.java
deleted file mode 100644
index da1d6c9..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobManager.java
+++ /dev/null
@@ -1,1243 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-//don't use ICU because this is used for debugging only (see bug 135785)
-import java.text.*;
-import java.util.*;
-import org.eclipse.core.internal.runtime.RuntimeLog;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Implementation of API type IJobManager
- *
- * Implementation note: all the data structures of this class are protected
- * by a single lock object held as a private field in this class. The JobManager
- * instance itself is not used because this class is publicly reachable, and third
- * party clients may try to synchronize on it.
- *
- * The WorkerPool class uses its own monitor for synchronizing its data
- * structures. To avoid deadlock between the two classes, the JobManager
- * must NEVER call the worker pool while its own monitor is held.
- */
-public class JobManager implements IJobManager {
-
- /**
- * The unique identifier constant of this plug-in.
- */
- public static final String PI_JOBS = "org.eclipse.core.jobs"; //$NON-NLS-1$
-
- /**
- * Status code constant indicating an error occurred while running a plug-in.
- * For backward compatibility with Platform.PLUGIN_ERROR left at (value = 2).
- */
- public static final int PLUGIN_ERROR = 2;
-
- private static final String OPTION_DEADLOCK_ERROR = PI_JOBS + "/jobs/errorondeadlock"; //$NON-NLS-1$
- private static final String OPTION_DEBUG_BEGIN_END = PI_JOBS + "/jobs/beginend"; //$NON-NLS-1$
- private static final String OPTION_DEBUG_JOBS = PI_JOBS + "/jobs"; //$NON-NLS-1$
- private static final String OPTION_DEBUG_JOBS_TIMING = PI_JOBS + "/jobs/timing"; //$NON-NLS-1$
- private static final String OPTION_LOCKS = PI_JOBS + "/jobs/locks"; //$NON-NLS-1$
- private static final String OPTION_SHUTDOWN = PI_JOBS + "/jobs/shutdown"; //$NON-NLS-1$
-
- static boolean DEBUG = false;
- static boolean DEBUG_BEGIN_END = false;
- static boolean DEBUG_DEADLOCK = false;
- static boolean DEBUG_LOCKS = false;
- static boolean DEBUG_TIMING = false;
- static boolean DEBUG_SHUTDOWN = false;
- private static DateFormat DEBUG_FORMAT;
-
- /**
- * The singleton job manager instance. It must be a singleton because
- * all job instances maintain a reference (as an optimization) and have no way
- * of updating it.
- */
- private static JobManager instance;
- /**
- * Scheduling rule used for validation of client-defined rules.
- */
- private static final ISchedulingRule nullRule = new ISchedulingRule() {
- public boolean contains(ISchedulingRule rule) {
- return rule == this;
- }
-
- public boolean isConflicting(ISchedulingRule rule) {
- return rule == this;
- }
- };
-
- /**
- * True if this manager is active, and false otherwise. A job manager
- * starts out active, and becomes inactive if it has been shutdown
- * and not restarted.
- */
- private volatile boolean active = true;
-
- final ImplicitJobs implicitJobs = new ImplicitJobs(this);
-
- private final JobListeners jobListeners = new JobListeners();
-
- /**
- * The lock for synchronizing all activity in the job manager. To avoid deadlock,
- * this lock must never be held for extended periods, and must never be
- * held while third party code is being called.
- */
- private final Object lock = new Object();
-
- private final LockManager lockManager = new LockManager();
-
- /**
- * The pool of worker threads.
- */
- private WorkerPool pool;
-
- private ProgressProvider progressProvider = null;
- /**
- * Jobs that are currently running. Should only be modified from changeState
- */
- private final HashSet running;
-
- /**
- * Jobs that are sleeping. Some sleeping jobs are scheduled to wake
- * up at a given start time, while others will sleep indefinitely until woken.
- * Should only be modified from changeState
- */
- private final JobQueue sleeping;
- /**
- * True if this manager has been suspended, and false otherwise. A job manager
- * starts out not suspended, and becomes suspended when <code>suspend</code>
- * is invoked. Once suspended, no jobs will start running until <code>resume</code>
- * is called.
- */
- private boolean suspended = false;
-
- /**
- * jobs that are waiting to be run. Should only be modified from changeState
- */
- private final JobQueue waiting;
-
- /**
- * Counter to record wait queue insertion order.
- */
- private long waitQueueCounter;
-
- public static void debug(String msg) {
- StringBuffer msgBuf = new StringBuffer(msg.length() + 40);
- if (DEBUG_TIMING) {
- //lazy initialize to avoid overhead when not debugging
- if (DEBUG_FORMAT == null)
- DEBUG_FORMAT = new SimpleDateFormat("HH:mm:ss.SSS"); //$NON-NLS-1$
- DEBUG_FORMAT.format(new Date(), msgBuf, new FieldPosition(0));
- msgBuf.append('-');
- }
- msgBuf.append('[').append(Thread.currentThread()).append(']').append(msg);
- System.out.println(msgBuf.toString());
- }
-
- /**
- * Returns the job manager singleton. For internal use only.
- */
- static synchronized JobManager getInstance() {
- if (instance == null)
- new JobManager();
- return instance;
- }
-
- /**
- * For debugging purposes only
- */
- private static String printJobName(Job job) {
- if (job instanceof ThreadJob) {
- Job realJob = ((ThreadJob) job).realJob;
- if (realJob != null)
- return realJob.getClass().getName();
- return "ThreadJob on rule: " + job.getRule(); //$NON-NLS-1$
- }
- return job.getClass().getName();
- }
-
- /**
- * For debugging purposes only
- */
- public static String printState(int state) {
- switch (state) {
- case Job.NONE :
- return "NONE"; //$NON-NLS-1$
- case Job.WAITING :
- return "WAITING"; //$NON-NLS-1$
- case Job.SLEEPING :
- return "SLEEPING"; //$NON-NLS-1$
- case Job.RUNNING :
- return "RUNNING"; //$NON-NLS-1$
- case InternalJob.BLOCKED :
- return "BLOCKED"; //$NON-NLS-1$
- case InternalJob.ABOUT_TO_RUN :
- return "ABOUT_TO_RUN"; //$NON-NLS-1$
- case InternalJob.ABOUT_TO_SCHEDULE :
- return "ABOUT_TO_SCHEDULE";//$NON-NLS-1$
- }
- return "UNKNOWN"; //$NON-NLS-1$
- }
-
- /**
- * Note that although this method is not API, clients have historically used
- * it to force jobs shutdown in cases where OSGi shutdown does not occur.
- * For this reason, this method should be considered near-API and should not
- * be changed if at all possible.
- */
- public static void shutdown() {
- if (instance != null) {
- instance.doShutdown();
- instance = null;
- }
- }
-
- private JobManager() {
- instance = this;
- initDebugOptions();
- synchronized (lock) {
- waiting = new JobQueue(false);
- sleeping = new JobQueue(true);
- running = new HashSet(10);
- pool = new WorkerPool(this);
- }
- pool.setDaemon(JobOSGiUtils.getDefault().useDaemonThreads());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobManager#addJobListener(org.eclipse.core.runtime.jobs.IJobChangeListener)
- */
- public void addJobChangeListener(IJobChangeListener listener) {
- jobListeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobManager#beginRule(org.eclipse.core.runtime.jobs.ISchedulingRule, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void beginRule(ISchedulingRule rule, IProgressMonitor monitor) {
- validateRule(rule);
- implicitJobs.begin(rule, monitorFor(monitor), false);
- }
-
- /**
- * Cancels a job
- */
- protected boolean cancel(InternalJob job) {
- IProgressMonitor monitor = null;
- synchronized (lock) {
- switch (job.getState()) {
- case Job.NONE :
- return true;
- case Job.RUNNING :
- //cannot cancel a job that has already started (as opposed to ABOUT_TO_RUN)
- if (job.internalGetState() == Job.RUNNING) {
- monitor = job.getProgressMonitor();
- break;
- }
- //signal that the job should be canceled before it gets a chance to run
- job.setAboutToRunCanceled(true);
- return true;
- default :
- changeState(job, Job.NONE);
- }
- }
- //call monitor outside sync block
- if (monitor != null) {
- if (!monitor.isCanceled()) {
- monitor.setCanceled(true);
- job.canceling();
- }
- return false;
- }
- //only notify listeners if the job was waiting or sleeping
- jobListeners.done((Job) job, Status.CANCEL_STATUS, false);
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobManager#cancel(java.lang.String)
- */
- public void cancel(Object family) {
- //don't synchronize because cancel calls listeners
- for (Iterator it = select(family).iterator(); it.hasNext();)
- cancel((Job) it.next());
- }
-
- /**
- * Atomically updates the state of a job, adding or removing from the
- * necessary queues or sets.
- */
- private void changeState(InternalJob job, int newState) {
- boolean blockedJobs = false;
- synchronized (lock) {
- int oldState = job.internalGetState();
- switch (oldState) {
- case Job.NONE :
- case InternalJob.ABOUT_TO_SCHEDULE :
- break;
- case InternalJob.BLOCKED :
- //remove this job from the linked list of blocked jobs
- job.remove();
- break;
- case Job.WAITING :
- try {
- waiting.remove(job);
- } catch (RuntimeException e) {
- Assert.isLegal(false, "Tried to remove a job that wasn't in the queue"); //$NON-NLS-1$
- }
- break;
- case Job.SLEEPING :
- try {
- sleeping.remove(job);
- } catch (RuntimeException e) {
- Assert.isLegal(false, "Tried to remove a job that wasn't in the queue"); //$NON-NLS-1$
- }
- break;
- case Job.RUNNING :
- case InternalJob.ABOUT_TO_RUN :
- running.remove(job);
- //add any blocked jobs back to the wait queue
- InternalJob blocked = job.previous();
- job.remove();
- blockedJobs = blocked != null;
- while (blocked != null) {
- InternalJob previous = blocked.previous();
- changeState(blocked, Job.WAITING);
- blocked = previous;
- }
- break;
- default :
- Assert.isLegal(false, "Invalid job state: " + job + ", state: " + oldState); //$NON-NLS-1$ //$NON-NLS-2$
- }
- job.internalSetState(newState);
- switch (newState) {
- case Job.NONE :
- job.setStartTime(InternalJob.T_NONE);
- job.setWaitQueueStamp(InternalJob.T_NONE);
- case InternalJob.BLOCKED :
- break;
- case Job.WAITING :
- waiting.enqueue(job);
- break;
- case Job.SLEEPING :
- try {
- sleeping.enqueue(job);
- } catch (RuntimeException e) {
- throw new RuntimeException("Error changing from state: " + oldState); //$NON-NLS-1$
- }
- break;
- case Job.RUNNING :
- case InternalJob.ABOUT_TO_RUN :
- job.setStartTime(InternalJob.T_NONE);
- job.setWaitQueueStamp(InternalJob.T_NONE);
- running.add(job);
- break;
- case InternalJob.ABOUT_TO_SCHEDULE :
- break;
- default :
- Assert.isLegal(false, "Invalid job state: " + job + ", state: " + newState); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- //notify queue outside sync block
- if (blockedJobs)
- pool.jobQueued();
- }
-
- /**
- * Returns a new progress monitor for this job, belonging to the given
- * progress group. Returns null if it is not a valid time to set the job's group.
- */
- protected IProgressMonitor createMonitor(InternalJob job, IProgressMonitor group, int ticks) {
- synchronized (lock) {
- //group must be set before the job is scheduled
- //this includes the ABOUT_TO_SCHEDULE state, during which it is still
- //valid to set the progress monitor
- if (job.getState() != Job.NONE)
- return null;
- IProgressMonitor monitor = null;
- if (progressProvider != null)
- monitor = progressProvider.createMonitor((Job) job, group, ticks);
- if (monitor == null)
- monitor = new NullProgressMonitor();
- return monitor;
- }
- }
-
- /**
- * Returns a new progress monitor for this job. Never returns null.
- */
- private IProgressMonitor createMonitor(Job job) {
- IProgressMonitor monitor = null;
- if (progressProvider != null)
- monitor = progressProvider.createMonitor(job);
- if (monitor == null)
- monitor = new NullProgressMonitor();
- return monitor;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobManager#createProgressGroup()
- */
- public IProgressMonitor createProgressGroup() {
- if (progressProvider != null)
- return progressProvider.createProgressGroup();
- return new NullProgressMonitor();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobManager#currentJob()
- */
- public Job currentJob() {
- Thread current = Thread.currentThread();
- if (current instanceof Worker)
- return ((Worker) current).currentJob();
- synchronized (lock) {
- for (Iterator it = running.iterator(); it.hasNext();) {
- Job job = (Job) it.next();
- if (job.getThread() == current)
- return job;
- }
- }
- return null;
- }
-
- /**
- * Returns the delay in milliseconds that a job with a given priority can
- * tolerate waiting.
- */
- private long delayFor(int priority) {
- //these values may need to be tweaked based on machine speed
- switch (priority) {
- case Job.INTERACTIVE :
- return 0L;
- case Job.SHORT :
- return 50L;
- case Job.LONG :
- return 100L;
- case Job.BUILD :
- return 500L;
- case Job.DECORATE :
- return 1000L;
- default :
- Assert.isTrue(false, "Job has invalid priority: " + priority); //$NON-NLS-1$
- return 0;
- }
- }
-
- /**
- * Performs the scheduling of a job. Does not perform any notifications.
- */
- private void doSchedule(InternalJob job, long delay) {
- synchronized (lock) {
- //if it's a decoration job with no rule, don't run it right now if the system is busy
- if (job.getPriority() == Job.DECORATE && job.getRule() == null) {
- long minDelay = running.size() * 100;
- delay = Math.max(delay, minDelay);
- }
- if (delay > 0) {
- job.setStartTime(System.currentTimeMillis() + delay);
- changeState(job, Job.SLEEPING);
- } else {
- job.setStartTime(System.currentTimeMillis() + delayFor(job.getPriority()));
- job.setWaitQueueStamp(waitQueueCounter++);
- changeState(job, Job.WAITING);
- }
- }
- }
-
- /**
- * Shuts down the job manager. Currently running jobs will be told
- * to stop, but worker threads may still continue processing.
- * (note: This implemented IJobManager.shutdown which was removed
- * due to problems caused by premature shutdown)
- */
- private void doShutdown() {
- Job[] toCancel = null;
- synchronized (lock) {
- if (active) {
- active = false;
- //cancel all running jobs
- toCancel = (Job[]) running.toArray(new Job[running.size()]);
- //clean up
- sleeping.clear();
- waiting.clear();
- running.clear();
- }
- }
-
- // Give running jobs a chance to finish. Wait 0.1 seconds for up to 3 times.
- if (toCancel != null && toCancel.length > 0) {
- for (int i = 0; i < toCancel.length; i++) {
- cancel(toCancel[i]); // cancel jobs outside sync block to avoid deadlock
- }
-
- for (int waitAttempts = 0; waitAttempts < 3; waitAttempts++) {
- Thread.yield();
- synchronized (lock) {
- if (running.isEmpty())
- break;
- }
- if (DEBUG_SHUTDOWN) {
- JobManager.debug("Shutdown - job wait cycle #" + (waitAttempts + 1)); //$NON-NLS-1$
- Job[] stillRunning = null;
- synchronized (lock) {
- stillRunning = (Job[]) running.toArray(new Job[running.size()]);
- }
- if (stillRunning != null) {
- for (int j = 0; j < stillRunning.length; j++) {
- JobManager.debug("\tJob: " + printJobName(stillRunning[j])); //$NON-NLS-1$
- }
- }
- }
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- //ignore
- }
- Thread.yield();
- }
-
- synchronized (lock) { // retrieve list of the jobs that are still running
- toCancel = (Job[]) running.toArray(new Job[running.size()]);
- }
- }
-
- if (toCancel != null) {
- for (int i = 0; i < toCancel.length; i++) {
- String jobName = printJobName(toCancel[i]);
- //this doesn't need to be translated because it's just being logged
- String msg = "Job found still running after platform shutdown. Jobs should be canceled by the plugin that scheduled them during shutdown: " + jobName; //$NON-NLS-1$
- RuntimeLog.log(new Status(IStatus.WARNING, JobManager.PI_JOBS, JobManager.PLUGIN_ERROR, msg, null));
-
- // TODO the RuntimeLog.log in its current implementation won't produce a log
- // during this stage of shutdown. For now add a standard error output.
- // One the logging story is improved, the System.err output below can be removed:
- System.err.println(msg);
- }
- }
-
- pool.shutdown();
- }
-
- /**
- * Indicates that a job was running, and has now finished. Note that this method
- * can be called under OutOfMemoryError conditions and thus must be paranoid
- * about allocating objects.
- */
- protected void endJob(InternalJob job, IStatus result, boolean notify) {
- long rescheduleDelay = InternalJob.T_NONE;
- synchronized (lock) {
- //if the job is finishing asynchronously, there is nothing more to do for now
- if (result == Job.ASYNC_FINISH)
- return;
- //if job is not known then it cannot be done
- if (job.getState() == Job.NONE)
- return;
- if (JobManager.DEBUG && notify)
- JobManager.debug("Ending job: " + job); //$NON-NLS-1$
- job.setResult(result);
- job.setProgressMonitor(null);
- job.setThread(null);
- rescheduleDelay = job.getStartTime();
- changeState(job, Job.NONE);
- }
- //notify listeners outside sync block
- final boolean reschedule = active && rescheduleDelay > InternalJob.T_NONE && job.shouldSchedule();
- if (notify)
- jobListeners.done((Job) job, result, reschedule);
- //reschedule the job if requested and we are still active
- if (reschedule)
- schedule(job, rescheduleDelay, reschedule);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobManager#endRule(org.eclipse.core.runtime.jobs.ISchedulingRule)
- */
- public void endRule(ISchedulingRule rule) {
- implicitJobs.end(rule, false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobManager#find(java.lang.String)
- */
- public Job[] find(Object family) {
- List members = select(family);
- return (Job[]) members.toArray(new Job[members.size()]);
- }
-
- /**
- * Returns a running or blocked job whose scheduling rule conflicts with the
- * scheduling rule of the given waiting job. Returns null if there are no
- * conflicting jobs. A job can only run if there are no running jobs and no blocked
- * jobs whose scheduling rule conflicts with its rule.
- */
- protected InternalJob findBlockingJob(InternalJob waitingJob) {
- if (waitingJob.getRule() == null)
- return null;
- synchronized (lock) {
- if (running.isEmpty())
- return null;
- //check the running jobs
- boolean hasBlockedJobs = false;
- for (Iterator it = running.iterator(); it.hasNext();) {
- InternalJob job = (InternalJob) it.next();
- if (waitingJob.isConflicting(job))
- return job;
- if (!hasBlockedJobs)
- hasBlockedJobs = job.previous() != null;
- }
- //there are no blocked jobs, so we are done
- if (!hasBlockedJobs)
- return null;
- //check all jobs blocked by running jobs
- for (Iterator it = running.iterator(); it.hasNext();) {
- InternalJob job = (InternalJob) it.next();
- while (true) {
- job = job.previous();
- if (job == null)
- break;
- if (waitingJob.isConflicting(job))
- return job;
- }
- }
- }
- return null;
- }
-
- public LockManager getLockManager() {
- return lockManager;
- }
-
- private void initDebugOptions() {
- DEBUG = JobOSGiUtils.getDefault().getBooleanDebugOption(OPTION_DEBUG_JOBS, false);
- DEBUG_BEGIN_END = JobOSGiUtils.getDefault().getBooleanDebugOption(OPTION_DEBUG_BEGIN_END, false);
- DEBUG_DEADLOCK = JobOSGiUtils.getDefault().getBooleanDebugOption(OPTION_DEADLOCK_ERROR, false);
- DEBUG_LOCKS = JobOSGiUtils.getDefault().getBooleanDebugOption(OPTION_LOCKS, false);
- DEBUG_TIMING = JobOSGiUtils.getDefault().getBooleanDebugOption(OPTION_DEBUG_JOBS_TIMING, false);
- DEBUG_SHUTDOWN = JobOSGiUtils.getDefault().getBooleanDebugOption(OPTION_SHUTDOWN, false);
- }
-
- /**
- * Returns whether the job manager is active (has not been shutdown).
- */
- protected boolean isActive() {
- return active;
- }
-
- /**
- * Returns true if the given job is blocking the execution of a non-system
- * job.
- */
- protected boolean isBlocking(InternalJob runningJob) {
- synchronized (lock) {
- // if this job isn't running, it can't be blocking anyone
- if (runningJob.getState() != Job.RUNNING)
- return false;
- // if any job is queued behind this one, it is blocked by it
- InternalJob previous = runningJob.previous();
- while (previous != null) {
- // ignore jobs of lower priority (higher priority value means lower priority)
- if (previous.getPriority() < runningJob.getPriority()) {
- if (!previous.isSystem())
- return true;
- // implicit jobs should interrupt unless they act on behalf of system jobs
- if (previous instanceof ThreadJob && ((ThreadJob) previous).shouldInterrupt())
- return true;
- }
- previous = previous.previous();
- }
- // none found
- return false;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobManager#isIdle()
- */
- public boolean isIdle() {
- synchronized (lock) {
- return running.isEmpty() && waiting.isEmpty();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobManager#isSuspended()
- */
- public boolean isSuspended() {
- synchronized (lock) {
- return suspended;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#job(org.eclipse.core.runtime.jobs.Job)
- */
- protected void join(InternalJob job) {
- final IJobChangeListener listener;
- final Semaphore barrier;
- synchronized (lock) {
- int state = job.getState();
- if (state == Job.NONE)
- return;
- //don't join a waiting or sleeping job when suspended (deadlock risk)
- if (suspended && state != Job.RUNNING)
- return;
- //it's an error for a job to join itself
- if (state == Job.RUNNING && job.getThread() == Thread.currentThread())
- throw new IllegalStateException("Job attempted to join itself"); //$NON-NLS-1$
- //the semaphore will be released when the job is done
- barrier = new Semaphore(null);
- listener = new JobChangeAdapter() {
- public void done(IJobChangeEvent event) {
- barrier.release();
- }
- };
- job.addJobChangeListener(listener);
- //compute set of all jobs that must run before this one
- //add a listener that removes jobs from the blocking set when they finish
- }
- //wait until listener notifies this thread.
- try {
- while (true) {
- //notify hook to service pending syncExecs before falling asleep
- lockManager.aboutToWait(job.getThread());
- try {
- if (barrier.acquire(Long.MAX_VALUE))
- break;
- } catch (InterruptedException e) {
- //loop and keep trying
- }
- }
- } finally {
- lockManager.aboutToRelease();
- job.removeJobChangeListener(listener);
- }
- }
-
- /* (non-Javadoc)
- * @see IJobManager#join(String, IProgressMonitor)
- */
- public void join(final Object family, IProgressMonitor monitor) throws InterruptedException, OperationCanceledException {
- monitor = monitorFor(monitor);
- IJobChangeListener listener = null;
- final Set jobs;
- int jobCount;
- Job blocking = null;
- synchronized (lock) {
- //don't join a waiting or sleeping job when suspended (deadlock risk)
- int states = suspended ? Job.RUNNING : Job.RUNNING | Job.WAITING | Job.SLEEPING;
- jobs = Collections.synchronizedSet(new HashSet(select(family, states)));
- jobCount = jobs.size();
- if (jobCount > 0) {
- //if there is only one blocking job, use it in the blockage callback below
- if (jobCount == 1)
- blocking = (Job) jobs.iterator().next();
- listener = new JobChangeAdapter() {
- public void done(IJobChangeEvent event) {
- //don't remove from list if job is being rescheduled
- if (!((JobChangeEvent) event).reschedule)
- jobs.remove(event.getJob());
- }
-
- //update the list of jobs if new ones are added during the join
- public void scheduled(IJobChangeEvent event) {
- //don't add to list if job is being rescheduled
- if (((JobChangeEvent) event).reschedule)
- return;
- Job job = event.getJob();
- if (job.belongsTo(family))
- jobs.add(job);
- }
- };
- addJobChangeListener(listener);
- }
- }
- if (jobCount == 0) {
- //use up the monitor outside synchronized block because monitors call untrusted code
- monitor.beginTask(JobMessages.jobs_blocked0, 1);
- monitor.done();
- return;
- }
- //spin until all jobs are completed
- try {
- monitor.beginTask(JobMessages.jobs_blocked0, jobCount);
- monitor.subTask(NLS.bind(JobMessages.jobs_waitFamSub, Integer.toString(jobCount)));
- reportBlocked(monitor, blocking);
- int jobsLeft;
- int reportedWorkDone = 0;
- while ((jobsLeft = jobs.size()) > 0) {
- //don't let there be negative work done if new jobs have
- //been added since the join began
- int actualWorkDone = Math.max(0, jobCount - jobsLeft);
- if (reportedWorkDone < actualWorkDone) {
- monitor.worked(actualWorkDone - reportedWorkDone);
- reportedWorkDone = actualWorkDone;
- monitor.subTask(NLS.bind(JobMessages.jobs_waitFamSub, Integer.toString(jobsLeft)));
- }
- if (Thread.interrupted())
- throw new InterruptedException();
- if (monitor.isCanceled())
- throw new OperationCanceledException();
- //notify hook to service pending syncExecs before falling asleep
- lockManager.aboutToWait(null);
- Thread.sleep(100);
- }
- } finally {
- lockManager.aboutToRelease();
- removeJobChangeListener(listener);
- reportUnblocked(monitor);
- monitor.done();
- }
- }
-
- /**
- * Returns a non-null progress monitor instance. If the monitor is null,
- * returns the default monitor supplied by the progress provider, or a
- * NullProgressMonitor if no default monitor is available.
- */
- private IProgressMonitor monitorFor(IProgressMonitor monitor) {
- if (monitor == null || (monitor instanceof NullProgressMonitor)) {
- if (progressProvider != null) {
- try {
- monitor = progressProvider.getDefaultMonitor();
- } catch (Exception e) {
- String msg = NLS.bind(JobMessages.meta_pluginProblems, JobManager.PI_JOBS);
- RuntimeLog.log(new Status(IStatus.ERROR, JobManager.PI_JOBS, JobManager.PLUGIN_ERROR, msg, e));
- }
- }
- }
-
- if (monitor == null)
- return new NullProgressMonitor();
- return monitor;
- }
-
- /* (non-Javadoc)
- * @see IJobManager#newLock(java.lang.String)
- */
- public ILock newLock() {
- return lockManager.newLock();
- }
-
- /**
- * Removes and returns the first waiting job in the queue. Returns null if there
- * are no items waiting in the queue. If an item is removed from the queue,
- * it is moved to the running jobs list.
- */
- private Job nextJob() {
- synchronized (lock) {
- //do nothing if the job manager is suspended
- if (suspended)
- return null;
- //tickle the sleep queue to see if anyone wakes up
- long now = System.currentTimeMillis();
- InternalJob job = sleeping.peek();
- while (job != null && job.getStartTime() < now) {
- job.setStartTime(now + delayFor(job.getPriority()));
- job.setWaitQueueStamp(waitQueueCounter++);
- changeState(job, Job.WAITING);
- job = sleeping.peek();
- }
- //process the wait queue until we find a job whose rules are satisfied.
- while ((job = waiting.peek()) != null) {
- InternalJob blocker = findBlockingJob(job);
- if (blocker == null)
- break;
- //queue this job after the job that's blocking it
- changeState(job, InternalJob.BLOCKED);
- //assert job does not already belong to some other data structure
- Assert.isTrue(job.next() == null);
- Assert.isTrue(job.previous() == null);
- blocker.addLast(job);
- }
- //the job to run must be in the running list before we exit
- //the sync block, otherwise two jobs with conflicting rules could start at once
- if (job != null) {
- changeState(job, InternalJob.ABOUT_TO_RUN);
- if (JobManager.DEBUG)
- JobManager.debug("Starting job: " + job); //$NON-NLS-1$
- }
- return (Job) job;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobManager#removeJobListener(org.eclipse.core.runtime.jobs.IJobChangeListener)
- */
- public void removeJobChangeListener(IJobChangeListener listener) {
- jobListeners.remove(listener);
- }
-
- /**
- * Report to the progress monitor that this thread is blocked, supplying
- * an information message, and if possible the job that is causing the blockage.
- * Important: An invocation of this method MUST be followed eventually be
- * an invocation of reportUnblocked.
- * @param monitor The monitor to report blocking to
- * @param blockingJob The job that is blocking this thread, or <code>null</code>
- * @see #reportUnblocked
- */
- final void reportBlocked(IProgressMonitor monitor, InternalJob blockingJob) {
- if (!(monitor instanceof IProgressMonitorWithBlocking))
- return;
- IStatus reason;
- if (blockingJob == null || blockingJob instanceof ThreadJob || blockingJob.isSystem()) {
- reason = new Status(IStatus.INFO, JobManager.PI_JOBS, 1, JobMessages.jobs_blocked0, null);
- } else {
- String msg = NLS.bind(JobMessages.jobs_blocked1, blockingJob.getName());
- reason = new JobStatus(IStatus.INFO, (Job) blockingJob, msg);
- }
- ((IProgressMonitorWithBlocking) monitor).setBlocked(reason);
- }
-
- /**
- * Reports that this thread was blocked, but is no longer blocked and is able
- * to proceed.
- * @param monitor The monitor to report unblocking to.
- * @see #reportBlocked
- */
- final void reportUnblocked(IProgressMonitor monitor) {
- if (monitor instanceof IProgressMonitorWithBlocking)
- ((IProgressMonitorWithBlocking) monitor).clearBlocked();
- }
-
- /*(non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobManager#resume()
- */
- public final void resume() {
- synchronized (lock) {
- suspended = false;
- //poke the job pool
- pool.jobQueued();
- }
- }
-
- /** (non-Javadoc)
- * @deprecated this method should not be used
- * @see org.eclipse.core.runtime.jobs.IJobManager#resume(org.eclipse.core.runtime.jobs.ISchedulingRule)
- */
- public final void resume(ISchedulingRule rule) {
- implicitJobs.resume(rule);
- }
-
- /**
- * Attempts to immediately start a given job. Returns true if the job was
- * successfully started, and false if it could not be started immediately
- * due to a currently running job with a conflicting rule. Listeners will never
- * be notified of jobs that are run in this way.
- */
- protected boolean runNow(InternalJob job) {
- synchronized (lock) {
- //cannot start if there is a conflicting job
- if (findBlockingJob(job) != null)
- return false;
- changeState(job, Job.RUNNING);
- job.setProgressMonitor(new NullProgressMonitor());
- job.run(null);
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#schedule(long)
- */
- protected void schedule(InternalJob job, long delay, boolean reschedule) {
- if (!active)
- throw new IllegalStateException("Job manager has been shut down."); //$NON-NLS-1$
- Assert.isNotNull(job, "Job is null"); //$NON-NLS-1$
- Assert.isLegal(delay >= 0, "Scheduling delay is negative"); //$NON-NLS-1$
- synchronized (lock) {
- //if the job is already running, set it to be rescheduled when done
- if (job.getState() == Job.RUNNING) {
- job.setStartTime(delay);
- return;
- }
- //can't schedule a job that is waiting or sleeping
- if (job.internalGetState() != Job.NONE)
- return;
- if (JobManager.DEBUG)
- JobManager.debug("Scheduling job: " + job); //$NON-NLS-1$
- //remember that we are about to schedule the job
- //to prevent multiple schedule attempts from succeeding (bug 68452)
- changeState(job, InternalJob.ABOUT_TO_SCHEDULE);
- }
- //notify listeners outside sync block
- jobListeners.scheduled((Job) job, delay, reschedule);
- //schedule the job
- doSchedule(job, delay);
- //call the pool outside sync block to avoid deadlock
- pool.jobQueued();
- }
-
- /**
- * Adds all family members in the list of jobs to the collection
- */
- private void select(List members, Object family, InternalJob firstJob, int stateMask) {
- if (firstJob == null)
- return;
- InternalJob job = firstJob;
- do {
- //note that job state cannot be NONE at this point
- if ((family == null || job.belongsTo(family)) && ((job.getState() & stateMask) != 0))
- members.add(job);
- job = job.previous();
- } while (job != null && job != firstJob);
- }
-
- /**
- * Returns a list of all jobs known to the job manager that belong to the given family.
- */
- private List select(Object family) {
- return select(family, Job.WAITING | Job.SLEEPING | Job.RUNNING);
- }
-
- /**
- * Returns a list of all jobs known to the job manager that belong to the given
- * family and are in one of the provided states.
- */
- private List select(Object family, int stateMask) {
- List members = new ArrayList();
- synchronized (lock) {
- if ((stateMask & Job.RUNNING) != 0) {
- for (Iterator it = running.iterator(); it.hasNext();) {
- select(members, family, (InternalJob) it.next(), stateMask);
- }
- }
- if ((stateMask & Job.WAITING) != 0)
- select(members, family, waiting.peek(), stateMask);
- if ((stateMask & Job.SLEEPING) != 0)
- select(members, family, sleeping.peek(), stateMask);
- }
- return members;
- }
-
- /* (non-Javadoc)
- * @see IJobManager#setLockListener(LockListener)
- */
- public void setLockListener(LockListener listener) {
- lockManager.setLockListener(listener);
- }
-
- /**
- * Changes a job priority.
- */
- protected void setPriority(InternalJob job, int newPriority) {
- synchronized (lock) {
- int oldPriority = job.getPriority();
- if (oldPriority == newPriority)
- return;
- job.internalSetPriority(newPriority);
- //if the job is waiting to run, re-shuffle the queue
- if (job.getState() == Job.WAITING) {
- long oldStart = job.getStartTime();
- job.setStartTime(oldStart + (delayFor(newPriority) - delayFor(oldPriority)));
- waiting.resort(job);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see IJobManager#setProgressProvider(IProgressProvider)
- */
- public void setProgressProvider(ProgressProvider provider) {
- progressProvider = provider;
- }
-
- /* (non-Javadoc)
- * @see Job#setRule
- */
- public void setRule(InternalJob job, ISchedulingRule rule) {
- synchronized (lock) {
- //cannot change the rule of a job that is already running
- Assert.isLegal(job.getState() == Job.NONE);
- validateRule(rule);
- job.internalSetRule(rule);
- }
- }
-
- /**
- * Puts a job to sleep. Returns true if the job was successfully put to sleep.
- */
- protected boolean sleep(InternalJob job) {
- synchronized (lock) {
- switch (job.getState()) {
- case Job.RUNNING :
- //cannot be paused if it is already running (as opposed to ABOUT_TO_RUN)
- if (job.internalGetState() == Job.RUNNING)
- return false;
- //job hasn't started running yet (aboutToRun listener)
- break;
- case Job.SLEEPING :
- //update the job wake time
- job.setStartTime(InternalJob.T_INFINITE);
- //change state again to re-shuffle the sleep queue
- changeState(job, Job.SLEEPING);
- return true;
- case Job.NONE :
- return true;
- case Job.WAITING :
- //put the job to sleep
- break;
- }
- job.setStartTime(InternalJob.T_INFINITE);
- changeState(job, Job.SLEEPING);
- }
- jobListeners.sleeping((Job) job);
- return true;
- }
-
- /* (non-Javadoc)
- * @see IJobManager#sleep(String)
- */
- public void sleep(Object family) {
- //don't synchronize because sleep calls listeners
- for (Iterator it = select(family).iterator(); it.hasNext();) {
- sleep((InternalJob) it.next());
- }
- }
-
- /**
- * Returns the estimated time in milliseconds before the next job is scheduled
- * to wake up. The result may be negative. Returns InternalJob.T_INFINITE if
- * there are no sleeping or waiting jobs.
- */
- protected long sleepHint() {
- synchronized (lock) {
- //wait forever if job manager is suspended
- if (suspended)
- return InternalJob.T_INFINITE;
- if (!waiting.isEmpty())
- return 0L;
- //return the anticipated time that the next sleeping job will wake
- InternalJob next = sleeping.peek();
- if (next == null)
- return InternalJob.T_INFINITE;
- return next.getStartTime() - System.currentTimeMillis();
- }
- }
-
- /**
- * Returns the next job to be run, or null if no jobs are waiting to run.
- * The worker must call endJob when the job is finished running.
- */
- protected Job startJob() {
- Job job = null;
- while (true) {
- job = nextJob();
- if (job == null)
- return null;
- //must perform this outside sync block because it is third party code
- if (job.shouldRun()) {
- //check for listener veto
- jobListeners.aboutToRun(job);
- //listeners may have canceled or put the job to sleep
- synchronized (lock) {
- if (job.getState() == Job.RUNNING) {
- InternalJob internal = job;
- if (internal.isAboutToRunCanceled()) {
- internal.setAboutToRunCanceled(false);
- //fall through and end the job below
- } else {
- internal.setProgressMonitor(createMonitor(job));
- //change from ABOUT_TO_RUN to RUNNING
- internal.internalSetState(Job.RUNNING);
- break;
- }
- }
- }
- }
- if (job.getState() != Job.SLEEPING) {
- //job has been vetoed or canceled, so mark it as done
- endJob(job, Status.CANCEL_STATUS, true);
- continue;
- }
- }
- jobListeners.running(job);
- return job;
-
- }
-
- /* non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobManager#suspend()
- */
- public final void suspend() {
- synchronized (lock) {
- suspended = true;
- }
- }
-
- /** (non-Javadoc)
- * @deprecated this method should not be used
- * @see org.eclipse.core.runtime.jobs.IJobManager#suspend(org.eclipse.core.runtime.jobs.ISchedulingRule, org.eclipse.core.runtime.IProgressMonitor)
- */
- public final void suspend(ISchedulingRule rule, IProgressMonitor monitor) {
- Assert.isNotNull(rule);
- implicitJobs.suspend(rule, monitorFor(monitor));
- }
-
- /* non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobManager#transferRule()
- */
- public void transferRule(ISchedulingRule rule, Thread destinationThread) {
- implicitJobs.transfer(rule, destinationThread);
- }
-
- /**
- * Validates that the given scheduling rule obeys the constraints of
- * scheduling rules as described in the <code>ISchedulingRule</code>
- * javadoc specification.
- */
- private void validateRule(ISchedulingRule rule) {
- //null rule always valid
- if (rule == null)
- return;
- //contains method must be reflexive
- Assert.isLegal(rule.contains(rule));
- //contains method must return false when given an unknown rule
- Assert.isLegal(!rule.contains(nullRule));
- //isConflicting method must be reflexive
- Assert.isLegal(rule.isConflicting(rule));
- //isConflicting method must return false when given an unknown rule
- Assert.isLegal(!rule.isConflicting(nullRule));
- }
-
- /* (non-Javadoc)
- * @see Job#wakeUp(long)
- */
- protected void wakeUp(InternalJob job, long delay) {
- Assert.isLegal(delay >= 0, "Scheduling delay is negative"); //$NON-NLS-1$
- synchronized (lock) {
- //cannot wake up if it is not sleeping
- if (job.getState() != Job.SLEEPING)
- return;
- doSchedule(job, delay);
- }
- //call the pool outside sync block to avoid deadlock
- pool.jobQueued();
-
- //only notify of wake up if immediate
- if (delay == 0)
- jobListeners.awake((Job) job);
- }
-
- /* (non-Javadoc)
- * @see IJobFamily#wakeUp(String)
- */
- public void wakeUp(Object family) {
- //don't synchronize because wakeUp calls listeners
- for (Iterator it = select(family).iterator(); it.hasNext();) {
- wakeUp((InternalJob) it.next(), 0L);
- }
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobMessages.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobMessages.java
deleted file mode 100644
index 562d750..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobMessages.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import java.util.Date;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Job plugin message catalog
- */
-public class JobMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.core.internal.jobs.messages"; //$NON-NLS-1$
-
- // Job Manager and Locks
- public static String jobs_blocked0;
- public static String jobs_blocked1;
- public static String jobs_internalError;
- public static String jobs_waitFamSub;
-
- // metadata
- public static String meta_pluginProblems;
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, JobMessages.class);
- }
-
- /**
- * Print a debug message to the console.
- * Pre-pend the message with the current date and the name of the current thread.
- */
- public static void message(String message) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(new Date(System.currentTimeMillis()));
- buffer.append(" - ["); //$NON-NLS-1$
- buffer.append(Thread.currentThread().getName());
- buffer.append("] "); //$NON-NLS-1$
- buffer.append(message);
- System.out.println(buffer.toString());
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobOSGiUtils.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobOSGiUtils.java
deleted file mode 100644
index bf35634..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobOSGiUtils.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.osgi.service.debug.DebugOptions;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * The class contains a set of helper methods for the runtime Jobs plugin.
- * The following utility methods are supplied:
- * - provides access to debug options
- * - provides some bundle discovery functionality
- *
- * The closeServices() method should be called before the plugin is stopped.
- *
- * @since org.eclipse.core.jobs 3.2
- */
-class JobOSGiUtils {
- private ServiceTracker debugTracker = null;
- private ServiceTracker bundleTracker = null;
-
- private static final JobOSGiUtils singleton = new JobOSGiUtils();
-
- /**
- * Accessor for the singleton instance
- * @return The JobOSGiUtils instance
- */
- public static JobOSGiUtils getDefault() {
- return singleton;
- }
-
- /**
- * Private constructor to block instance creation.
- */
- private JobOSGiUtils() {
- super();
- }
-
- void openServices() {
- BundleContext context = JobActivator.getContext();
- if (context == null) {
- if (JobManager.DEBUG)
- JobMessages.message("JobsOSGiUtils called before plugin started"); //$NON-NLS-1$
- return;
- }
-
- debugTracker = new ServiceTracker(context, DebugOptions.class.getName(), null);
- debugTracker.open();
-
- bundleTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
- bundleTracker.open();
- }
-
- void closeServices() {
- if (debugTracker != null) {
- debugTracker.close();
- debugTracker = null;
- }
- if (bundleTracker != null) {
- bundleTracker.close();
- bundleTracker = null;
- }
- }
-
- public boolean getBooleanDebugOption(String option, boolean defaultValue) {
- if (debugTracker == null) {
- if (JobManager.DEBUG)
- JobMessages.message("Debug tracker is not set"); //$NON-NLS-1$
- return defaultValue;
- }
- DebugOptions options = (DebugOptions) debugTracker.getService();
- if (options != null) {
- String value = options.getOption(option);
- if (value != null)
- return value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
- return defaultValue;
- }
-
- /**
- * Returns the bundle id of the bundle that contains the provided object, or
- * <code>null</code> if the bundle could not be determined.
- */
- public String getBundleId(Object object) {
- if (bundleTracker == null) {
- if (JobManager.DEBUG)
- JobMessages.message("Bundle tracker is not set"); //$NON-NLS-1$
- return null;
- }
- PackageAdmin packageAdmin = (PackageAdmin) bundleTracker.getService();
- if (object == null)
- return null;
- if (packageAdmin == null)
- return null;
- Bundle source = packageAdmin.getBundle(object.getClass());
- if (source != null && source.getSymbolicName() != null)
- return source.getSymbolicName();
- return null;
- }
-
- /**
- * Calculates whether the job plugin should set worker threads to be daemon
- * threads. When workers are daemon threads, the job plugin does not need
- * to be explicitly shut down because the VM can exit while workers are still
- * alive.
- * @return <code>true</code> if all worker threads should be daemon threads,
- * and <code>false</code> otherwise.
- */
- boolean useDaemonThreads() {
- BundleContext context = JobActivator.getContext();
- if (context == null) {
- //we are running stand-alone, so consult global system property
- String value = System.getProperty(IJobManager.PROP_USE_DAEMON_THREADS);
- //default to use daemon threads if property is absent
- if (value == null)
- return true;
- return "true".equalsIgnoreCase(value); //$NON-NLS-1$
- }
- //only use daemon threads if the property is defined
- final String value = context.getProperty(IJobManager.PROP_USE_DAEMON_THREADS);
- //if value is absent, don't use daemon threads to maintain legacy behaviour
- if (value == null)
- return false;
- return "true".equalsIgnoreCase(value); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobQueue.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobQueue.java
deleted file mode 100644
index 097b4db..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobQueue.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import org.eclipse.core.runtime.*;
-
-/**
- * A linked list based priority queue. Either the elements in the queue must
- * implement Comparable, or a Comparator must be provided.
- */
-public class JobQueue {
- /**
- * The dummy entry sits between the head and the tail of the queue.
- * dummy.previous() is the head, and dummy.next() is the tail.
- */
- private final InternalJob dummy;
-
- /**
- * If true, conflicting jobs will be allowed to overtake others in the
- * queue that have lower priority. If false, higher priority jumps can only
- * move up the queue by overtaking jobs that they don't conflict with.
- */
- private boolean allowConflictOvertaking;
-
- /**
- * Create a new job queue.
- */
- public JobQueue(boolean allowConflictOvertaking) {
- //compareTo on dummy is never called
- dummy = new InternalJob("Queue-Head") {//$NON-NLS-1$
- public IStatus run(IProgressMonitor m) {
- return Status.OK_STATUS;
- }
- };
- dummy.setNext(dummy);
- dummy.setPrevious(dummy);
- this.allowConflictOvertaking = allowConflictOvertaking;
- }
-
- /**
- * remove all elements
- */
- public void clear() {
- dummy.setNext(dummy);
- dummy.setPrevious(dummy);
- }
-
- /**
- * Return and remove the element with highest priority, or null if empty.
- */
- public InternalJob dequeue() {
- InternalJob toRemove = dummy.previous();
- if (toRemove == dummy)
- return null;
- return toRemove.remove();
- }
-
- /**
- * Adds an item to the queue
- */
- public void enqueue(InternalJob newEntry) {
- //assert new entry is does not already belong to some other data structure
- Assert.isTrue(newEntry.next() == null);
- Assert.isTrue(newEntry.previous() == null);
- InternalJob tail = dummy.next();
- //overtake lower priority jobs. Only overtake conflicting jobs if allowed to
- while (canOvertake(newEntry, tail))
- tail = tail.next();
- //new entry is smaller than tail
- final InternalJob tailPrevious = tail.previous();
- newEntry.setNext(tail);
- newEntry.setPrevious(tailPrevious);
- tailPrevious.setNext(newEntry);
- tail.setPrevious(newEntry);
- }
-
- /**
- * Returns whether the new entry to overtake the existing queue entry.
- * @param newEntry The entry to be added to the queue
- * @param queueEntry The existing queue entry
- */
- private boolean canOvertake(InternalJob newEntry, InternalJob queueEntry) {
- //can never go past the end of the queue
- if (queueEntry == dummy)
- return false;
- //if the new entry was already in the wait queue, ensure it is re-inserted in correct position (bug 211799)
- if (newEntry.getWaitQueueStamp() > 0 && newEntry.getWaitQueueStamp() < queueEntry.getWaitQueueStamp())
- return true;
- //if the new entry has lower priority, there is no need to overtake the existing entry
- if (queueEntry.compareTo(newEntry) >= 0)
- return false;
- //the new entry has higher priority, but only overtake the existing entry if the queue allows it
- return allowConflictOvertaking || !newEntry.isConflicting(queueEntry);
- }
-
- /**
- * Removes the given element from the queue.
- */
- public void remove(InternalJob toRemove) {
- toRemove.remove();
- //previous of toRemove might now bubble up
- }
-
- /**
- * The given object has changed priority. Reshuffle the heap until it is
- * valid.
- */
- public void resort(InternalJob entry) {
- remove(entry);
- enqueue(entry);
- }
-
- /**
- * Returns true if the queue is empty, and false otherwise.
- */
- public boolean isEmpty() {
- return dummy.next() == dummy;
- }
-
- /**
- * Return greatest element without removing it, or null if empty
- */
- public InternalJob peek() {
- return dummy.previous() == dummy ? null : dummy.previous();
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobStatus.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobStatus.java
deleted file mode 100644
index 4e9b56b..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobStatus.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobStatus;
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- * Standard implementation of the IJobStatus interface.
- */
-public class JobStatus extends Status implements IJobStatus {
- private Job job;
-
- /**
- * Creates a new job status with no interesting error code or exception.
- * @param severity
- * @param job
- * @param message
- */
- public JobStatus(int severity, Job job, String message) {
- super(severity, JobManager.PI_JOBS, 1, message, null);
- this.job = job;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobStatus#getJob()
- */
- public Job getJob() {
- return job;
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/LockManager.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/LockManager.java
deleted file mode 100644
index 5e8fbb9..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/LockManager.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import java.util.HashMap;
-import java.util.Stack;
-import org.eclipse.core.internal.runtime.RuntimeLog;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.LockListener;
-
-/**
- * Stores the only reference to the graph that contains all the known
- * relationships between locks, rules, and the threads that own them.
- * Synchronizes all access to the graph on the only instance that exists in this class.
- *
- * Also stores the state of suspended locks so that they can be re-acquired with
- * the proper lock depth.
- */
-public class LockManager {
- /**
- * This class captures the state of suspended locks.
- * Locks are suspended if deadlock is detected.
- */
- private static class LockState {
- private int depth;
- private OrderedLock lock;
-
- /**
- * Suspends ownership of the given lock, and returns the saved state.
- */
- protected static LockState suspend(OrderedLock lock) {
- LockState state = new LockState();
- state.lock = lock;
- state.depth = lock.forceRelease();
- return state;
- }
-
- /**
- * Re-acquires a suspended lock and reverts to the correct lock depth.
- */
- public void resume() {
- //spin until the lock is successfully acquired
- //NOTE: spinning here allows the UI thread to service pending syncExecs
- //if the UI thread is waiting to acquire a lock.
- while (true) {
- try {
- if (lock.acquire(Long.MAX_VALUE))
- break;
- } catch (InterruptedException e) {
- //ignore and loop
- }
- }
- lock.setDepth(depth);
- }
- }
-
- //the lock listener for this lock manager
- protected LockListener lockListener;
- /*
- * The internal data structure that stores all the relationships
- * between the locks (or rules) and the threads that own them.
- */
- private DeadlockDetector locks = new DeadlockDetector();
- /*
- * Stores thread - stack pairs where every entry in the stack is an array
- * of locks that were suspended while the thread was acquiring more locks
- * (a stack is needed because when a thread tries to re-aquire suspended locks,
- * it can cause deadlock, and some locks it owns can be suspended again)
- */
- private HashMap suspendedLocks = new HashMap();
-
- public LockManager() {
- super();
- }
-
- /* (non-Javadoc)
- * Method declared on LockListener
- */
- public void aboutToRelease() {
- if (lockListener == null)
- return;
- try {
- lockListener.aboutToRelease();
- } catch (Exception e) {
- handleException(e);
- } catch (LinkageError e) {
- handleException(e);
- }
- }
-
- /* (non-Javadoc)
- * Method declared on LockListener
- */
- public boolean aboutToWait(Thread lockOwner) {
- if (lockListener == null)
- return false;
- try {
- return lockListener.aboutToWait(lockOwner);
- } catch (Exception e) {
- handleException(e);
- } catch (LinkageError e) {
- handleException(e);
- }
- return false;
- }
-
- /**
- * This thread has just acquired a lock. Update graph.
- */
- void addLockThread(Thread thread, ISchedulingRule lock) {
- if (locks == null)
- return;
- try {
- synchronized (locks) {
- locks.lockAcquired(thread, lock);
- }
- } catch (Exception e) {
- handleInternalError(e);
- }
- }
-
- /**
- * This thread has just been refused a lock. Update graph and check for deadlock.
- */
- void addLockWaitThread(Thread thread, ISchedulingRule lock) {
- if (locks == null)
- return;
- try {
- Deadlock found = null;
- synchronized (locks) {
- found = locks.lockWaitStart(thread, lock);
- }
- if (found == null)
- return;
- // if deadlock was detected, the found variable will contain all the information about it,
- // including which locks to suspend for which thread to resolve the deadlock.
- ISchedulingRule[] toSuspend = found.getLocks();
- LockState[] suspended = new LockState[toSuspend.length];
- for (int i = 0; i < toSuspend.length; i++)
- suspended[i] = LockState.suspend((OrderedLock) toSuspend[i]);
- synchronized (suspendedLocks) {
- Stack prevLocks = (Stack) suspendedLocks.get(found.getCandidate());
- if (prevLocks == null)
- prevLocks = new Stack();
- prevLocks.push(suspended);
- suspendedLocks.put(found.getCandidate(), prevLocks);
- }
- } catch (Exception e) {
- handleInternalError(e);
- }
- }
-
- /**
- * Handles exceptions that occur while calling third party code from within the
- * LockManager. This is essentially an in-lined version of Platform.run(ISafeRunnable)
- */
- private static void handleException(Throwable e) {
- IStatus status;
- if (e instanceof CoreException) {
- //logged message should not be translated
- status = new MultiStatus(JobManager.PI_JOBS, JobManager.PLUGIN_ERROR, "LockManager.handleException", e); //$NON-NLS-1$
- ((MultiStatus) status).merge(((CoreException) e).getStatus());
- } else {
- status = new Status(IStatus.ERROR, JobManager.PI_JOBS, JobManager.PLUGIN_ERROR, "LockManager.handleException", e); //$NON-NLS-1$
- }
- RuntimeLog.log(status);
- }
-
- /**
- * There was an internal error in the deadlock detection code. Shut the entire
- * thing down to prevent further errors. Recovery is too complex as it
- * requires freezing all threads and inferring the present lock state.
- */
- private void handleInternalError(Throwable t) {
- try {
- handleException(t);
- handleException(new Exception(locks.toDebugString()));
- } catch (Exception e2) {
- //ignore failure to log or to create the debug string
- }
- //discard the deadlock detector for good
- locks = null;
- }
-
- /**
- * Returns true IFF the underlying graph is empty.
- * For debugging purposes only.
- */
- public boolean isEmpty() {
- return locks.isEmpty();
- }
-
- /**
- * Returns true IFF this thread either owns, or is waiting for, any locks or rules.
- */
- public boolean isLockOwner() {
- //all job threads have to be treated as lock owners because UI thread
- //may try to join a job
- Thread current = Thread.currentThread();
- if (current instanceof Worker)
- return true;
- if (locks == null)
- return false;
- synchronized (locks) {
- return locks.contains(Thread.currentThread());
- }
- }
-
- /**
- * Creates and returns a new lock.
- */
- public synchronized OrderedLock newLock() {
- return new OrderedLock(this);
- }
-
- /**
- * Releases all the acquires that were called on the given rule. Needs to be called only once.
- */
- void removeLockCompletely(Thread thread, ISchedulingRule rule) {
- if (locks == null)
- return;
- try {
- synchronized (locks) {
- locks.lockReleasedCompletely(thread, rule);
- }
- } catch (Exception e) {
- handleInternalError(e);
- }
- }
-
- /**
- * This thread has just released a lock. Update graph.
- */
- void removeLockThread(Thread thread, ISchedulingRule lock) {
- try {
- synchronized (locks) {
- locks.lockReleased(thread, lock);
- }
- } catch (Exception e) {
- handleInternalError(e);
- }
- }
-
- /**
- * This thread has just stopped waiting for a lock. Update graph.
- */
- void removeLockWaitThread(Thread thread, ISchedulingRule lock) {
- try {
- synchronized (locks) {
- locks.lockWaitStop(thread, lock);
- }
- } catch (Exception e) {
- handleInternalError(e);
- }
- }
-
- /**
- * Resumes all the locks that were suspended while this thread was waiting to acquire another lock.
- */
- void resumeSuspendedLocks(Thread owner) {
- LockState[] toResume;
- synchronized (suspendedLocks) {
- Stack prevLocks = (Stack) suspendedLocks.get(owner);
- if (prevLocks == null)
- return;
- toResume = (LockState[]) prevLocks.pop();
- if (prevLocks.empty())
- suspendedLocks.remove(owner);
- }
- for (int i = 0; i < toResume.length; i++)
- toResume[i].resume();
- }
-
- public void setLockListener(LockListener listener) {
- this.lockListener = listener;
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/ObjectMap.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/ObjectMap.java
deleted file mode 100644
index 5e6c8ad..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/ObjectMap.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import java.util.*;
-
-/**
- * A specialized map implementation that is optimized for a small set of object
- * keys.
- *
- * Implemented as a single array that alternates keys and values.
- *
- * Note: This class is copied from org.eclipse.core.resources
- */
-public class ObjectMap implements Map {
- // 8 attribute keys, 8 attribute values
- protected static final int DEFAULT_SIZE = 16;
- protected static final int GROW_SIZE = 10;
- protected int count = 0;
- protected Object[] elements = null;
-
- /**
- * Creates a new object map.
- *
- * @param initialCapacity
- * The initial number of elements that will fit in the map.
- */
- public ObjectMap(int initialCapacity) {
- if (initialCapacity > 0)
- elements = new Object[Math.max(initialCapacity * 2, 0)];
- }
-
- /**
- * Creates a new object map of the same size as the given map and populate
- * it with the key/attribute pairs found in the map.
- *
- * @param map
- * The entries in the given map will be added to the new map.
- */
- public ObjectMap(Map map) {
- this(map.size());
- putAll(map);
- }
-
- /**
- * @see Map#clear()
- */
- public void clear() {
- elements = null;
- count = 0;
- }
-
- /**
- * @see java.lang.Object#clone()
- */
- public Object clone() {
- return new ObjectMap(this);
- }
-
- /**
- * @see Map#containsKey(java.lang.Object)
- */
- public boolean containsKey(Object key) {
- if (elements == null || count == 0)
- return false;
- for (int i = 0; i < elements.length; i = i + 2)
- if (elements[i] != null && elements[i].equals(key))
- return true;
- return false;
- }
-
- /**
- * @see Map#containsValue(java.lang.Object)
- */
- public boolean containsValue(Object value) {
- if (elements == null || count == 0)
- return false;
- for (int i = 1; i < elements.length; i = i + 2)
- if (elements[i] != null && elements[i].equals(value))
- return true;
- return false;
- }
-
- /**
- * @see Map#entrySet()
- *
- * Note: This implementation does not conform properly to the
- * specification in the Map interface. The returned collection will not
- * be bound to this map and will not remain in sync with this map.
- */
- public Set entrySet() {
- return count == 0 ? Collections.EMPTY_SET : toHashMap().entrySet();
- }
-
- /**
- * @see Object#equals(java.lang.Object)
- */
- public boolean equals(Object o) {
- if (!(o instanceof Map))
- return false;
- Map other = (Map) o;
- //must be same size
- if (count != other.size())
- return false;
- //keysets must be equal
- if (!keySet().equals(other.keySet()))
- return false;
- //values for each key must be equal
- for (int i = 0; i < elements.length; i = i + 2) {
- if (elements[i] != null && (!elements[i + 1].equals(other.get(elements[i]))))
- return false;
- }
- return true;
- }
-
- /**
- * @see Map#get(java.lang.Object)
- */
- public Object get(Object key) {
- if (elements == null || count == 0)
- return null;
- for (int i = 0; i < elements.length; i = i + 2)
- if (elements[i] != null && elements[i].equals(key))
- return elements[i + 1];
- return null;
- }
-
- /**
- * The capacity of the map has been exceeded, grow the array by GROW_SIZE to
- * accomodate more entries.
- */
- protected void grow() {
- Object[] expanded = new Object[elements.length + GROW_SIZE];
- System.arraycopy(elements, 0, expanded, 0, elements.length);
- elements = expanded;
- }
-
- /**
- * @see Object#hashCode()
- */
- public int hashCode() {
- int hash = 0;
- for (int i = 0; i < elements.length; i = i + 2) {
- if (elements[i] != null) {
- hash += elements[i].hashCode();
- }
- }
- return hash;
- }
-
- /**
- * @see Map#isEmpty()
- */
- public boolean isEmpty() {
- return count == 0;
- }
-
- /**
- * Returns all keys in this table as an array.
- */
- public String[] keys() {
- String[] result = new String[count];
- int next = 0;
- for (int i = 0; i < elements.length; i = i + 2)
- if (elements[i] != null)
- result[next++] = (String) elements[i];
- return result;
- }
-
- /**
- * @see Map#keySet()
- *
- * Note: This implementation does not conform properly to the
- * specification in the Map interface. The returned collection will not
- * be bound to this map and will not remain in sync with this map.
- */
- public Set keySet() {
- Set result = new HashSet(size());
- for (int i = 0; i < elements.length; i = i + 2) {
- if (elements[i] != null) {
- result.add(elements[i]);
- }
- }
- return result;
- }
-
- /**
- * @see Map#put(java.lang.Object, java.lang.Object)
- */
- public Object put(Object key, Object value) {
- if (key == null)
- throw new NullPointerException();
- if (value == null)
- return remove(key);
-
- // handle the case where we don't have any attributes yet
- if (elements == null)
- elements = new Object[DEFAULT_SIZE];
- if (count == 0) {
- elements[0] = key;
- elements[1] = value;
- count++;
- return null;
- }
-
- int emptyIndex = -1;
- // replace existing value if it exists
- for (int i = 0; i < elements.length; i += 2) {
- if (elements[i] != null) {
- if (elements[i].equals(key)) {
- Object oldValue = elements[i + 1];
- elements[i + 1] = value;
- return oldValue;
- }
- } else if (emptyIndex == -1) {
- // keep track of the first empty index
- emptyIndex = i;
- }
- }
- // this will put the emptyIndex greater than the size but
- // that's ok because we will grow first.
- if (emptyIndex == -1)
- emptyIndex = count * 2;
-
- // otherwise add it to the list of elements.
- // grow if necessary
- if (elements.length <= (count * 2))
- grow();
- elements[emptyIndex] = key;
- elements[emptyIndex + 1] = value;
- count++;
- return null;
- }
-
- /**
- * @see Map#putAll(java.util.Map)
- */
- public void putAll(Map map) {
- for (Iterator i = map.keySet().iterator(); i.hasNext();) {
- Object key = i.next();
- Object value = map.get(key);
- put(key, value);
- }
- }
-
- /**
- * @see Map#remove(java.lang.Object)
- */
- public Object remove(Object key) {
- if (elements == null || count == 0)
- return null;
- for (int i = 0; i < elements.length; i = i + 2) {
- if (elements[i] != null && elements[i].equals(key)) {
- elements[i] = null;
- Object result = elements[i + 1];
- elements[i + 1] = null;
- count--;
- return result;
- }
- }
- return null;
- }
-
- /* (non-Javadoc
- * Method declared on IStringPoolParticipant
- */
- public void shareStrings(StringPool set) {
- //copy elements for thread safety
- Object[] array = elements;
- if (array == null)
- return;
- for (int i = 0; i < array.length; i++) {
- Object o = array[i];
- if (o instanceof String)
- array[i] = set.add((String) o);
- }
- }
-
- /**
- * @see Map#size()
- */
- public int size() {
- return count;
- }
-
- /**
- * Creates a new hash map with the same contents as this map.
- */
- private HashMap toHashMap() {
- HashMap result = new HashMap(size());
- for (int i = 0; i < elements.length; i = i + 2) {
- if (elements[i] != null) {
- result.put(elements[i], elements[i + 1]);
- }
- }
- return result;
- }
-
- /**
- * @see Map#values()
- *
- * Note: This implementation does not conform properly to the
- * specification in the Map interface. The returned collection will not
- * be bound to this map and will not remain in sync with this map.
- */
- public Collection values() {
- Set result = new HashSet(size());
- for (int i = 1; i < elements.length; i = i + 2) {
- if (elements[i] != null) {
- result.add(elements[i]);
- }
- }
- return result;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/OrderedLock.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/OrderedLock.java
deleted file mode 100644
index 4926ed5..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/OrderedLock.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.jobs.ILock;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-
-/**
- * A lock used to control write access to an exclusive resource.
- *
- * The lock avoids circular waiting deadlocks by detecting the deadlocks
- * and resolving them through the suspension of all locks owned by one
- * of the threads involved in the deadlock. This makes it impossible for n such
- * locks to deadlock while waiting for each other. The downside is that this means
- * that during an interval when a process owns a lock, it can be forced
- * to give the lock up and wait until all locks it requires become
- * available. This removes the feature of exclusive access to the
- * resource in contention for the duration between acquire() and
- * release() calls.
- *
- * The lock implementation prevents starvation by granting the
- * lock in the same order in which acquire() requests arrive. In
- * this scheme, starvation is only possible if a thread retains
- * a lock indefinitely.
- */
-public class OrderedLock implements ILock, ISchedulingRule {
-
- private static final boolean DEBUG = false;
- /**
- * Locks are sequentially ordered for debugging purposes.
- */
- private static int nextLockNumber = 0;
- /**
- * The thread of the operation that currently owns the lock.
- */
- private volatile Thread currentOperationThread;
- /**
- * Records the number of successive acquires in the same
- * thread. The lock is released only when the depth
- * reaches zero.
- */
- private int depth;
- /**
- * The manager that implements the deadlock detection and resolution protocol.
- */
- private final LockManager manager;
- private final int number;
-
- /**
- * Queue of semaphores for threads currently waiting
- * on the lock. This queue is not thread-safe, so access
- * to this queue must be synchronized on the lock instance.
- */
- private final Queue operations = new Queue();
-
- /**
- * Creates a new workspace lock.
- */
- OrderedLock(LockManager manager) {
- this.manager = manager;
- this.number = nextLockNumber++;
- }
-
- /* (non-Javadoc)
- * @see Locks.ILock#acquire()
- */
- public void acquire() {
- //spin until the lock is successfully acquired
- //NOTE: spinning here allows the UI thread to service pending syncExecs
- //if the UI thread is waiting to acquire a lock.
- while (true) {
- try {
- if (acquire(Long.MAX_VALUE))
- return;
- } catch (InterruptedException e) {
- //ignore and loop
- }
- }
- }
-
- /* (non-Javadoc)
- * @see Locks.ILock#acquire(long)
- */
- public boolean acquire(long delay) throws InterruptedException {
- if (Thread.interrupted())
- throw new InterruptedException();
-
- boolean success = false;
- if (delay <= 0)
- return attempt();
- Semaphore semaphore = createSemaphore();
- if (semaphore == null)
- return true;
- if (DEBUG)
- System.out.println("[" + Thread.currentThread() + "] Operation waiting to be executed... " + this); //$NON-NLS-1$ //$NON-NLS-2$
- success = doAcquire(semaphore, delay);
- manager.resumeSuspendedLocks(Thread.currentThread());
- if (DEBUG && success)
- System.out.println("[" + Thread.currentThread() + "] Operation started... " + this); //$NON-NLS-1$ //$NON-NLS-2$
- else if (DEBUG)
- System.out.println("[" + Thread.currentThread() + "] Operation timed out... " + this); //$NON-NLS-1$ //$NON-NLS-2$
- return success;
- }
-
- /**
- * Attempts to acquire the lock. Returns false if the lock is not available and
- * true if the lock has been successfully acquired.
- */
- private synchronized boolean attempt() {
- //return true if we already own the lock
- //also, if nobody is waiting, grant the lock immediately
- if ((currentOperationThread == Thread.currentThread()) || (currentOperationThread == null && operations.isEmpty())) {
- depth++;
- setCurrentOperationThread(Thread.currentThread());
- return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.ISchedulingRule#contains(org.eclipse.core.runtime.jobs.ISchedulingRule)
- */
- public boolean contains(ISchedulingRule rule) {
- return false;
- }
-
- /**
- * Returns null if acquired and a Semaphore object otherwise. If a
- * waiting semaphore already exists for this thread, it will be returned,
- * otherwise a new semaphore will be created, enqueued, and returned.
- */
- private synchronized Semaphore createSemaphore() {
- return attempt() ? null : enqueue(new Semaphore(Thread.currentThread()));
- }
-
- /**
- * Attempts to acquire this lock. Callers will block until this lock comes available to
- * them, or until the specified delay has elapsed.
- */
- private boolean doAcquire(Semaphore semaphore, long delay) throws InterruptedException {
- boolean success = false;
- //notify hook to service pending syncExecs before falling asleep
- if (manager.aboutToWait(this.currentOperationThread)) {
- //hook granted immediate access
- //remove semaphore for the lock request from the queue
- //do not log in graph because this thread did not really get the lock
- removeFromQueue(semaphore);
- depth++;
- manager.addLockThread(currentOperationThread, this);
- return true;
- }
- //Make sure the semaphore is in the queue before we start waiting
- //It might have been removed from the queue while servicing syncExecs
- //This is will return our existing semaphore if it is still in the queue
- semaphore = createSemaphore();
- if (semaphore == null)
- return true;
- manager.addLockWaitThread(Thread.currentThread(), this);
- try {
- success = semaphore.acquire(delay);
- } catch (InterruptedException e) {
- if (DEBUG)
- System.out.println("[" + Thread.currentThread() + "] Operation interrupted while waiting... :-|"); //$NON-NLS-1$ //$NON-NLS-2$
- throw e;
- }
- if (success) {
- depth++;
- updateCurrentOperation();
- } else {
- removeFromQueue(semaphore);
- manager.removeLockWaitThread(Thread.currentThread(), this);
- }
- return success;
- }
-
- /**
- * Releases this lock from the thread that used to own it.
- * Grants this lock to the next thread in the queue.
- */
- private synchronized void doRelease() {
- //notify hook
- manager.aboutToRelease();
- depth = 0;
- Semaphore next = (Semaphore) operations.peek();
- setCurrentOperationThread(null);
- if (next != null)
- next.release();
- }
-
- /**
- * If there is another semaphore with the same runnable in the
- * queue, the other is returned and the new one is not added.
- */
- private synchronized Semaphore enqueue(Semaphore newSemaphore) {
- Semaphore semaphore = (Semaphore) operations.get(newSemaphore);
- if (semaphore == null) {
- operations.enqueue(newSemaphore);
- return newSemaphore;
- }
- return semaphore;
- }
-
- /**
- * Suspend this lock by granting the lock to the next lock in the queue.
- * Return the depth of the suspended lock.
- */
- protected int forceRelease() {
- int oldDepth = depth;
- doRelease();
- return oldDepth;
- }
-
- /* (non-Javadoc)
- * @see Locks.ILock#getDepth()
- */
- public int getDepth() {
- return depth;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.ISchedulingRule#isConflicting(org.eclipse.core.runtime.jobs.ISchedulingRule)
- */
- public boolean isConflicting(ISchedulingRule rule) {
- return rule == this;
- }
-
- /* (non-Javadoc)
- * @see Locks.ILock#release()
- */
- public void release() {
- if (depth == 0)
- return;
- //only release the lock when the depth reaches zero
- Assert.isTrue(depth >= 0, "Lock released too many times"); //$NON-NLS-1$
- if (--depth == 0)
- doRelease();
- else
- manager.removeLockThread(currentOperationThread, this);
- }
-
- /**
- * Removes a semaphore from the queue of waiting operations.
- *
- * @param semaphore The semaphore to remove
- */
- private synchronized void removeFromQueue(Semaphore semaphore) {
- operations.remove(semaphore);
- }
-
- /**
- * If newThread is null, release this lock from its previous owner.
- * If newThread is not null, grant this lock to newThread.
- */
- private void setCurrentOperationThread(Thread newThread) {
- if ((currentOperationThread != null) && (newThread == null))
- manager.removeLockThread(currentOperationThread, this);
- this.currentOperationThread = newThread;
- if (currentOperationThread != null)
- manager.addLockThread(currentOperationThread, this);
- }
-
- /**
- * Forces the lock to be at the given depth.
- * Used when re-acquiring a suspended lock.
- */
- protected void setDepth(int newDepth) {
- for (int i = depth; i < newDepth; i++) {
- manager.addLockThread(currentOperationThread, this);
- }
- this.depth = newDepth;
- }
-
- /**
- * For debugging purposes only.
- */
- public String toString() {
- return "OrderedLock (" + number + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * This lock has just been granted to a new thread (the thread waited for it).
- * Remove the request from the queue and update both the graph and the lock.
- */
- private synchronized void updateCurrentOperation() {
- operations.dequeue();
- setCurrentOperationThread(Thread.currentThread());
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Queue.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Queue.java
deleted file mode 100644
index 0a58973..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Queue.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import java.util.*;
-
-/**
- * A Queue of objects.
- */
-public class Queue {
- protected Object[] elements;
- protected int head;
- protected boolean reuse;
- protected int tail;
-
- public Queue() {
- this(20, false);
- }
-
- /**
- * The parameter reuse indicates what do you want to happen with
- * the object reference when you remove it from the queue. If
- * reuse is false the queue no longer holds a reference to the
- * object when it is removed. If reuse is true you can use the
- * method getNextAvailableObject to get an used object, set its
- * new values and add it again to the queue.
- */
- public Queue(int size, boolean reuse) {
- elements = new Object[size];
- head = tail = 0;
- this.reuse = reuse;
- }
-
- /**
- * Adds an object to the tail of the queue.
- */
- public void enqueue(Object element) {
- int newTail = increment(tail);
- if (newTail == head) {
- grow();
- newTail = tail + 1;
- }
- elements[tail] = element;
- tail = newTail;
- }
-
- /**
- * This method does not affect the queue itself. It is only a
- * helper to decrement an index in the queue.
- */
- public int decrement(int index) {
- return (index == 0) ? (elements.length - 1) : index - 1;
- }
-
- public Iterator elements() {
- /**/
- if (isEmpty())
- return new ArrayList(0).iterator();
-
- /* if head < tail we can use the same array */
- if (head <= tail)
- return Arrays.asList(elements).iterator();
-
- /* otherwise we need to create a new array */
- Object[] newElements = new Object[size()];
- int end = (elements.length - head);
- System.arraycopy(elements, head, newElements, 0, end);
- System.arraycopy(elements, 0, newElements, end, tail);
- return Arrays.asList(newElements).iterator();
- }
-
- public Object get(Object o) {
- int index = head;
- while (index != tail) {
- if (elements[index].equals(o))
- return elements[index];
- index = increment(index);
- }
- return null;
- }
-
- /**
- * Removes the given object from the queue. Shifts the underlying array.
- */
- public boolean remove(Object o) {
- int index = head;
- //find the object to remove
- while (index != tail) {
- if (elements[index].equals(o))
- break;
- index = increment(index);
- }
- //if element wasn't found, return
- if (index == tail)
- return false;
- //store a reference to it (needed for reuse of objects)
- Object toRemove = elements[index];
- int nextIndex = -1;
- while (index != tail) {
- nextIndex = increment(index);
- if (nextIndex != tail)
- elements[index] = elements[nextIndex];
-
- index = nextIndex;
- }
- //decrement tail
- tail = decrement(tail);
-
- //if objects are reused, transfer the reference that is removed to the end of the queue
- //otherwise set the element after the last one to null (to avoid duplicate references)
- elements[tail] = reuse ? toRemove : null;
- return true;
- }
-
- protected void grow() {
- int newSize = (int) (elements.length * 1.5);
- Object[] newElements = new Object[newSize];
- if (tail >= head)
- System.arraycopy(elements, head, newElements, head, size());
- else {
- int newHead = newSize - (elements.length - head);
- System.arraycopy(elements, 0, newElements, 0, tail + 1);
- System.arraycopy(elements, head, newElements, newHead, (newSize - newHead));
- head = newHead;
- }
- elements = newElements;
- }
-
- /**
- * This method does not affect the queue itself. It is only a
- * helper to increment an index in the queue.
- */
- public int increment(int index) {
- return (index == (elements.length - 1)) ? 0 : index + 1;
- }
-
- public boolean isEmpty() {
- return tail == head;
- }
-
- public Object peek() {
- return elements[head];
- }
-
- /**
- * Removes an returns the item at the head of the queue.
- */
- public Object dequeue() {
- if (isEmpty())
- return null;
- Object result = peek();
- if (!reuse)
- elements[head] = null;
- head = increment(head);
- return result;
- }
-
- public int size() {
- return tail > head ? (tail - head) : ((elements.length - head) + tail);
- }
-
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("["); //$NON-NLS-1$
- if (!isEmpty()) {
- Iterator it = elements();
- while (true) {
- sb.append(it.next());
- if (it.hasNext())
- sb.append(", "); //$NON-NLS-1$
- else
- break;
- }
- }
- sb.append("]"); //$NON-NLS-1$
- return sb.toString();
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Semaphore.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Semaphore.java
deleted file mode 100644
index 80d5fe3..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Semaphore.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-public class Semaphore {
- protected long notifications;
- protected Runnable runnable;
-
- public Semaphore(Runnable runnable) {
- this.runnable = runnable;
- notifications = 0;
- }
-
- /**
- * Attempts to acquire this semaphore. Returns true if it was successfully acquired,
- * and false otherwise.
- */
- public synchronized boolean acquire(long delay) throws InterruptedException {
- if (Thread.interrupted())
- throw new InterruptedException();
- long start = System.currentTimeMillis();
- long timeLeft = delay;
- while (true) {
- if (notifications > 0) {
- notifications--;
- return true;
- }
- if (timeLeft <= 0)
- return false;
- wait(timeLeft);
- timeLeft = start + delay - System.currentTimeMillis();
- }
- }
-
- public boolean equals(Object obj) {
- return (runnable == ((Semaphore) obj).runnable);
- }
-
- public int hashCode() {
- return runnable == null ? 0 : runnable.hashCode();
- }
-
- public synchronized void release() {
- notifications++;
- notifyAll();
- }
-
- // for debug only
- public String toString() {
- return "Semaphore(" + runnable + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/StringPool.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/StringPool.java
deleted file mode 100644
index 53a302a..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/StringPool.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import java.util.HashMap;
-
-/**
- * A string pool is used for sharing strings in a way that eliminates duplicate
- * equal strings. A string pool instance can be maintained over a long period
- * of time, or used as a temporary structure during a string sharing pass over
- * a data structure.
- * <p>
- * This class is not intended to be subclassed by clients.
- * </p>
- *
- * Note: This class is copied from org.eclipse.core.resources
- *
- * @since 3.1
- */
-public final class StringPool {
- private int savings;
- private final HashMap map = new HashMap();
-
- /**
- * Adds a <code>String</code> to the pool. Returns a <code>String</code>
- * that is equal to the argument but that is unique within this pool.
- * @param string The string to add to the pool
- * @return A string that is equal to the argument.
- */
- public String add(String string) {
- if (string == null)
- return string;
- Object result = map.get(string);
- if (result != null) {
- if (result != string)
- savings += 44 + 2 * string.length();
- return (String) result;
- }
- map.put(string, string);
- return string;
- }
-
- /**
- * Returns an estimate of the size in bytes that was saved by sharing strings in
- * the pool. In particular, this returns the size of all strings that were added to the
- * pool after an equal string had already been added. This value can be used
- * to estimate the effectiveness of a string sharing operation, in order to
- * determine if or when it should be performed again.
- *
- * In some cases this does not precisely represent the number of bytes that
- * were saved. For example, say the pool already contains string S1. Now
- * string S2, which is equal to S1 but not identical, is added to the pool five
- * times. This method will return the size of string S2 multiplied by the
- * number of times it was added, even though the actual savings in this case
- * is only the size of a single copy of S2.
- */
- public int getSavedStringCount() {
- return savings;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/ThreadJob.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/ThreadJob.java
deleted file mode 100644
index bd798d9..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/ThreadJob.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import org.eclipse.core.internal.runtime.RuntimeLog;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- * Captures the implicit job state for a given thread.
- */
-class ThreadJob extends Job {
- /**
- * The notifier is a shared object used to wake up waiting thread jobs
- * when another job completes that is releasing a scheduling rule.
- */
- static final Object notifier = new Object();
-
- private final JobManager manager;
- /**
- * Set to true if this thread job is running in a thread that did
- * not own a rule already. This means it needs to acquire the
- * rule during beginRule, and must release the rule during endRule.
- */
- protected boolean acquireRule = false;
-
- /**
- * Indicates that this thread job did report to the progress manager
- * that it will be blocked, and therefore when it begins it must
- * be reported to the job manager when it is no longer blocked.
- */
- boolean isBlocked = false;
-
- /**
- * True if this ThreadJob has begun execution
- */
- protected boolean isRunning = false;
-
- /**
- * Used for diagnosing mismatched begin/end pairs. This field
- * is only used when in debug mode, to capture the stack trace
- * of the last call to beginRule.
- */
- private RuntimeException lastPush = null;
- /**
- * The actual job that is running in the thread that this
- * ThreadJob represents. This will be null if this thread
- * job is capturing a rule acquired outside of a job.
- */
- protected Job realJob;
- /**
- * The stack of rules that have been begun in this thread, but not yet ended.
- */
- private ISchedulingRule[] ruleStack;
- /**
- * Rule stack pointer.
- */
- private int top;
-
- ThreadJob(JobManager manager, ISchedulingRule rule) {
- super("Implicit Job"); //$NON-NLS-1$
- this.manager = manager;
- setSystem(true);
- setPriority(Job.INTERACTIVE);
- ruleStack = new ISchedulingRule[2];
- top = -1;
- setRule(rule);
- }
-
- /**
- * An endRule was called that did not match the last beginRule in
- * the stack. Report and log a detailed informational message.
- * @param rule The rule that was popped
- */
- private void illegalPop(ISchedulingRule rule) {
- StringBuffer buf = new StringBuffer("Attempted to endRule: "); //$NON-NLS-1$
- buf.append(rule);
- if (top >= 0 && top < ruleStack.length) {
- buf.append(", does not match most recent begin: "); //$NON-NLS-1$
- buf.append(ruleStack[top]);
- } else {
- if (top < 0)
- buf.append(", but there was no matching beginRule"); //$NON-NLS-1$
- else
- buf.append(", but the rule stack was out of bounds: " + top); //$NON-NLS-1$
- }
- buf.append(". See log for trace information if rule tracing is enabled."); //$NON-NLS-1$
- String msg = buf.toString();
- if (JobManager.DEBUG || JobManager.DEBUG_BEGIN_END) {
- System.out.println(msg);
- Throwable t = lastPush == null ? new IllegalArgumentException() : lastPush;
- IStatus error = new Status(IStatus.ERROR, JobManager.PI_JOBS, 1, msg, t);
- RuntimeLog.log(error);
- }
- Assert.isLegal(false, msg);
- }
-
- /**
- * Client has attempted to begin a rule that is not contained within
- * the outer rule.
- */
- private void illegalPush(ISchedulingRule pushRule, ISchedulingRule baseRule) {
- StringBuffer buf = new StringBuffer("Attempted to beginRule: "); //$NON-NLS-1$
- buf.append(pushRule);
- buf.append(", does not match outer scope rule: "); //$NON-NLS-1$
- buf.append(baseRule);
- String msg = buf.toString();
- if (JobManager.DEBUG) {
- System.out.println(msg);
- IStatus error = new Status(IStatus.ERROR, JobManager.PI_JOBS, 1, msg, new IllegalArgumentException());
- RuntimeLog.log(error);
- }
- Assert.isLegal(false, msg);
-
- }
-
- /**
- * Returns true if the monitor is canceled, and false otherwise.
- * Protects the caller from exception in the monitor implementation.
- */
- private boolean isCanceled(IProgressMonitor monitor) {
- try {
- return monitor.isCanceled();
- } catch (RuntimeException e) {
- //logged message should not be translated
- IStatus status = new Status(IStatus.ERROR, JobManager.PI_JOBS, JobManager.PLUGIN_ERROR, "ThreadJob.isCanceled", e); //$NON-NLS-1$
- RuntimeLog.log(status);
- }
- return false;
- }
-
- /**
- * Returns true if this thread job was scheduled and actually started running.
- */
- synchronized boolean isRunning() {
- return isRunning;
- }
-
- /**
- * Schedule the job and block the calling thread until the job starts running.
- * Returns the ThreadJob instance that was started.
- */
- ThreadJob joinRun(IProgressMonitor monitor) {
- if (isCanceled(monitor))
- throw new OperationCanceledException();
- //check if there is a blocking thread before waiting
- InternalJob blockingJob = manager.findBlockingJob(this);
- Thread blocker = blockingJob == null ? null : blockingJob.getThread();
- ThreadJob result = this;
- try {
- //just return if lock listener decided to grant immediate access
- if (manager.getLockManager().aboutToWait(blocker))
- return this;
- try {
- waitStart(monitor, blockingJob);
- final Thread currentThread = Thread.currentThread();
- while (true) {
- if (isCanceled(monitor))
- throw new OperationCanceledException();
- //try to run the job
- if (manager.runNow(this))
- return this;
- //update blocking job
- blockingJob = manager.findBlockingJob(this);
- //the rule could have been transferred to this thread while we were waiting
- blocker = blockingJob == null ? null : blockingJob.getThread();
- if (blocker == currentThread && blockingJob instanceof ThreadJob) {
- //now we are just the nested acquire case
- result = (ThreadJob) blockingJob;
- result.push(getRule());
- result.isBlocked = this.isBlocked;
- return result;
- }
- //just return if lock listener decided to grant immediate access
- if (manager.getLockManager().aboutToWait(blocker))
- return this;
- //must lock instance before calling wait
- synchronized (notifier) {
- try {
- notifier.wait(250);
- } catch (InterruptedException e) {
- //ignore
- }
- }
- }
- } finally {
- if (this == result)
- waitEnd(monitor);
- }
- } finally {
- manager.getLockManager().aboutToRelease();
- }
- }
-
- /**
- * Pops a rule. Returns true if it was the last rule for this thread
- * job, and false otherwise.
- */
- boolean pop(ISchedulingRule rule) {
- if (top < 0 || ruleStack[top] != rule)
- illegalPop(rule);
- ruleStack[top--] = null;
- return top < 0;
- }
-
- /**
- * Adds a new scheduling rule to the stack of rules for this thread. Throws
- * a runtime exception if the new rule is not compatible with the base
- * scheduling rule for this thread.
- */
- void push(final ISchedulingRule rule) {
- final ISchedulingRule baseRule = getRule();
- if (++top >= ruleStack.length) {
- ISchedulingRule[] newStack = new ISchedulingRule[ruleStack.length * 2];
- System.arraycopy(ruleStack, 0, newStack, 0, ruleStack.length);
- ruleStack = newStack;
- }
- ruleStack[top] = rule;
- if (JobManager.DEBUG_BEGIN_END)
- lastPush = (RuntimeException) new RuntimeException().fillInStackTrace();
- //check for containment last because we don't want to fail again on endRule
- if (baseRule != null && rule != null && !baseRule.contains(rule))
- illegalPush(rule, baseRule);
- }
-
- /**
- * Reset all of this job's fields so it can be reused. Returns false if
- * reuse is not possible
- */
- boolean recycle() {
- //don't recycle if still running for any reason
- if (getState() != Job.NONE)
- return false;
- //clear and reset all fields
- acquireRule = isRunning = isBlocked = false;
- realJob = null;
- setRule(null);
- setThread(null);
- if (ruleStack.length != 2)
- ruleStack = new ISchedulingRule[2];
- else
- ruleStack[0] = ruleStack[1] = null;
- top = -1;
- return true;
- }
-
- /** (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public IStatus run(IProgressMonitor monitor) {
- synchronized (this) {
- isRunning = true;
- }
- return ASYNC_FINISH;
- }
-
- /**
- * Records the job that is actually running in this thread, if any
- * @param realJob The running job
- */
- void setRealJob(Job realJob) {
- this.realJob = realJob;
- }
-
- /**
- * Returns true if this job should cause a self-canceling job
- * to cancel itself, and false otherwise.
- */
- boolean shouldInterrupt() {
- return realJob == null ? true : !realJob.isSystem();
- }
-
- /* (non-javadoc)
- * For debugging purposes only
- */
- public String toString() {
- StringBuffer buf = new StringBuffer("ThreadJob"); //$NON-NLS-1$
- buf.append('(').append(realJob).append(',').append('[');
- for (int i = 0; i <= top && i < ruleStack.length; i++)
- buf.append(ruleStack[i]).append(',');
- buf.append(']').append(')');
- return buf.toString();
- }
-
- /**
- * Reports that this thread was blocked, but is no longer blocked and is able
- * to proceed.
- * @param monitor The monitor to report unblocking to.
- */
- private void waitEnd(IProgressMonitor monitor) {
- final LockManager lockManager = manager.getLockManager();
- final Thread currentThread = Thread.currentThread();
- if (isRunning()) {
- lockManager.addLockThread(currentThread, getRule());
- //need to re-acquire any locks that were suspended while this thread was blocked on the rule
- lockManager.resumeSuspendedLocks(currentThread);
- } else {
- //tell lock manager that this thread gave up waiting
- lockManager.removeLockWaitThread(currentThread, getRule());
- }
- }
-
- /**
- * Indicates the start of a wait on a scheduling rule. Report the
- * blockage to the progress manager and update the lock manager.
- * @param monitor The monitor to report blocking to
- * @param blockingJob The job that is blocking this thread, or <code>null</code>
- */
- private void waitStart(IProgressMonitor monitor, InternalJob blockingJob) {
- manager.getLockManager().addLockWaitThread(Thread.currentThread(), getRule());
- isBlocked = true;
- manager.reportBlocked(monitor, blockingJob);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Worker.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Worker.java
deleted file mode 100644
index 7c56457..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/Worker.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import org.eclipse.core.internal.runtime.RuntimeLog;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * A worker thread processes jobs supplied to it by the worker pool. When
- * the worker pool gives it a null job, the worker dies.
- */
-public class Worker extends Thread {
- //worker number used for debugging purposes only
- private static int nextWorkerNumber = 0;
- private volatile InternalJob currentJob;
- private final WorkerPool pool;
-
- public Worker(WorkerPool pool) {
- super("Worker-" + nextWorkerNumber++); //$NON-NLS-1$
- this.pool = pool;
- //set the context loader to avoid leaking the current context loader
- //for the thread that spawns this worker (bug 98376)
- setContextClassLoader(pool.defaultContextLoader);
- }
-
- /**
- * Returns the currently running job, or null if none.
- */
- public Job currentJob() {
- return (Job) currentJob;
- }
-
- private IStatus handleException(InternalJob job, Throwable t) {
- String message = NLS.bind(JobMessages.jobs_internalError, job.getName());
- return new Status(IStatus.ERROR, JobManager.PI_JOBS, JobManager.PLUGIN_ERROR, message, t);
- }
-
- public void run() {
- setPriority(Thread.NORM_PRIORITY);
- try {
- while ((currentJob = pool.startJob(this)) != null) {
- currentJob.setThread(this);
- IStatus result = Status.OK_STATUS;
- try {
- result = currentJob.run(currentJob.getProgressMonitor());
- } catch (OperationCanceledException e) {
- result = Status.CANCEL_STATUS;
- } catch (Exception e) {
- result = handleException(currentJob, e);
- } catch (ThreadDeath e) {
- //must not consume thread death
- result = handleException(currentJob, e);
- throw e;
- } catch (Error e) {
- result = handleException(currentJob, e);
- } finally {
- //clear interrupted state for this thread
- Thread.interrupted();
- //result must not be null
- if (result == null)
- result = handleException(currentJob, new NullPointerException());
- pool.endJob(currentJob, result);
- if ((result.getSeverity() & (IStatus.ERROR | IStatus.WARNING)) != 0)
- RuntimeLog.log(result);
- currentJob = null;
- }
- }
- } catch (Throwable t) {
- t.printStackTrace();
- } finally {
- currentJob = null;
- pool.endWorker(this);
- }
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/WorkerPool.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/WorkerPool.java
deleted file mode 100644
index 3751239..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/WorkerPool.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- * Maintains a pool of worker threads. Threads are constructed lazily as
- * required, and are eventually discarded if not in use for awhile. This class
- * maintains the thread creation/destruction policies for the job manager.
- *
- * Implementation note: all the data structures of this class are protected
- * by the instance's object monitor. To avoid deadlock with third party code,
- * this lock is never held when calling methods outside this class that may in
- * turn use locks.
- */
-class WorkerPool {
- /**
- * Threads not used by their best before timestamp are destroyed.
- */
- private static final int BEST_BEFORE = 60000;
- /**
- * There will always be at least MIN_THREADS workers in the pool.
- */
- private static final int MIN_THREADS = 1;
- /**
- * Use the busy thread count to avoid starting new threads when a living
- * thread is just doing house cleaning (notifying listeners, etc).
- */
- private int busyThreads = 0;
-
- /**
- * The default context class loader to use when creating worker threads.
- */
- protected final ClassLoader defaultContextLoader;
-
- /**
- * Records whether new worker threads should be daemon threads.
- */
- private boolean isDaemon = false;
-
- private JobManager manager;
- /**
- * The number of workers in the threads array
- */
- private int numThreads = 0;
- /**
- * The number of threads that are currently sleeping
- */
- private int sleepingThreads = 0;
- /**
- * The living set of workers in this pool.
- */
- private Worker[] threads = new Worker[10];
-
- protected WorkerPool(JobManager manager) {
- this.manager = manager;
- this.defaultContextLoader = Thread.currentThread().getContextClassLoader();
- }
-
- /**
- * Adds a worker to the list of workers.
- */
- private synchronized void add(Worker worker) {
- int size = threads.length;
- if (numThreads + 1 > size) {
- Worker[] newThreads = new Worker[2 * size];
- System.arraycopy(threads, 0, newThreads, 0, size);
- threads = newThreads;
- }
- threads[numThreads++] = worker;
- }
-
- private synchronized void decrementBusyThreads() {
- //impossible to have less than zero busy threads
- if (--busyThreads < 0) {
- if (JobManager.DEBUG)
- Assert.isTrue(false, Integer.toString(busyThreads));
- busyThreads = 0;
- }
- }
-
- /**
- * Signals the end of a job. Note that this method can be called under
- * OutOfMemoryError conditions and thus must be paranoid about allocating objects.
- */
- protected void endJob(InternalJob job, IStatus result) {
- decrementBusyThreads();
- //need to end rule in graph before ending job so that 2 threads
- //do not become the owners of the same rule in the graph
- if ((job.getRule() != null) && !(job instanceof ThreadJob)) {
- //remove any locks this thread may be owning on that rule
- manager.getLockManager().removeLockCompletely(Thread.currentThread(), job.getRule());
- }
- manager.endJob(job, result, true);
- //ensure this thread no longer owns any scheduling rules
- manager.implicitJobs.endJob(job);
- }
-
- /**
- * Signals the death of a worker thread. Note that this method can be called under
- * OutOfMemoryError conditions and thus must be paranoid about allocating objects.
- */
- protected synchronized void endWorker(Worker worker) {
- if (remove(worker) && JobManager.DEBUG)
- JobManager.debug("worker removed from pool: " + worker); //$NON-NLS-1$
- }
-
- private synchronized void incrementBusyThreads() {
- //impossible to have more busy threads than there are threads
- if (++busyThreads > numThreads) {
- if (JobManager.DEBUG)
- Assert.isTrue(false, Integer.toString(busyThreads) + ',' + numThreads);
- busyThreads = numThreads;
- }
- }
-
- /**
- * Notification that a job has been added to the queue. Wake a worker,
- * creating a new worker if necessary. The provided job may be null.
- */
- protected synchronized void jobQueued() {
- //if there is a sleeping thread, wake it up
- if (sleepingThreads > 0) {
- notify();
- return;
- }
- //create a thread if all threads are busy
- if (busyThreads >= numThreads) {
- Worker worker = new Worker(this);
- worker.setDaemon(isDaemon);
- add(worker);
- if (JobManager.DEBUG)
- JobManager.debug("worker added to pool: " + worker); //$NON-NLS-1$
- worker.start();
- return;
- }
- }
-
- /**
- * Remove a worker thread from our list.
- * @return true if a worker was removed, and false otherwise.
- */
- private synchronized boolean remove(Worker worker) {
- for (int i = 0; i < threads.length; i++) {
- if (threads[i] == worker) {
- System.arraycopy(threads, i + 1, threads, i, numThreads - i - 1);
- threads[--numThreads] = null;
- return true;
- }
- }
- return false;
- }
-
- /**
- * Sets whether threads created in the worker pool should be daemon threads.
- */
- void setDaemon(boolean value) {
- this.isDaemon = value;
- }
-
- protected synchronized void shutdown() {
- notifyAll();
- }
-
- /**
- * Sleep for the given duration or until woken.
- */
- private synchronized void sleep(long duration) {
- sleepingThreads++;
- busyThreads--;
- if (JobManager.DEBUG)
- JobManager.debug("worker sleeping for: " + duration + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- wait(duration);
- } catch (InterruptedException e) {
- if (JobManager.DEBUG)
- JobManager.debug("worker interrupted while waiting... :-|"); //$NON-NLS-1$
- } finally {
- sleepingThreads--;
- busyThreads++;
- }
- }
-
- /**
- * Returns a new job to run. Returns null if the thread should die.
- */
- protected InternalJob startJob(Worker worker) {
- //if we're above capacity, kill the thread
- synchronized (this) {
- if (!manager.isActive()) {
- //must remove the worker immediately to prevent all threads from expiring
- endWorker(worker);
- return null;
- }
- //set the thread to be busy now in case of reentrant scheduling
- incrementBusyThreads();
- }
- Job job = null;
- try {
- job = manager.startJob();
- //spin until a job is found or until we have been idle for too long
- long idleStart = System.currentTimeMillis();
- while (manager.isActive() && job == null) {
- long hint = manager.sleepHint();
- if (hint > 0)
- sleep(Math.min(hint, BEST_BEFORE));
- job = manager.startJob();
- //if we were already idle, and there are still no new jobs, then
- // the thread can expire
- synchronized (this) {
- if (job == null && (System.currentTimeMillis() - idleStart > BEST_BEFORE) && (numThreads - busyThreads) > MIN_THREADS) {
- //must remove the worker immediately to prevent all threads from expiring
- endWorker(worker);
- return null;
- }
- }
- }
- if (job != null) {
- //if this job has a rule, then we are essentially acquiring a lock
- if ((job.getRule() != null) && !(job instanceof ThreadJob)) {
- //don't need to re-aquire locks because it was not recorded in the graph
- //that this thread waited to get this rule
- manager.getLockManager().addLockThread(Thread.currentThread(), job.getRule());
- }
- //see if we need to wake another worker
- if (manager.sleepHint() <= 0)
- jobQueued();
- }
- } finally {
- //decrement busy thread count if we're not running a job
- if (job == null)
- decrementBusyThreads();
- }
- return job;
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/messages.properties b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/messages.properties
deleted file mode 100644
index 9bea82e..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/messages.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-### Runtime jobs plugin messages
-
-### Job Manager and Locks
-jobs_blocked0=The user operation is waiting for background work to complete.
-jobs_blocked1=The user operation is waiting for \"{0}\" to complete.
-jobs_internalError=An internal error occurred during: \"{0}\".
-jobs_waitFamSub={0} work item(s) left.
-
-### metadata
-meta_pluginProblems = Problems occurred when invoking code from plug-in: \"{0}\".
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobChangeEvent.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobChangeEvent.java
deleted file mode 100644
index 4a39905..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobChangeEvent.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.jobs;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * An event describing a change to the state of a job.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * @see IJobChangeListener
- * @since 3.0
- */
-public interface IJobChangeEvent {
- /**
- * The amount of time in milliseconds to wait after scheduling the job before it
- * should be run, or <code>-1</code> if not applicable for this type of event.
- * This value is only applicable for the <code>scheduled</code> event.
- *
- * @return the delay time for this event
- */
- public long getDelay();
-
- /**
- * The job on which this event occurred.
- *
- * @return the job for this event
- */
- public Job getJob();
-
- /**
- * The result returned by the job's run method, or <code>null</code> if
- * not applicable. This value is only applicable for the <code>done</code> event.
- *
- * @return the status for this event
- */
- public IStatus getResult();
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobChangeListener.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobChangeListener.java
deleted file mode 100644
index 7cb5c3e..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobChangeListener.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.jobs;
-
-/**
- * Callback interface for clients interested in being notified when jobs change state.
- * <p>
- * A single job listener instance can be added either to the job manager, for notification
- * of all scheduled jobs, or to any set of individual jobs. A single listener instance should
- * not be added to both the job manager, and to individual jobs (such a listener may
- * receive duplicate notifications).
- * </p><p>
- * Clients should not rely on the result of the <code>Job#getState()</code>
- * method on jobs for which notification is occurring. Listeners are notified of
- * all job state changes, but whether the state change occurs before, during, or
- * after listeners are notified is unspecified.
- * </p><p>
- * Clients may implement this interface.
- * </p>
- * @see JobChangeAdapter
- * @see IJobManager#addJobChangeListener(IJobChangeListener)
- * @see IJobManager#removeJobChangeListener(IJobChangeListener)
- * @see Job#addJobChangeListener(IJobChangeListener)
- * @see Job#getState()
- * @see Job#removeJobChangeListener(IJobChangeListener)
- * @since 3.0
- */
-public interface IJobChangeListener {
- /**
- * Notification that a job is about to be run. Listeners are allowed to sleep, cancel,
- * or change the priority of the job before it is started (and as a result may prevent
- * the run from actually occurring).
- *
- * @param event the event details
- */
- public void aboutToRun(IJobChangeEvent event);
-
- /**
- * Notification that a job was previously sleeping and has now been rescheduled
- * to run.
- *
- * @param event the event details
- */
- public void awake(IJobChangeEvent event);
-
- /**
- * Notification that a job has completed execution, either due to cancelation, successful
- * completion, or failure. The event status object indicates how the job finished,
- * and the reason for failure, if applicable.
- *
- * @param event the event details
- */
- public void done(IJobChangeEvent event);
-
- /**
- * Notification that a job has started running.
- *
- * @param event the event details
- */
- public void running(IJobChangeEvent event);
-
- /**
- * Notification that a job is being added to the queue of scheduled jobs.
- * The event details includes the scheduling delay before the job should start
- * running.
- *
- * @param event the event details, including the job instance and the scheduling
- * delay
- */
- public void scheduled(IJobChangeEvent event);
-
- /**
- * Notification that a job was waiting to run and has now been put in the
- * sleeping state.
- *
- * @param event the event details
- */
- public void sleeping(IJobChangeEvent event);
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobManager.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobManager.java
deleted file mode 100644
index 772aa8a..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobManager.java
+++ /dev/null
@@ -1,410 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.jobs;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-
-/**
- * The job manager provides facilities for scheduling, querying, and maintaining jobs
- * and locks. In particular, the job manager provides the following services:
- * <ul>
- * <li>Maintains a queue of jobs that are waiting to be run. Items can be added to
- * the queue using the <code>schedule</code> method.</li>
- * <li>Allows manipulation of groups of jobs called job families. Job families can
- * be canceled, put to sleep, or woken up atomically. There is also a mechanism
- * for querying the set of known jobs in a given family.</li>
- * <li>Allows listeners to find out about progress on running jobs, and to find out
- * when jobs have changed states.</li>
- * <li>Provides a factory for creating lock objects. Lock objects are smart monitors
- * that have strategies for avoiding deadlock.</li>
- * <li>Provide feedback to a client that is waiting for a given job or family of jobs
- * to complete.</li>
- * </ul>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see Job
- * @see ILock
- * @since 3.0
- */
-public interface IJobManager {
- /**
- * A system property key indicating whether the job manager should create
- * job threads as daemon threads. Set to <code>true</code> to force all worker
- * threads to be created as daemon threads. Set to <code>false</code> to force
- * all worker threads to be created as non-daemon threads.
- * @since 3.3
- */
- public static final String PROP_USE_DAEMON_THREADS = "eclipse.jobs.daemon"; //$NON-NLS-1$
-
- /**
- * Registers a job listener with the job manager.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener the listener to be added
- * @see #removeJobChangeListener(IJobChangeListener)
- * @see IJobChangeListener
- */
- public void addJobChangeListener(IJobChangeListener listener);
-
- /**
- * Begins applying this rule in the calling thread. If the rule conflicts with another
- * rule currently running in another thread, this method blocks until there are
- * no conflicting rules. Calls to <tt>beginRule</tt> must eventually be followed
- * by a matching call to <tt>endRule</tt> in the same thread and with the identical
- * rule instance.
- * <p>
- * Rules can be nested only if the rule for the inner <tt>beginRule</tt>
- * is contained within the rule for the outer <tt>beginRule</tt>. Rule containment
- * is tested with the API method <tt>ISchedulingRule.contains</tt>. Also, begin/end
- * pairs must be strictly nested. Only the rule that has most recently begun
- * can be ended at any given time.
- * <p>
- * A rule of <code>null</code> can be used, but will be ignored for scheduling
- * purposes. The outermost non-null rule in the thread will be used for scheduling. A
- * <code>null</code> rule that is begun must still be ended.
- * <p>
- * If this method is called from within a job that has a scheduling rule, the
- * given rule must also be contained within the rule for the running job.
- * <p>
- * Note that <tt>endRule</tt> must be called even if <tt>beginRule</tt> fails.
- * The recommended usage is:
- * <pre>
- * final ISchedulingRule rule = ...;
- * try {
- * manager.beginRule(rule, monitor);
- * } finally {
- * manager.endRule(rule);
- * }
- * </pre>
- *
- * @param rule the rule to begin applying in this thread, or <code>null</code>
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws IllegalArgumentException if the rule is not strictly nested within
- * all other rules currently active for this thread
- * @throws OperationCanceledException if the supplied monitor reports cancelation
- * before the rule becomes available
- * @see ISchedulingRule#contains(ISchedulingRule)
- */
- public void beginRule(ISchedulingRule rule, IProgressMonitor monitor);
-
- /**
- * Cancels all jobs in the given job family. Jobs in the family that are currently waiting
- * will be removed from the queue. Sleeping jobs will be discarded without having
- * a chance to wake up. Currently executing jobs will be asked to cancel but there
- * is no guarantee that they will do so.
- *
- * @param family the job family to cancel, or <code>null</code> to cancel all jobs
- * @see Job#belongsTo(Object)
- */
- public void cancel(Object family);
-
- /**
- * Returns a progress monitor that can be used to provide
- * aggregated progress feedback on a set of running jobs. A user
- * interface will typically group all jobs in a progress group together,
- * providing progress feedback for individual jobs as well as aggregated
- * progress for the entire group. Jobs in the group may be run sequentially,
- * in parallel, or some combination of the two.
- * <p>
- * Recommended usage (this snippet runs two jobs in sequence in a
- * single progress group):
- * <pre>
- * Job parseJob, compileJob;
- * IProgressMonitor pm = Platform.getJobManager().createProgressGroup();
- * try {
- * pm.beginTask("Building", 10);
- * parseJob.setProgressGroup(pm, 5);
- * parseJob.schedule();
- * compileJob.setProgressGroup(pm, 5);
- * compileJob.schedule();
- * parseJob.join();
- * compileJob.join();
- * } finally {
- * pm.done();
- * }
- * </pre>
- *
- * @see Job#setProgressGroup(IProgressMonitor, int)
- * @see IProgressMonitor
- * @return a progress monitor
- */
- public IProgressMonitor createProgressGroup();
-
- /**
- * Returns the job that is currently running in this thread, or <code>null</code> if there
- * is no currently running job.
- *
- * @return the job or <code>null</code>
- */
- public Job currentJob();
-
- /**
- * Ends the application of a rule to the calling thread. Calls to <tt>endRule</tt>
- * must be preceded by a matching call to <tt>beginRule</tt> in the same thread
- * with an identical rule instance.
- * <p>
- * Rules can be nested only if the rule for the inner <tt>beginRule</tt>
- * is contained within the rule for the outer <tt>beginRule</tt>. Also, begin/end
- * pairs must be strictly nested. Only the rule that has most recently begun
- * can be ended at any given time.
- *
- * @param rule the rule to end applying in this thread
- * @throws IllegalArgumentException if this method is called on a rule for which
- * there is no matching begin, or that does not match the most recent begin.
- * @see ISchedulingRule#contains(ISchedulingRule)
- */
- public void endRule(ISchedulingRule rule);
-
- /**
- * Returns all waiting, executing and sleeping jobs belonging
- * to the given family. If no jobs are found, an empty array is returned.
- *
- * @param family the job family to find, or <code>null</code> to find all jobs
- * @return the job array
- * @see Job#belongsTo(Object)
- */
- public Job[] find(Object family);
-
- /**
- * Returns whether the job manager is currently idle. The job manager is
- * idle if no jobs are currently running or waiting to run.
- *
- * @return <code>true</code> if the job manager is idle, and
- * <code>false</code> otherwise
- * @since 3.1
- */
- public boolean isIdle();
-
- /**
- * Returns whether the job manager is currently suspended.
- *
- * @return <code>true</code> if the job manager is suspended, and
- * <code>false</code> otherwise
- * @since 3.4
- * @see #suspend()
- * @see #resume()
- */
- public boolean isSuspended();
-
- /**
- * Waits until all jobs of the given family are finished. This method will block the
- * calling thread until all such jobs have finished executing, or until this thread is
- * interrupted. If there are no jobs in
- * the family that are currently waiting, running, or sleeping, this method returns
- * immediately. Feedback on how the join is progressing is provided to a progress
- * monitor.
- * <p>
- * If this method is called while the job manager is suspended, only jobs
- * that are currently running will be joined; Once there are no jobs
- * in the family in the {@link Job#RUNNING} state, this method returns.
- * </p>
- * <p>
- * Note that there is a deadlock risk when using join. If the calling thread owns
- * a lock or object monitor that the joined thread is waiting for, deadlock
- * will occur. This method can also result in starvation of the current thread if
- * another thread continues to add jobs of the given family, or if a
- * job in the given family reschedules itself in an infinite loop.
- * </p>
- *
- * @param family the job family to join, or <code>null</code> to join all jobs.
- * @param monitor Progress monitor for reporting progress on how the
- * wait is progressing, or <code>null</code> if no progress monitoring is required.
- * @exception InterruptedException if this thread is interrupted while waiting
- * @exception OperationCanceledException if the progress monitor is canceled while waiting
- * @see Job#belongsTo(Object)
- * @see #suspend()
- */
- public void join(Object family, IProgressMonitor monitor) throws InterruptedException, OperationCanceledException;
-
- /**
- * Creates a new lock object. All lock objects supplied by the job manager
- * know about each other and will always avoid circular deadlock amongst
- * themselves.
- *
- * @return the new lock object
- */
- public ILock newLock();
-
- /**
- * Removes a job listener from the job manager.
- * Has no effect if an identical listener is not already registered.
- *
- * @param listener the listener to be removed
- * @see #addJobChangeListener(IJobChangeListener)
- * @see IJobChangeListener
- */
- public void removeJobChangeListener(IJobChangeListener listener);
-
- /**
- * Resumes execution of jobs after a previous <code>suspend</code>. All
- * jobs that were sleeping or waiting prior to the suspension, or that were
- * scheduled while the job manager was suspended, will now be eligible
- * for execution.
- * <p>
- * Calling this method on a rule that is not suspended has no effect. If another
- * thread also owns the rule at the time this method is called, then the rule will
- * not be resumed until all threads have released the rule.
- *
- * @deprecated This method is not safe and should not be used.
- * Suspending a scheduling rule violates the thread safety
- * of clients that use scheduling rules as a mutual exclusion mechanism,
- * and can result in concurrency problems in all clients that use the suspended rule.
- * @see #suspend(ISchedulingRule, IProgressMonitor)
- */
- public void resume(ISchedulingRule rule);
-
- /**
- * Resumes execution of jobs after a previous <code>suspend</code>. All
- * jobs that were sleeping or waiting prior to the suspension, or that were
- * scheduled while the job manager was suspended, will now be eligible
- * for execution.
- * <p>
- * Calling <code>resume</code> when the job manager is not suspended
- * has no effect.
- *
- * @see #suspend()
- * @see #isSuspended()
- */
- public void resume();
-
- /**
- * Provides a hook that is notified whenever a thread is about to wait on a lock,
- * or when a thread is about to release a lock. This hook must only be set once.
- * <p>
- * This method is for internal use by the platform-related plug-ins.
- * Clients should not call this method.
- * </p>
- * @see LockListener
- */
- public void setLockListener(LockListener listener);
-
- /**
- * Registers a progress provider with the job manager. If there was a
- * provider already registered, it is replaced.
- * <p>
- * This method is intended for use by the currently executing Eclipse application.
- * Plug-ins outside the currently running application should not call this method.
- * </p>
- *
- * @param provider the new provider, or <code>null</code> if no progress
- * is needed
- */
- public void setProgressProvider(ProgressProvider provider);
-
- /**
- * Suspends execution of all jobs. Jobs that are already running
- * when this method is invoked will complete as usual, but all sleeping and
- * waiting jobs will not be executed until the job manager is resumed.
- * <p>
- * The job manager will remain suspended until a subsequent call to
- * <code>resume</code>. Further calls to <code>suspend</code>
- * when the job manager is already suspended are ignored.
- * <p>
- * All attempts to join sleeping and waiting jobs while the job manager is
- * suspended will return immediately.
- * <p>
- * Note that this very powerful function should be used with extreme caution.
- * Suspending the job manager will prevent all jobs in the system from executing,
- * which may have adverse affects on components that are relying on
- * execution of jobs. The job manager should never be suspended without intent
- * to resume execution soon afterwards.
- *
- * @see #resume()
- * @see #join(Object, IProgressMonitor)
- * @see #isSuspended()
- */
- public void suspend();
-
- /**
- * Defers execution of all jobs with scheduling rules that conflict with the
- * given rule. The caller will be blocked until all currently executing jobs with
- * conflicting rules are completed. Conflicting jobs that are sleeping or waiting at
- * the time this method is called will not be executed until the rule is resumed.
- * <p>
- * While a rule is suspended, all calls to <code>beginRule</code> and
- * <code>endRule</code> on a suspended rule will not block the caller.
- * The rule remains suspended until a subsequent call to
- * <code>resume(ISchedulingRule)</code> with the identical rule instance.
- * Further calls to <code>suspend</code> with an identical rule prior to calling
- * <code>resume</code> are ignored.
- * </p>
- * <p>
- * This method is long-running; progress and cancelation are provided by
- * the given progress monitor. In the case of cancelation, the rule will
- * not be suspended.
- * </p>
- * Note: this very powerful function should be used with extreme caution.
- * Suspending rules will prevent jobs in the system from executing, which may
- * have adverse effects on components that are relying on execution of jobs.
- * The job manager should never be suspended without intent to resume
- * execution soon afterwards. Deadlock will result if the thread responsible
- * for resuming the rule attempts to join a suspended job.
- *
- * @deprecated This method is not safe and should not be used.
- * Suspending a scheduling rule violates the thread safety
- * of clients that use scheduling rules as a mutual exclusion mechanism,
- * and can result in concurrency problems in all clients that use the suspended rule.
- * @param rule The scheduling rule to suspend. Must not be <code>null</code>.
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting is not desired
- * @exception OperationCanceledException if the operation is canceled.
- * Cancelation can occur even if no progress monitor is provided.
- * @see #resume(ISchedulingRule)
- */
- public void suspend(ISchedulingRule rule, IProgressMonitor monitor);
-
- /**
- * Requests that all jobs in the given job family be suspended. Jobs currently
- * waiting to be run will be removed from the queue and moved into the
- * <code>SLEEPING</code> state. Jobs that have been put to sleep
- * will remain in that state until either resumed or canceled. This method has
- * no effect on jobs that are not currently waiting to be run.
- * <p>
- * Sleeping jobs can be resumed using <code>wakeUp</code>.
- *
- * @param family the job family to sleep, or <code>null</code> to sleep all jobs.
- * @see Job#belongsTo(Object)
- */
- public void sleep(Object family);
-
- /**
- * Transfers ownership of a scheduling rule to another thread. The identical
- * scheduling rule must currently be owned by the calling thread as a result of
- * a previous call to <code>beginRule</code>. The destination thread must
- * not already own a scheduling rule.
- * <p>
- * Calling this method is equivalent to atomically calling <code>endRule</code>
- * in the calling thread followed by an immediate <code>beginRule</code> in
- * the destination thread. The destination thread is responsible for subsequently
- * calling <code>endRule</code> when it is finished using the rule.
- * <p>
- * This method has no effect when the destination thread is the same as the
- * calling thread.
- *
- * @param rule The scheduling rule to transfer
- * @param destinationThread The new owner for the transferred rule.
- * @since 3.1
- */
- public void transferRule(ISchedulingRule rule, Thread destinationThread);
-
- /**
- * Resumes scheduling of all sleeping jobs in the given family. This method
- * has no effect on jobs in the family that are not currently sleeping.
- *
- * @param family the job family to wake up, or <code>null</code> to wake up all jobs
- * @see Job#belongsTo(Object)
- */
- public void wakeUp(Object family);
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobStatus.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobStatus.java
deleted file mode 100644
index fbdb275..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/IJobStatus.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.jobs;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * Represents status relating to the execution of jobs.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see org.eclipse.core.runtime.IStatus
- */
-public interface IJobStatus extends IStatus {
- /**
- * Returns the job associated with this status.
- *
- * @return the job associated with this status
- */
- public Job getJob();
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/ILock.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/ILock.java
deleted file mode 100644
index 3199113..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/ILock.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.jobs;
-
-/**
- * A lock is used to control access to an exclusive resource.
- * <p>
- * Locks are reentrant. That is, they can be acquired multiple times by the same thread
- * without releasing. Locks are only released when the number of successful acquires
- * equals the number of successful releases.
- * </p><p>
- * Locks are capable of detecting and recovering from programming errors that cause
- * circular waiting deadlocks. When a deadlock between two or more <tt>ILock</tt>
- * instances is detected, detailed debugging information is printed to the log file. The
- * locks will then automatically recover from the deadlock by employing a release
- * and wait strategy. One thread will lose control of the locks it owns, thus breaking
- * the deadlock and allowing other threads to proceed. Once that thread's locks are
- * all available, it will be given exclusive access to all its locks and allowed to proceed.
- * A thread can only lose locks while it is waiting on an <tt>acquire()</tt> call.
- *
- * </p><p>
- * Successive acquire attempts by different threads are queued and serviced on
- * a first come, first served basis.
- * </p><p>
- * It is very important that acquired locks eventually get released. Calls to release
- * should be done in a finally block to ensure they execute. For example:
- * <pre>
- * try {
- * lock.acquire();
- * // ... do work here ...
- * } finally {
- * lock.release();
- * }
- * </pre>
- * Note: although <tt>lock.acquire</tt> should never fail, it is good practice to place
- * it inside the try block anyway. Releasing without acquiring is far less catastrophic
- * than acquiring without releasing.
- * </p><p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * @see IJobManager#newLock()
- * @since 3.0
- */
-public interface ILock {
- /**
- * Attempts to acquire this lock. If the lock is in use and the specified delay is
- * greater than zero, the calling thread will block until one of the following happens:
- * <ul>
- * <li>This lock is available</li>
- * <li>The thread is interrupted</li>
- * <li>The specified delay has elapsed</li>
- * </ul>
- * <p>
- * While a thread is waiting, locks it already owns may be granted to other threads
- * if necessary to break a deadlock. In this situation, the calling thread may be blocked
- * for longer than the specified delay. On returning from this call, the calling thread
- * will once again have exclusive access to any other locks it owned upon entering
- * the acquire method.
- *
- * @param delay the number of milliseconds to delay
- * @return <code>true</code> if the lock was successfully acquired, and
- * <code>false</code> otherwise.
- * @exception InterruptedException if the thread was interrupted
- */
- public boolean acquire(long delay) throws InterruptedException;
-
- /**
- * Acquires this lock. If the lock is in use, the calling thread will block until the lock
- * becomes available. If the calling thread owns several locks, it will be blocked
- * until all threads it requires become available, or until the thread is interrupted.
- * While a thread is waiting, its locks may be granted to other threads if necessary
- * to break a deadlock. On returning from this call, the calling thread will
- * have exclusive access to this lock, and any other locks it owned upon
- * entering the acquire method.
- * <p>
- * This implementation ignores attempts to interrupt the thread. If response to
- * interruption is needed, use the method <code>acquire(long)</code>
- */
- public void acquire();
-
- /**
- * Returns the number of nested acquires on this lock that have not been released.
- * This is the number of times that release() must be called before the lock is
- * freed.
- *
- * @return the number of nested acquires that have not been released
- */
- public int getDepth();
-
- /**
- * Releases this lock. Locks must only be released by the thread that currently
- * owns the lock.
- */
- public void release();
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/ISchedulingRule.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/ISchedulingRule.java
deleted file mode 100644
index 2ea7a76..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/ISchedulingRule.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.jobs;
-
-/**
- * Scheduling rules are used by jobs to indicate when they need exclusive access
- * to a resource. Scheduling rules can also be applied synchronously to a thread
- * using <tt>IJobManager.beginRule(ISchedulingRule)</tt> and
- * <tt>IJobManager.endRule(ISchedulingRule)</tt>. The job manager guarantees that
- * no two jobs with conflicting scheduling rules will run concurrently.
- * Multiple rules can be applied to a given thread only if the outer rule explicitly
- * allows the nesting as specified by the <code>contains</code> method.
- * <p>
- * Clients may implement this interface.
- *
- * @see Job#getRule()
- * @see Job#setRule(ISchedulingRule)
- * @see Job#schedule(long)
- * @see IJobManager#beginRule(ISchedulingRule, org.eclipse.core.runtime.IProgressMonitor)
- * @see IJobManager#endRule(ISchedulingRule)
- * @since 3.0
- */
-public interface ISchedulingRule {
- /**
- * Returns whether this scheduling rule completely contains another scheduling
- * rule. Rules can only be nested within a thread if the inner rule is completely
- * contained within the outer rule.
- * <p>
- * Implementations of this method must obey the rules of a partial order relation
- * on the set of all scheduling rules. In particular, implementations must be reflexive
- * (a.contains(a) is always true), antisymmetric (a.contains(b) and b.contains(a) iff a.equals(b),
- * and transitive (if a.contains(b) and b.contains(c), then a.contains(c)). Implementations
- * of this method must return <code>false</code> when compared to a rule they
- * know nothing about.
- *
- * @param rule the rule to check for containment
- * @return <code>true</code> if this rule contains the given rule, and
- * <code>false</code> otherwise.
- */
- public boolean contains(ISchedulingRule rule);
-
- /**
- * Returns whether this scheduling rule is compatible with another scheduling rule.
- * If <code>true</code> is returned, then no job with this rule will be run at the
- * same time as a job with the conflicting rule. If <code>false</code> is returned,
- * then the job manager is free to run jobs with these rules at the same time.
- * <p>
- * Implementations of this method must be reflexive, symmetric, and consistent,
- * and must return <code>false</code> when compared to a rule they know
- * nothing about.
- *
- * @param rule the rule to check for conflicts
- * @return <code>true</code> if the rule is conflicting, and <code>false</code>
- * otherwise.
- */
- public boolean isConflicting(ISchedulingRule rule);
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/Job.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/Job.java
deleted file mode 100644
index 32993cd..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/Job.java
+++ /dev/null
@@ -1,673 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.jobs;
-
-import org.eclipse.core.internal.jobs.InternalJob;
-import org.eclipse.core.internal.jobs.JobManager;
-import org.eclipse.core.runtime.*;
-
-/**
- * Jobs are units of runnable work that can be scheduled to be run with the job
- * manager. Once a job has completed, it can be scheduled to run again (jobs are
- * reusable).
- * <p>
- * Jobs have a state that indicates what they are currently doing. When constructed,
- * jobs start with a state value of <code>NONE</code>. When a job is scheduled
- * to be run, it moves into the <code>WAITING</code> state. When a job starts
- * running, it moves into the <code>RUNNING</code> state. When execution finishes
- * (either normally or through cancelation), the state changes back to
- * <code>NONE</code>.
- * </p><p>
- * A job can also be in the <code>SLEEPING</code> state. This happens if a user
- * calls Job.sleep() on a waiting job, or if a job is scheduled to run after a specified
- * delay. Only jobs in the <code>WAITING</code> state can be put to sleep.
- * Sleeping jobs can be woken at any time using Job.wakeUp(), which will put the
- * job back into the <code>WAITING</code> state.
- * </p><p>
- * Jobs can be assigned a priority that is used as a hint about how the job should
- * be scheduled. There is no guarantee that jobs of one priority will be run before
- * all jobs of lower priority. The javadoc for the various priority constants provide
- * more detail about what each priority means. By default, jobs start in the
- * <code>LONG</code> priority class.
- *
- * @see IJobManager
- * @since 3.0
- */
-public abstract class Job extends InternalJob implements IAdaptable {
-
- /**
- * Job status return value that is used to indicate asynchronous job completion.
- * @see Job#run(IProgressMonitor)
- * @see Job#done(IStatus)
- */
- public static final IStatus ASYNC_FINISH = new Status(IStatus.OK, JobManager.PI_JOBS, 1, "", null);//$NON-NLS-1$
-
- /* Job priorities */
- /**
- * Job priority constant (value 10) for interactive jobs.
- * Interactive jobs generally have priority over all other jobs.
- * Interactive jobs should be either fast running or very low on CPU
- * usage to avoid blocking other interactive jobs from running.
- *
- * @see #getPriority()
- * @see #setPriority(int)
- * @see #run(IProgressMonitor)
- */
- public static final int INTERACTIVE = 10;
- /**
- * Job priority constant (value 20) for short background jobs.
- * Short background jobs are jobs that typically complete within a second,
- * but may take longer in some cases. Short jobs are given priority
- * over all other jobs except interactive jobs.
- *
- * @see #getPriority()
- * @see #setPriority(int)
- * @see #run(IProgressMonitor)
- */
- public static final int SHORT = 20;
- /**
- * Job priority constant (value 30) for long-running background jobs.
- *
- * @see #getPriority()
- * @see #setPriority(int)
- * @see #run(IProgressMonitor)
- */
- public static final int LONG = 30;
- /**
- * Job priority constant (value 40) for build jobs. Build jobs are
- * generally run after all other background jobs complete.
- *
- * @see #getPriority()
- * @see #setPriority(int)
- * @see #run(IProgressMonitor)
- */
- public static final int BUILD = 40;
-
- /**
- * Job priority constant (value 50) for decoration jobs.
- * Decoration jobs have lowest priority. Decoration jobs generally
- * compute extra information that the user may be interested in seeing
- * but is generally not waiting for.
- *
- * @see #getPriority()
- * @see #setPriority(int)
- * @see #run(IProgressMonitor)
- */
- public static final int DECORATE = 50;
- /**
- * Job state code (value 0) indicating that a job is not
- * currently sleeping, waiting, or running (i.e., the job manager doesn't know
- * anything about the job).
- *
- * @see #getState()
- */
- public static final int NONE = 0;
- /**
- * Job state code (value 1) indicating that a job is sleeping.
- *
- * @see #run(IProgressMonitor)
- * @see #getState()
- */
- public static final int SLEEPING = 0x01;
- /**
- * Job state code (value 2) indicating that a job is waiting to be run.
- *
- * @see #getState()
- */
- public static final int WAITING = 0x02;
- /**
- * Job state code (value 4) indicating that a job is currently running
- *
- * @see #getState()
- */
- public static final int RUNNING = 0x04;
-
- /**
- * Returns the job manager.
- *
- * @return the job manager
- * @since org.eclipse.core.jobs 3.2
- */
- public static final IJobManager getJobManager() {
- return manager;
- }
-
- /**
- * Creates a new job with the specified name. The job name is a human-readable
- * value that is displayed to users. The name does not need to be unique, but it
- * must not be <code>null</code>.
- *
- * @param name the name of the job.
- */
- public Job(String name) {
- super(name);
- }
-
- /**
- * Registers a job listener with this job
- * Has no effect if an identical listener is already registered.
- *
- * @param listener the listener to be added.
- */
- public final void addJobChangeListener(IJobChangeListener listener) {
- super.addJobChangeListener(listener);
- }
-
- /**
- * Returns whether this job belongs to the given family. Job families are
- * represented as objects that are not interpreted or specified in any way
- * by the job manager. Thus, a job can choose to belong to any number of
- * families.
- * <p>
- * Clients may override this method. This default implementation always returns
- * <code>false</code>. Overriding implementations must return <code>false</code>
- * for families they do not recognize.
- * </p>
- *
- * @param family the job family identifier
- * @return <code>true</code> if this job belongs to the given family, and
- * <code>false</code> otherwise.
- */
- public boolean belongsTo(Object family) {
- return false;
- }
-
- /**
- * Stops the job. If the job is currently waiting,
- * it will be removed from the queue. If the job is sleeping,
- * it will be discarded without having a chance to resume and its sleeping state
- * will be cleared. If the job is currently executing, it will be asked to
- * stop but there is no guarantee that it will do so.
- *
- * @return <code>false</code> if the job is currently running (and thus may not
- * respond to cancelation), and <code>true</code> in all other cases.
- */
- public final boolean cancel() {
- return super.cancel();
- }
-
- /**
- * A hook method indicating that this job is running and {@link #cancel()}
- * is being called for the first time.
- * <p>
- * Subclasses may override this method to perform additional work when
- * a cancelation request is made. This default implementation does nothing.
- * @since 3.3
- */
- protected void canceling() {
- //default implementation does nothing
- }
-
- /**
- * Jobs that complete their execution asynchronously must indicate when they
- * are finished by calling this method. This method must not be called by
- * a job that has not indicated that it is executing asynchronously.
- * <p>
- * This method must not be called from within the scope of a job's <code>run</code>
- * method. Jobs should normally indicate completion by returning an appropriate
- * status from the <code>run</code> method. Jobs that return a status of
- * <code>ASYNC_FINISH</code> from their run method must later call
- * <code>done</code> to indicate completion.
- *
- * @param result a status object indicating the result of the job's execution.
- * @see #ASYNC_FINISH
- * @see #run(IProgressMonitor)
- */
- public final void done(IStatus result) {
- super.done(result);
- }
-
- /**
- * Returns the human readable name of this job. The name is never
- * <code>null</code>.
- *
- * @return the name of this job
- */
- public final String getName() {
- return super.getName();
- }
-
- /**
- * Returns the priority of this job. The priority is used as a hint when the job
- * is scheduled to be run.
- *
- * @return the priority of the job. One of INTERACTIVE, SHORT, LONG, BUILD,
- * or DECORATE.
- */
- public final int getPriority() {
- return super.getPriority();
- }
-
- /**
- * Returns the value of the property of this job identified by the given key,
- * or <code>null</code> if this job has no such property.
- *
- * @param key the name of the property
- * @return the value of the property,
- * or <code>null</code> if this job has no such property
- * @see #setProperty(QualifiedName, Object)
- */
- public final Object getProperty(QualifiedName key) {
- return super.getProperty(key);
- }
-
- /**
- * Returns the result of this job's last run.
- *
- * @return the result of this job's last run, or <code>null</code> if this
- * job has never finished running.
- */
- public final IStatus getResult() {
- return super.getResult();
- }
-
- /**
- * Returns the scheduling rule for this job. Returns <code>null</code> if this job has no
- * scheduling rule.
- *
- * @return the scheduling rule for this job, or <code>null</code>.
- * @see ISchedulingRule
- * @see #setRule(ISchedulingRule)
- */
- public final ISchedulingRule getRule() {
- return super.getRule();
- }
-
- /**
- * Returns the state of the job. Result will be one of:
- * <ul>
- * <li><code>Job.RUNNING</code> - if the job is currently running.</li>
- * <li><code>Job.WAITING</code> - if the job is waiting to be run.</li>
- * <li><code>Job.SLEEPING</code> - if the job is sleeping.</li>
- * <li><code>Job.NONE</code> - in all other cases.</li>
- * </ul>
- * <p>
- * Note that job state is inherently volatile, and in most cases clients
- * cannot rely on the result of this method being valid by the time the
- * result is obtained. For example, if <tt>getState</tt> returns
- * <tt>RUNNING</tt>, the job may have actually completed by the
- * time the <tt>getState</tt> method returns. All clients can infer from
- * invoking this method is that the job was recently in the returned state.
- *
- * @return the job state
- */
- public final int getState() {
- return super.getState();
- }
-
- /**
- * Returns the thread that this job is currently running in.
- *
- * @return the thread this job is running in, or <code>null</code>
- * if this job is not running or the thread is unknown.
- */
- public final Thread getThread() {
- return super.getThread();
- }
-
- /**
- * Returns whether this job is blocking a higher priority non-system job from
- * starting due to a conflicting scheduling rule. Returns <code>false</code>
- * if this job is not running, or is not blocking a higher priority non-system job.
- *
- * @return <code>true</code> if this job is blocking a higher priority non-system
- * job, and <code>false</code> otherwise.
- * @see #getRule()
- * @see #isSystem()
- */
- public final boolean isBlocking() {
- return super.isBlocking();
- }
-
- /**
- * Returns whether this job is a system job. System jobs are typically not
- * revealed to users in any UI presentation of jobs. Other than their UI presentation,
- * system jobs act exactly like other jobs. If this value is not explicitly set, jobs
- * are treated as non-system jobs. The default value is <code>false</code>.
- *
- * @return <code>true</code> if this job is a system job, and
- * <code>false</code> otherwise.
- * @see #setSystem(boolean)
- */
- public final boolean isSystem() {
- return super.isSystem();
- }
-
- /**
- * Returns whether this job has been directly initiated by a UI end user.
- * These jobs may be presented differently in the UI. The default value
- * is <code>false</code>.
- *
- * @return <code>true</code> if this job is a user-initiated job, and
- * <code>false</code> otherwise.
- * @see #setUser(boolean)
- */
- public final boolean isUser() {
- return super.isUser();
- }
-
- /**
- * Waits until this job is finished. This method will block the calling thread until the
- * job has finished executing, or until this thread has been interrupted. If the job
- * has not been scheduled, this method returns immediately. A job must not
- * be joined from within the scope of its run method.
- * <p>
- * If this method is called on a job that reschedules itself from within the
- * <tt>run</tt> method, the join will return at the end of the first execution.
- * In other words, join will return the first time this job exits the
- * {@link #RUNNING} state, or as soon as this job enters the {@link #NONE} state.
- * </p>
- * <p>
- * If this method is called while the job manager is suspended, this job
- * will only be joined if it is already running; if this job is waiting or sleeping,
- * this method returns immediately.
- * </p>
- * <p>
- * Note that there is a deadlock risk when using join. If the calling thread owns
- * a lock or object monitor that the joined thread is waiting for, deadlock
- * will occur.
- * </p>
- *
- * @exception InterruptedException if this thread is interrupted while waiting
- * @see ILock
- * @see IJobManager#suspend()
- */
- public final void join() throws InterruptedException {
- super.join();
- }
-
- /**
- * Removes a job listener from this job.
- * Has no effect if an identical listener is not already registered.
- *
- * @param listener the listener to be removed
- */
- public final void removeJobChangeListener(IJobChangeListener listener) {
- super.removeJobChangeListener(listener);
- }
-
- /**
- * Executes this job. Returns the result of the execution.
- * <p>
- * The provided monitor can be used to report progress and respond to
- * cancellation. If the progress monitor has been canceled, the job
- * should finish its execution at the earliest convenience and return a result
- * status of severity {@link IStatus#CANCEL}. The singleton
- * cancel status {@link Status#CANCEL_STATUS} can be used for
- * this purpose. The monitor is only valid for the duration of the invocation
- * of this method.
- * <p>
- * This method must not be called directly by clients. Clients should call
- * <code>schedule</code>, which will in turn cause this method to be called.
- * <p>
- * Jobs can optionally finish their execution asynchronously (in another thread) by
- * returning a result status of {@link #ASYNC_FINISH}. Jobs that finish
- * asynchronously <b>must</b> specify the execution thread by calling
- * <code>setThread</code>, and must indicate when they are finished by calling
- * the method <code>done</code>.
- *
- * @param monitor the monitor to be used for reporting progress and
- * responding to cancelation. The monitor is never <code>null</code>
- * @return resulting status of the run. The result must not be <code>null</code>
- * @see #ASYNC_FINISH
- * @see #done(IStatus)
- */
- protected abstract IStatus run(IProgressMonitor monitor);
-
- /**
- * Schedules this job to be run. The job is added to a queue of waiting
- * jobs, and will be run when it arrives at the beginning of the queue.
- * <p>
- * This is a convenience method, fully equivalent to
- * <code>schedule(0L)</code>.
- * </p>
- * @see #schedule(long)
- */
- public final void schedule() {
- super.schedule(0L);
- }
-
- /**
- * Schedules this job to be run after a specified delay. The job is put in the
- * {@link #SLEEPING} state until the specified delay has elapsed, after which
- * the job is added to a queue of {@link #WAITING} jobs. Once the job arrives
- * at the beginning of the queue, it will be run at the first available opportunity.
- * </p><p>
- * Jobs of equal priority and <code>delay</code> with conflicting scheduling
- * rules are guaranteed to run in the order they are scheduled. No guarantees
- * are made about the relative execution order of jobs with unrelated or
- * <code>null</code> scheduling rules, or different priorities.
- * <p>
- * If this job is currently running, it will be rescheduled with the specified
- * delay as soon as it finishes. If this method is called multiple times
- * while the job is running, the job will still only be rescheduled once,
- * with the most recent delay value that was provided.
- * </p><p>
- * Scheduling a job that is waiting or sleeping has no effect.
- * </p>
- *
- * @param delay a time delay in milliseconds before the job should run
- * @see ISchedulingRule
- */
- public final void schedule(long delay) {
- super.schedule(delay);
- }
-
- /**
- * Changes the name of this job. If the job is currently running, waiting,
- * or sleeping, the new job name may not take effect until the next time the
- * job is scheduled.
- * <p>
- * The job name is a human-readable value that is displayed to users. The name
- * does not need to be unique, but it must not be <code>null</code>.
- *
- * @param name the name of the job.
- */
- public final void setName(String name) {
- super.setName(name);
- }
-
- /**
- * Sets the priority of the job. This will not affect the execution of
- * a running job, but it will affect how the job is scheduled while
- * it is waiting to be run.
- *
- * @param priority the new job priority. One of
- * INTERACTIVE, SHORT, LONG, BUILD, or DECORATE.
- */
- public final void setPriority(int priority) {
- super.setPriority(priority);
- }
-
- /**
- * Associates this job with a progress group. Progress feedback
- * on this job's next execution will be displayed together with other
- * jobs in that group. The provided monitor must be a monitor
- * created by the method <tt>IJobManager.createProgressGroup</tt>
- * and must have at least <code>ticks</code> units of available work.
- * <p>
- * The progress group must be set before the job is scheduled.
- * The group will be used only for a single invocation of the job's
- * <tt>run</tt> method, after which any association of this job to the
- * group will be lost.
- *
- * @see IJobManager#createProgressGroup()
- * @param group The progress group to use for this job
- * @param ticks the number of work ticks allocated from the
- * parent monitor, or {@link IProgressMonitor#UNKNOWN}
- */
- public final void setProgressGroup(IProgressMonitor group, int ticks) {
- super.setProgressGroup(group, ticks);
- }
-
- /**
- * Sets the value of the property of this job identified
- * by the given key. If the supplied value is <code>null</code>,
- * the property is removed from this resource.
- * <p>
- * Properties are intended to be used as a caching mechanism
- * by ISV plug-ins. They allow key-object associations to be stored with
- * a job instance. These key-value associations are maintained in
- * memory (at all times), and the information is never discarded automatically.
- * </p><p>
- * The qualifier part of the property name must be the unique identifier
- * of the declaring plug-in (e.g. <code>"com.example.plugin"</code>).
- * </p>
- *
- * @param key the qualified name of the property
- * @param value the value of the property,
- * or <code>null</code> if the property is to be removed
- * @see #getProperty(QualifiedName)
- */
- public void setProperty(QualifiedName key, Object value) {
- super.setProperty(key, value);
- }
-
- /**
- * Sets the scheduling rule to be used when scheduling this job. This method
- * must be called before the job is scheduled.
- *
- * @param rule the new scheduling rule, or <code>null</code> if the job
- * should have no scheduling rule
- * @see #getRule()
- */
- public final void setRule(ISchedulingRule rule) {
- super.setRule(rule);
- }
-
- /**
- * Sets whether or not this job is a system job. System jobs are typically not
- * revealed to users in any UI presentation of jobs. Other than their UI presentation,
- * system jobs act exactly like other jobs. If this value is not explicitly set, jobs
- * are treated as non-system jobs. This method must be called before the job
- * is scheduled.
- *
- * @param value <code>true</code> if this job should be a system job, and
- * <code>false</code> otherwise.
- * @see #isSystem()
- */
- public final void setSystem(boolean value) {
- super.setSystem(value);
- }
-
- /**
- * Sets whether or not this job has been directly initiated by a UI end user.
- * These jobs may be presented differently in the UI. This method must be
- * called before the job is scheduled.
- *
- * @param value <code>true</code> if this job is a user-initiated job, and
- * <code>false</code> otherwise.
- * @see #isUser()
- */
- public final void setUser(boolean value) {
- super.setUser(value);
- }
-
- /**
- * Sets the thread that this job is currently running in, or <code>null</code>
- * if this job is not running or the thread is unknown.
- * <p>
- * Jobs that use the {@link #ASYNC_FINISH} return code should tell
- * the job what thread it is running in. This is used to prevent deadlocks.
- *
- * @param thread the thread that this job is running in.
- *
- * @see #ASYNC_FINISH
- * @see #run(IProgressMonitor)
- */
- public final void setThread(Thread thread) {
- super.setThread(thread);
- }
-
- /**
- * Returns whether this job should be run.
- * If <code>false</code> is returned, this job will be discarded by the job manager
- * without running.
- * <p>
- * This method is called immediately prior to calling the job's
- * run method, so it can be used for last minute pre-condition checking before
- * a job is run. This method must not attempt to schedule or change the
- * state of any other job.
- * </p><p>
- * Clients may override this method. This default implementation always returns
- * <code>true</code>.
- * </p>
- *
- * @return <code>true</code> if this job should be run
- * and <code>false</code> otherwise
- */
- public boolean shouldRun() {
- return true;
- }
-
- /**
- * Returns whether this job should be scheduled.
- * If <code>false</code> is returned, this job will be discarded by the job manager
- * without being added to the queue.
- * <p>
- * This method is called immediately prior to adding the job to the waiting job
- * queue.,so it can be used for last minute pre-condition checking before
- * a job is scheduled.
- * </p><p>
- * Clients may override this method. This default implementation always returns
- * <code>true</code>.
- * </p>
- *
- * @return <code>true</code> if the job manager should schedule this job
- * and <code>false</code> otherwise
- */
- public boolean shouldSchedule() {
- return true;
- }
-
- /**
- * Requests that this job be suspended. If the job is currently waiting to be run, it
- * will be removed from the queue move into the {@link #SLEEPING} state.
- * The job will remain asleep until either resumed or canceled. If this job is not
- * currently waiting to be run, this method has no effect.
- * <p>
- * Sleeping jobs can be resumed using <code>wakeUp</code>.
- *
- * @return <code>false</code> if the job is currently running (and thus cannot
- * be put to sleep), and <code>true</code> in all other cases
- * @see #wakeUp()
- */
- public final boolean sleep() {
- return super.sleep();
- }
-
- /**
- * Puts this job immediately into the {@link #WAITING} state so that it is
- * eligible for immediate execution. If this job is not currently sleeping,
- * the request is ignored.
- * <p>
- * This is a convenience method, fully equivalent to
- * <code>wakeUp(0L)</code>.
- * </p>
- * @see #sleep()
- */
- public final void wakeUp() {
- super.wakeUp(0L);
- }
-
- /**
- * Puts this job back into the {@link #WAITING} state after
- * the specified delay. This is equivalent to canceling the sleeping job and
- * rescheduling with the given delay. If this job is not currently sleeping,
- * the request is ignored.
- *
- * @param delay the number of milliseconds to delay
- * @see #sleep()
- */
- public final void wakeUp(long delay) {
- super.wakeUp(delay);
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/JobChangeAdapter.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/JobChangeAdapter.java
deleted file mode 100644
index b2f1691..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/JobChangeAdapter.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.jobs;
-
-/**
- * This adapter class provides default implementations for the
- * methods described by the <code>IJobChangeListener</code> interface.
- * <p>
- * Classes that wish to listen to the progress of scheduled jobs can
- * extend this class and override only the methods which they are
- * interested in.
- * </p>
- *
- * @see IJobChangeListener
- * @since 3.0
- */
-public class JobChangeAdapter implements IJobChangeListener {
- /* (non-Javadoc)
- * @see IJobChangeListener#aboutToRun(IJobChangeEvent)
- * This default implementation does nothing
- */
- public void aboutToRun(IJobChangeEvent event) {
- // do nothing
- }
-
- /* (non-Javadoc)
- * @see IJobChangeListener#awake(IJobChangeEvent)
- * This default implementation does nothing
- */
- public void awake(IJobChangeEvent event) {
- // do nothing
- }
-
- /* (non-Javadoc)
- * @see IJobChangeListener#done(IJobChangeEvent)
- * This default implementation does nothing
- */
- public void done(IJobChangeEvent event) {
- // do nothing
- }
-
- /* (non-Javadoc)
- * @see IJobChangeListener#running(IJobChangeEvent)
- * This default implementation does nothing
- */
- public void running(IJobChangeEvent event) {
- // do nothing
- }
-
- /* (non-Javadoc)
- * @see IJobChangeListener#scheduled(IJobChangeEvent)
- * This default implementation does nothing
- */
- public void scheduled(IJobChangeEvent event) {
- // do nothing
- }
-
- /* (non-Javadoc)
- * @see IJobChangeListener#sleeping(IJobChangeEvent)
- * This default implementation does nothing
- */
- public void sleeping(IJobChangeEvent event) {
- // do nothing
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/LockListener.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/LockListener.java
deleted file mode 100644
index 90b7c84..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/LockListener.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.jobs;
-
-import org.eclipse.core.internal.jobs.JobManager;
-import org.eclipse.core.internal.jobs.LockManager;
-
-/**
- * A lock listener is notified whenever a thread is about to wait
- * on a lock, and when a thread is about to release a lock.
- * <p>
- * This class is for internal use by the platform-related plug-ins.
- * Clients outside of the base platform should not reference or subclass this class.
- * </p>
- *
- * @see IJobManager#setLockListener(LockListener)
- * @since 3.0
- */
-public class LockListener {
- private final LockManager manager = ((JobManager)Job.getJobManager()).getLockManager();
-
- /**
- * Notification that a thread is about to block on an attempt to acquire a lock.
- * Returns whether the thread should be granted immediate access to the lock.
- * <p>
- * This default implementation always returns <code>false</code>.
- * Subclasses may override.
- *
- * @param lockOwner the thread that currently owns the lock this thread is
- * waiting for, or <code>null</code> if unknown.
- * @return <code>true</code> if the thread should be granted immediate access,
- * and <code>false</code> if it should wait for the lock to be available
- */
- public boolean aboutToWait(Thread lockOwner) {
- return false;
- }
-
- /**
- * Notification that a thread is about to release a lock.
- * <p>
- * This default implementation does nothing. Subclasses may override.
- */
- public void aboutToRelease() {
- //do nothing
- }
-
- /**
- * Returns whether this thread currently owns any locks
- * @return <code>true</code> if this thread owns any locks, and
- * <code>false</code> otherwise.
- */
- protected final boolean isLockOwnerThread() {
- return manager.isLockOwner();
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/MultiRule.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/MultiRule.java
deleted file mode 100644
index 02089ee..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/MultiRule.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.jobs;
-
-import java.util.ArrayList;
-
-/**
- * A MultiRule is a compound scheduling rule that represents a fixed group of child
- * scheduling rules. A MultiRule conflicts with another rule if any of its children conflict
- * with that rule. More formally, a compound rule represents a logical intersection
- * of its child rules with respect to the <code>isConflicting</code> equivalence
- * relation.
- * <p>
- * A MultiRule will never contain other MultiRules as children. If a MultiRule is provided
- * as a child, its children will be added instead.
- * </p>
- * <p>
- * This class is not intended to be subclassed by clients.
- * </p>
- * @since 3.0
- */
-public class MultiRule implements ISchedulingRule {
- private ISchedulingRule[] rules;
-
- /**
- * Returns a scheduling rule that encompasses all provided rules. The resulting
- * rule may or may not be an instance of <code>MultiRule</code>. If all
- * provided rules are <code>null</code> then the result will be
- * <code>null</code>.
- *
- * @param ruleArray An array of scheduling rules, some of which may be <code>null</code>
- * @return a combined scheduling rule, or <code>null</code>
- * @since 3.1
- */
- public static ISchedulingRule combine(ISchedulingRule[] ruleArray) {
- ISchedulingRule result = null;
- for (int i = 0; i < ruleArray.length; i++) {
- if (ruleArray[i] == null)
- continue;
- if (result == null) {
- result = ruleArray[i];
- continue;
- }
- result = combine(result, ruleArray[i]);
- }
- return result;
- }
-
- /**
- * Returns a scheduling rule that encompasses both provided rules. The resulting
- * rule may or may not be an instance of <code>MultiRule</code>. If both
- * provided rules are <code>null</code> then the result will be
- * <code>null</code>.
- *
- * @param rule1 a scheduling rule, or <code>null</code>
- * @param rule2 another scheduling rule, or <code>null</code>
- * @return a combined scheduling rule, or <code>null</code>
- */
- public static ISchedulingRule combine(ISchedulingRule rule1, ISchedulingRule rule2) {
- if (rule1 == rule2)
- return rule1;
- if (rule1 == null)
- return rule2;
- if (rule2 == null)
- return rule1;
- if (rule1.contains(rule2))
- return rule1;
- if (rule2.contains(rule1))
- return rule2;
- MultiRule result = new MultiRule();
- result.rules = new ISchedulingRule[] {rule1, rule2};
- //make sure we don't end up with nested multi-rules
- if (rule1 instanceof MultiRule || rule2 instanceof MultiRule)
- result.rules = flatten(result.rules);
- return result;
- }
-
- /*
- * Collapses an array of rules that may contain MultiRules into an
- * array in which no rules are MultiRules.
- */
- private static ISchedulingRule[] flatten(ISchedulingRule[] nestedRules) {
- ArrayList myRules = new ArrayList(nestedRules.length);
- for (int i = 0; i < nestedRules.length; i++) {
- if (nestedRules[i] instanceof MultiRule) {
- ISchedulingRule[] children = ((MultiRule) nestedRules[i]).getChildren();
- for (int j = 0; j < children.length; j++)
- myRules.add(children[j]);
- } else {
- myRules.add(nestedRules[i]);
- }
- }
- return (ISchedulingRule[]) myRules.toArray(new ISchedulingRule[myRules.size()]);
- }
-
- /**
- * Creates a new scheduling rule that composes a set of nested rules.
- *
- * @param nestedRules the nested rules for this compound rule.
- */
- public MultiRule(ISchedulingRule[] nestedRules) {
- this.rules = flatten(nestedRules);
- }
-
- /**
- * Creates a new scheduling rule with no nested rules. For
- * internal use only.
- */
- private MultiRule() {
- //to be invoked only by factory methods
- }
-
- /**
- * Returns the child rules within this rule.
- * @return the child rules
- */
- public ISchedulingRule[] getChildren() {
- return (ISchedulingRule[]) rules.clone();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.ISchedulingRule#contains(org.eclipse.core.runtime.jobs.ISchedulingRule)
- */
- public boolean contains(ISchedulingRule rule) {
- if (this == rule)
- return true;
- if (rule instanceof MultiRule) {
- ISchedulingRule[] otherRules = ((MultiRule) rule).getChildren();
- //for each child of the target, there must be some child in this rule that contains it.
- for (int other = 0; other < otherRules.length; other++) {
- boolean found = false;
- for (int mine = 0; !found && mine < rules.length; mine++)
- found = rules[mine].contains(otherRules[other]);
- if (!found)
- return false;
- }
- return true;
- }
- for (int i = 0; i < rules.length; i++)
- if (rules[i].contains(rule))
- return true;
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.ISchedulingRule#isConflicting(org.eclipse.core.runtime.jobs.ISchedulingRule)
- */
- public boolean isConflicting(ISchedulingRule rule) {
- if (this == rule)
- return true;
- if (rule instanceof MultiRule) {
- ISchedulingRule[] otherRules = ((MultiRule) rule).getChildren();
- for (int j = 0; j < otherRules.length; j++)
- for (int i = 0; i < rules.length; i++)
- if (rules[i].isConflicting(otherRules[j]))
- return true;
- } else {
- for (int i = 0; i < rules.length; i++)
- if (rules[i].isConflicting(rule))
- return true;
- }
- return false;
- }
-
- /*
- * For debugging purposes only.
- */
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append("MultiRule["); //$NON-NLS-1$
- int last = rules.length - 1;
- for (int i = 0; i < rules.length; i++) {
- buffer.append(rules[i]);
- if (i != last)
- buffer.append(',');
- }
- buffer.append(']');
- return buffer.toString();
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/ProgressProvider.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/ProgressProvider.java
deleted file mode 100644
index 71a0883..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/ProgressProvider.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.jobs;
-
-import org.eclipse.core.runtime.*;
-
-/**
- * The progress provider supplies the job manager with progress monitors for
- * running jobs. There can only be one progress provider at any given time.
- * <p>
- * This class is intended for use by the currently executing Eclipse application.
- * Plug-ins outside the currently running application should not reference or
- * subclass this class.
- * </p>
- *
- * @see IJobManager#setProgressProvider(ProgressProvider)
- * @since 3.0
- */
-public abstract class ProgressProvider {
- /**
- * Provides a new progress monitor instance to be used by the given job.
- * This method is called prior to running any job that does not belong to a
- * progress group. The returned monitor will be supplied to the job's
- * <code>run</code> method.
- *
- * @see #createProgressGroup()
- * @see Job#setProgressGroup(IProgressMonitor, int)
- * @param job the job to create a progress monitor for
- * @return a progress monitor, or <code>null</code> if no progress monitoring
- * is needed.
- */
- public abstract IProgressMonitor createMonitor(Job job);
-
- /**
- * Returns a progress monitor that can be used to provide
- * aggregated progress feedback on a set of running jobs.
- * This method implements <code>IJobManager.createProgressGroup</code>,
- * and must obey all rules specified in that contract.
- * <p>
- * This default implementation returns a new
- * <code>NullProgressMonitor</code> Subclasses may override.
- *
- * @see IJobManager#createProgressGroup()
- * @return a progress monitor
- */
- public IProgressMonitor createProgressGroup() {
- return new NullProgressMonitor();
- }
-
- /**
- * Returns a progress monitor that can be used by a running job
- * to report progress in the context of a progress group. This method
- * implements <code>Job.setProgressGroup</code>. One of the
- * two <code>createMonitor</code> methods will be invoked
- * prior to each execution of a job, depending on whether a progress
- * group was specified for the job.
- * <p>
- * The provided monitor must be a monitor returned by the method
- * <code>createProgressGroup</code>. This method is responsible
- * for asserting this and throwing an appropriate runtime exception
- * if an invalid monitor is provided.
- * <p>
- * This default implementation returns a new
- * <code>SubProgressMonitor</code>. Subclasses may override.
- *
- * @see IJobManager#createProgressGroup()
- * @see Job#setProgressGroup(IProgressMonitor, int)
- * @param job the job to create a progress monitor for
- * @param group the progress monitor group that this job belongs to
- * @param ticks the number of ticks of work for the progress monitor
- * @return a progress monitor, or <code>null</code> if no progress monitoring
- * is needed.
- */
- public IProgressMonitor createMonitor(Job job, IProgressMonitor group, int ticks) {
- return new SubProgressMonitor(group, ticks);
- }
-
- /**
- * Returns a progress monitor to use when none has been provided
- * by the client running the job.
- * <p>
- * This default implementation returns a new
- * <code>NullProgressMonitor</code> Subclasses may override.
- *
- * @return a progress monitor
- */
- public IProgressMonitor getDefaultMonitor() {
- return new NullProgressMonitor();
- }
-}
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/package.html b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/package.html
deleted file mode 100644
index 1e6256b..0000000
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/runtime/jobs/package.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides core support for scheduling and interacting with background activity.
-<h2>
-Package Specification</h2>
-<p>
-This package specifies API for scheduling background tasks, or jobs. Jobs can be
-scheduled for immediate execution, or for execution after a specified delay. Once
-scheduled, jobs can be queried, canceled, or suspended. Rules can be attached to
-jobs to indicate when they can run, and whether they can run simultaneously with other
-jobs. This package also includes a generic locking facility that includes support for
-detecting and responding to deadlock.
-<p>
-@since 3.0
-<p>
-</body>
-</html>
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/.classpath b/bundles/org.eclipse.core.runtime.compatibility.auth/.classpath
deleted file mode 100644
index ce0c7a5..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.0%Foundation-1.0"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/.cvsignore b/bundles/org.eclipse.core.runtime.compatibility.auth/.cvsignore
deleted file mode 100644
index ba077a4..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/.project b/bundles/org.eclipse.core.runtime.compatibility.auth/.project
deleted file mode 100644
index 545efb0..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.runtime.compatibility.auth</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 16532b2..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue May 25 15:00:03 EDT 2004
-encoding/<project>=ISO-8859-1
-eclipse.preferences.version=1
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 56cd28a..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Wed Apr 19 17:13:49 EDT 2006
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
-org.eclipse.jdt.core.compiler.compliance=1.3
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
-org.eclipse.jdt.core.compiler.source=1.3
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.pde.core.prefs
deleted file mode 100644
index 6b9194f..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.pde.core.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Sat Mar 11 22:15:20 EST 2006
-eclipse.preferences.version=1
-pluginProject.extensions=false
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.runtime.compatibility.auth/META-INF/MANIFEST.MF
deleted file mode 100644
index 6ebbc5c..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,18 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.core.runtime.compatibility.auth
-Bundle-Version: 3.2.100.qualifier
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Import-Package: org.eclipse.osgi.framework.log,
- org.eclipse.osgi.service.datalocation,
- org.eclipse.osgi.util;version="1.0.0",
- org.osgi.framework,
- org.osgi.util.tracker
-Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.2.0,4.0.0)"
-Bundle-Activator: org.eclipse.core.internal.runtime.auth.Activator
-Export-Package: org.eclipse.core.internal.runtime.auth;x-friends:="org.eclipse.core.runtime"
-Eclipse-LazyStart: true
-Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,
- J2SE-1.3
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/about.html b/bundles/org.eclipse.core.runtime.compatibility.auth/about.html
deleted file mode 100644
index 82c2fe1..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/about.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>October 30, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-<h3>Cryptography</h3>
-
-<h4>Export Control</h4>
-<p>The plug-in contains encryption software. The country in which you are currently may have restrictions on the import, possession,
-and use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check the country's
-laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this
-is permitted.</p>
-
-<h4>Encryption Items</h4>
-
-<p>Details of the encryption software in this plug-in are provided to assist in obtaining relevant export control classification and approval.
-Cryptography in this plug-in has been deemed eligible by the U.S. Government Department of Commerce for export under License Exception Technology Software Unrestricted (TSU) for both object code and source code.</p>
-
-<p>The plug-in contains a proprietary routine that encrypts and decrypts information used to login to Version Control Management (VCM) repositories.
-This routine uses the SHA-1 message digest algorithm implemented in a Java (TM) Runtime Environment (JRE), to generate a cryptographically secure sequence of bytes based on a
-user-supplied password combined with bytes supplied by a random number generator. The secure random numbers generated by this sequence are then added to each byte in the data
-to be encrypted. When the data is to be decrypted, the same password will generate the same sequence of random numbers, which is then subtracted from each byte in the encrypted data.
-Note that a JRE and therefore the aforementioned SHA-1 message digest code is not included with the plug-in.</p>
-
-<p>The following Java classes contain encryption items (the plug-in may contain both binary and source code):</p>
-
-<ul>
- <li>org.eclipse.core.internal.runtime.auth.Cipher</li>
-</ul>
-
-<small>Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.</small>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/build.properties b/bundles/org.eclipse.core.runtime.compatibility.auth/build.properties
deleted file mode 100644
index 8949718..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/build.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-###############################################################################
-# Copyright (c) 2005, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html,\
- plugin.properties
-src.includes = about.html
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/plugin.properties b/bundles/org.eclipse.core.runtime.compatibility.auth/plugin.properties
deleted file mode 100644
index 20f5a09..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/plugin.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-pluginName = Authorization Compatibility Plug-in
-providerName = Eclipse.org
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Activator.java b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Activator.java
deleted file mode 100644
index bf8a2dc..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Activator.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime.auth;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osgi.framework.log.FrameworkLog;
-import org.eclipse.osgi.framework.log.FrameworkLogEntry;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.util.tracker.ServiceTracker;
-
-public class Activator implements BundleActivator {
-
- private static BundleContext bundleContext;
- private static ServiceTracker logTracker;
-
- /*
- * Return this activator's bundle context.
- */
- public static BundleContext getContext() {
- return bundleContext;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- Activator.bundleContext = context;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- if (logTracker != null) {
- logTracker.close();
- logTracker = null;
- }
- Activator.bundleContext = null;
- }
-
- /*
- * Log the given status in the framework log.
- */
- public static void log(IStatus status) {
- if (logTracker == null) {
- logTracker = new ServiceTracker(getContext(), FrameworkLog.class.getName(), null);
- logTracker.open();
- }
- FrameworkLog log = (FrameworkLog) logTracker.getService();
- log.log(getEntry(status));
- }
-
- /*
- * Copied code from PlatformLogWriter to convert a status object into
- * a FrameworkLogEntry.
- */
- private static FrameworkLogEntry getEntry(IStatus status) {
- Throwable t = status.getException();
- ArrayList childlist = new ArrayList();
-
- int stackCode = t instanceof CoreException ? 1 : 0;
- // ensure a sub-status inside a CoreException is properly logged
- if (stackCode == 1) {
- IStatus coreStatus = ((CoreException) t).getStatus();
- if (coreStatus != null)
- childlist.add(getEntry(coreStatus));
- }
-
- if (status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++)
- childlist.add(getEntry(children[i]));
- }
-
- FrameworkLogEntry[] children = (FrameworkLogEntry[]) (childlist.size() == 0 ? null : childlist.toArray(new FrameworkLogEntry[childlist.size()]));
-
- return new FrameworkLogEntry(status.getPlugin(), status.getSeverity(), status.getCode(), status.getMessage(), stackCode, t, children);
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/AuthorizationDatabase.java b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/AuthorizationDatabase.java
deleted file mode 100644
index 8e201b4..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/AuthorizationDatabase.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime.auth;
-
-import java.io.*;
-import java.net.URL;
-import java.util.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * A database that remembers information, such as user-names and
- * passwords. The information is stored in memory and can be saved
- * to disk in an encrypted format. While the API is phrased in terms of
- * URLs, realms and authentication schemes, not all of these must have
- * significant values. For example, if "realm" is not relevant to a
- * particular application, it can be left blank (though not
- * <code>null</code>).
- */
-public class AuthorizationDatabase {
- public static final String PI_RUNTIME_AUTH = "org.eclipse.core.runtime.auth.compatibility"; //$NON-NLS-1$
-
- /**
- * Status code constant (value 4) indicating the platform could not read
- * some of its metadata.
- */
- public static final int FAILED_READ_METADATA = 4;
-
- /**
- * Status code constant (value 5) indicating the platform could not write
- * some of its metadata.
- */
- public static final int FAILED_WRITE_METADATA = 5;
-
- /**
- * Version number for the format of the key-ring file.
- */
- private static final int KEYRING_FILE_VERSION = 1;
-
- /**
- * A nested hashtable that stores authorization information. The
- * table maps server URLs to realms to authentication schemes to
- * authorization information.
- */
- private Hashtable authorizationInfo = new Hashtable(5);
-
- /**
- * A hashtable mapping resource URLs to realms.
- */
- private Hashtable protectionSpace = new Hashtable(5);
-
- private File file = null;
- private String password = null;
- private boolean needsSaving = true;
-
- /**
- * Creates a new authorization database whose data cannot be saved to
- * disk.
- */
- public AuthorizationDatabase() {
- super();
- }
-
- /**
- * Creates a new authorization database, or opens an existing one, whose
- * data is, or can be, saved to a file with the given filename. A
- * password must be given to create a new database and an existing
- * database is opened by supplying the password that was given to create
- * it.
- *
- * @param filename the location of the database on disk. For example,
- * "c:/temp/database"
- * @param password the password to access the database. For example,
- * "secret"
- * @exception CoreException if there are problems creating the database.
- * Reasons include:
- * <ul>
- * <li>The database could not be opened because the wrong password was given.
- * <li>The database could not be opened because the specified file is corrupt.
- * </ul>
- */
- public AuthorizationDatabase(String filename, String password) throws CoreException {
- Assert.isNotNull(filename);
- Assert.isNotNull(password);
- this.password = password;
- file = new File(filename);
- load();
- }
-
- /**
- * Adds the given authorization information to the database. The
- * information is relevant for the specified protection space and the
- * given authorization scheme. The protection space is defined by the
- * combination of the given server URL and realm. The authorization
- * scheme determines what the authorization information contains and how
- * it should be used. The authorization information is a <code>Map</code>
- * of <code>String</code> to <code>String</code> and typically
- * contain information such as usernames and passwords.
- *
- * @param serverUrl the URL identifying the server for this authorization
- * information. For example, "http://www.hostname.com/".
- * @param realm the subsection of the given server to which this
- * authorization information applies. For example,
- * "realm1@hostname.com" or "" for no realm.
- * @param authScheme the scheme for which this authorization information
- * applies. For example, "Basic" or "" for no authorization scheme
- * @param info a <code>Map</code> containing authorization information
- * such as usernames and passwords
- */
- public void addAuthorizationInfo(URL serverUrl, String realm, String authScheme, Map info) {
- Assert.isNotNull(serverUrl);
- Assert.isNotNull(realm);
- Assert.isNotNull(authScheme);
- Assert.isNotNull(info);
-
- String url = serverUrl.toString();
- Hashtable realmToAuthScheme = (Hashtable) authorizationInfo.get(url);
- if (realmToAuthScheme == null) {
- realmToAuthScheme = new Hashtable(5);
- authorizationInfo.put(url, realmToAuthScheme);
- }
-
- Hashtable authSchemeToInfo = (Hashtable) realmToAuthScheme.get(realm);
- if (authSchemeToInfo == null) {
- authSchemeToInfo = new Hashtable(5);
- realmToAuthScheme.put(realm, authSchemeToInfo);
- }
-
- authSchemeToInfo.put(authScheme.toLowerCase(), info);
- needsSaving = true;
- }
-
- /**
- * Adds the specified resource to the protection space specified by the
- * given realm. All resources at or deeper than the depth of the last
- * symbolic element in the path of the given resource URL are assumed to
- * be in the same protection space.
- *
- * @param resourceUrl the URL identifying the resources to be added to
- * the specified protection space. For example,
- * "http://www.hostname.com/folder/".
- * @param realm the name of the protection space. For example,
- * "realm1@hostname.com"
- */
- public void addProtectionSpace(URL resourceUrl, String realm) {
- Assert.isNotNull(resourceUrl);
- Assert.isNotNull(realm);
-
- if (!resourceUrl.getFile().endsWith("/")) { //$NON-NLS-1$
- resourceUrl = URLTool.getParent(resourceUrl);
- }
-
- String oldRealm = getProtectionSpace(resourceUrl);
- if (oldRealm != null && oldRealm.equals(realm)) {
- return;
- }
-
- String url1 = resourceUrl.toString();
- Enumeration urls = protectionSpace.keys();
- while (urls.hasMoreElements()) {
- String url2 = (String) urls.nextElement();
- if (url1.startsWith(url2) || url2.startsWith(url1)) {
- protectionSpace.remove(url2);
- break;
- }
- }
-
- protectionSpace.put(url1, realm);
- needsSaving = true;
- }
-
- /**
- * Removes the authorization information for the specified protection
- * space and given authorization scheme. The protection space is defined
- * by the given server URL and realm.
- *
- * @param serverUrl the URL identifying the server to remove the
- * authorization information for. For example,
- * "http://www.hostname.com/".
- * @param realm the subsection of the given server to remove the
- * authorization information for. For example,
- * "realm1@hostname.com" or "" for no realm.
- * @param authScheme the scheme for which the authorization information
- * to remove applies. For example, "Basic" or "" for no
- * authorization scheme.
- */
- public void flushAuthorizationInfo(URL serverUrl, String realm, String authScheme) {
- Hashtable realmToAuthScheme = (Hashtable) authorizationInfo.get(serverUrl.toString());
-
- if (realmToAuthScheme == null) {
- return;
- }
-
- Hashtable authSchemeToInfo = (Hashtable) realmToAuthScheme.get(realm);
-
- if (authSchemeToInfo == null) {
- return;
- }
-
- authSchemeToInfo.remove(authScheme.toLowerCase());
-
- needsSaving = true;
- }
-
- /**
- * Returns the authorization information for the specified protection
- * space and given authorization scheme. The protection space is defined
- * by the given server URL and realm. Returns <code>null</code> if no
- * such information exists.
- *
- * @param serverUrl the URL identifying the server for the authorization
- * information. For example, "http://www.hostname.com/".
- * @param realm the subsection of the given server to which the
- * authorization information applies. For example,
- * "realm1@hostname.com" or "" for no realm.
- * @param authScheme the scheme for which the authorization information
- * applies. For example, "Basic" or "" for no authorization scheme
- * @return the authorization information for the specified protection
- * space and given authorization scheme, or <code>null</code> if no
- * such information exists
- */
- public Map getAuthorizationInfo(URL serverUrl, String realm, String authScheme) {
- Hashtable realmToAuthScheme = (Hashtable) authorizationInfo.get(serverUrl.toString());
- if (realmToAuthScheme == null) {
- return null;
- }
-
- Hashtable authSchemeToInfo = (Hashtable) realmToAuthScheme.get(realm);
- if (authSchemeToInfo == null) {
- return null;
- }
-
- return (Map) authSchemeToInfo.get(authScheme.toLowerCase());
- }
-
- /**
- * Returns the protection space (realm) for the specified resource, or
- * <code>null</code> if the realm is unknown.
- *
- * @param resourceUrl the URL of the resource whose protection space is
- * returned. For example, "http://www.hostname.com/folder/".
- * @return the protection space (realm) for the specified resource, or
- * <code>null</code> if the realm is unknown
- */
- public String getProtectionSpace(URL resourceUrl) {
- while (resourceUrl != null) {
- String realm = (String) protectionSpace.get(resourceUrl.toString());
- if (realm != null) {
- return realm;
- }
- resourceUrl = URLTool.getParent(resourceUrl);
- }
-
- return null;
- }
-
- private void load() throws CoreException {
- if (file == null)
- return;
- if (!file.exists()) {
- save();
- return;
- }
- try {
- InputStream input = new FileInputStream(file);
- try {
- load(input);
- } finally {
- input.close();
- }
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, PI_RUNTIME_AUTH, FAILED_READ_METADATA, NLS.bind(Messages.meta_unableToReadAuthorization, file), e));
- } catch (ClassNotFoundException e) {
- throw new CoreException(new Status(IStatus.ERROR, PI_RUNTIME_AUTH, FAILED_READ_METADATA, NLS.bind(Messages.meta_unableToReadAuthorization, file), e));
- }
- }
-
- private void load(InputStream is) throws IOException, ClassNotFoundException, CoreException {
- //try to read the file version number. Pre 2.0 versions had no number
- int version = is.read();
- if (version == KEYRING_FILE_VERSION) {
- //read the authorization data
- CipherInputStream cis = new CipherInputStream(is, password);
- ObjectInputStream ois = new ObjectInputStream(cis);
- try {
- authorizationInfo = (Hashtable) ois.readObject();
- protectionSpace = (Hashtable) ois.readObject();
- } finally {
- ois.close();
- }
- } else {
- //the format has changed, just log a warning
- Activator.log(new Status(IStatus.WARNING, PI_RUNTIME_AUTH, FAILED_READ_METADATA, Messages.meta_authFormatChanged, null));
- //close the stream and save a new file in the correct format
- try {
- is.close();
- } catch (IOException e) {
- //ignore failure to close
- }
- needsSaving = true;
- save();
- }
- }
-
- /**
- * Saves the authorization database to disk.
- */
- public void save() throws CoreException {
- if (!needsSaving || file == null)
- return;
- try {
- file.delete();
- if ((!file.getParentFile().exists() && !file.getParentFile().mkdirs()) || !canWrite(file.getParentFile()))
- throw new CoreException(new Status(IStatus.ERROR, PI_RUNTIME_AUTH, FAILED_WRITE_METADATA, NLS.bind(Messages.meta_unableToWriteAuthorization, file), null));
- file.createNewFile();
- FileOutputStream out = new FileOutputStream(file);
- try {
- save(out);
- } finally {
- out.close();
- }
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, PI_RUNTIME_AUTH, FAILED_WRITE_METADATA, NLS.bind(Messages.meta_unableToWriteAuthorization, file), e));
- }
- needsSaving = false;
- }
-
- private static boolean canWrite(File installDir) {
- if (!installDir.canWrite())
- return false;
-
- if (!installDir.isDirectory())
- return false;
-
- File fileTest = null;
- try {
- fileTest = File.createTempFile("writtableArea", null, installDir); //$NON-NLS-1$
- } catch (IOException e) {
- // If an exception occurred while trying to create the file, it means that it is not writable
- return false;
- } finally {
- if (fileTest != null)
- fileTest.delete();
- }
- return true;
- }
-
- private void save(FileOutputStream os) throws IOException {
- //write the version number
- os.write(KEYRING_FILE_VERSION);
-
- CipherOutputStream cos = new CipherOutputStream(os, password);
- ObjectOutputStream oos = new ObjectOutputStream(cos);
- //write the data
- try {
- oos.writeObject(authorizationInfo);
- oos.writeObject(protectionSpace);
- os.flush();
- os.getFD().sync();
- } finally {
- oos.close();
- }
- }
-
- /**
- * Sets the password to use for accessing this database. If the database
- * is subsequently saved, this new password is used.
- */
- public boolean setPassword(String oldValue, String newValue) {
- if (!oldValue.equals(password))
- return false;
- password = newValue;
- needsSaving = true;
- return true;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/AuthorizationHandler.java b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/AuthorizationHandler.java
deleted file mode 100644
index e4629da..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/AuthorizationHandler.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime.auth;
-
-import java.io.File;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.osgi.service.datalocation.Location;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-
-// This class factors out the management of the .keyring location
-public class AuthorizationHandler {
- /* package */static final String F_KEYRING = ".keyring"; //$NON-NLS-1$
-
- //Authorization related informations
- private static AuthorizationDatabase keyring = null;
- private static long keyringTimeStamp;
- private static String keyringFile = null;
- private static String password = ""; //$NON-NLS-1$
-
- /**
- * Opens the password database (if any) initially provided to the platform at startup.
- */
- private static void loadKeyring() throws CoreException {
- if (keyring != null && new File(keyringFile).lastModified() == keyringTimeStamp)
- return;
- if (keyringFile == null) {
- ServiceReference[] refs = null;
- try {
- refs = Activator.getContext().getServiceReferences(Location.class.getName(), Location.CONFIGURATION_FILTER);
- if (refs == null || refs.length == 0)
- return;
- } catch (InvalidSyntaxException e) {
- // ignore this. It should never happen as we have tested the above format.
- return;
- }
- Location configurationLocation = (Location) Activator.getContext().getService(refs[0]);
- if (configurationLocation == null)
- return;
- File file = new File(configurationLocation.getURL().getPath() + "/org.eclipse.core.runtime"); //$NON-NLS-1$
- Activator.getContext().ungetService(refs[0]);
- file = new File(file, F_KEYRING);
- keyringFile = file.getAbsolutePath();
- }
- try {
- keyring = new AuthorizationDatabase(keyringFile, password);
- } catch (CoreException e) {
- Activator.log(e.getStatus());
- }
- if (keyring == null) {
- //try deleting the file and loading again - format may have changed
- new java.io.File(keyringFile).delete();
- keyring = new AuthorizationDatabase(keyringFile, password);
- //don't bother logging a second failure and let it flows to the callers
- }
- keyringTimeStamp = new File(keyringFile).lastModified();
- }
-
- /**
- * Saves the keyring file to disk.
- * @exception CoreException
- */
- private static void saveKeyring() throws CoreException {
- keyring.save();
- keyringTimeStamp = new File(keyringFile).lastModified();
- }
-
- /**
- * Adds the given authorization information to the key ring. The
- * information is relevant for the specified protection space and the
- * given authorization scheme. The protection space is defined by the
- * combination of the given server URL and realm. The authorization
- * scheme determines what the authorization information contains and how
- * it should be used. The authorization information is a <code>Map</code>
- * of <code>String</code> to <code>String</code> and typically
- * contains information such as user names and passwords.
- *
- * @param serverUrl the URL identifying the server for this authorization
- * information. For example, "http://www.example.com/".
- * @param realm the subsection of the given server to which this
- * authorization information applies. For example,
- * "realm1@example.com" or "" for no realm.
- * @param authScheme the scheme for which this authorization information
- * applies. For example, "Basic" or "" for no authorization scheme
- * @param info a <code>Map</code> containing authorization information
- * such as user names and passwords (key type : <code>String</code>,
- * value type : <code>String</code>)
- * @exception CoreException if there are problems setting the
- * authorization information. Reasons include:
- * <ul>
- * <li>The keyring could not be saved.</li>
- * </ul>
- * XXX Move to a plug-in to be defined (JAAS plugin).
- */
- public static synchronized void addAuthorizationInfo(URL serverUrl, String realm, String authScheme, Map info) throws CoreException {
- loadKeyring();
- keyring.addAuthorizationInfo(serverUrl, realm, authScheme, new HashMap(info));
- saveKeyring();
- }
-
- /**
- * Adds the specified resource to the protection space specified by the
- * given realm. All targets at or deeper than the depth of the last
- * symbolic element in the path of the given resource URL are assumed to
- * be in the same protection space.
- *
- * @param resourceUrl the URL identifying the resources to be added to
- * the specified protection space. For example,
- * "http://www.example.com/folder/".
- * @param realm the name of the protection space. For example,
- * "realm1@example.com"
- * @exception CoreException if there are problems setting the
- * authorization information. Reasons include:
- * <ul>
- * <li>The key ring could not be saved.</li>
- * </ul>
- * XXX Move to a plug-in to be defined (JAAS plugin).
- */
- public static synchronized void addProtectionSpace(URL resourceUrl, String realm) throws CoreException {
- loadKeyring();
- keyring.addProtectionSpace(resourceUrl, realm);
- saveKeyring();
- }
-
- /**
- * Removes the authorization information for the specified protection
- * space and given authorization scheme. The protection space is defined
- * by the given server URL and realm.
- *
- * @param serverUrl the URL identifying the server to remove the
- * authorization information for. For example,
- * "http://www.example.com/".
- * @param realm the subsection of the given server to remove the
- * authorization information for. For example,
- * "realm1@example.com" or "" for no realm.
- * @param authScheme the scheme for which the authorization information
- * to remove applies. For example, "Basic" or "" for no
- * authorization scheme.
- * @exception CoreException if there are problems removing the
- * authorization information. Reasons include:
- * <ul>
- * <li>The keyring could not be saved.</li>
- * </ul>
- * XXX Move to a plug-in to be defined (JAAS plugin).
- */
- public static synchronized void flushAuthorizationInfo(URL serverUrl, String realm, String authScheme) throws CoreException {
- loadKeyring();
- keyring.flushAuthorizationInfo(serverUrl, realm, authScheme);
- saveKeyring();
- }
-
- /**
- * Returns the authorization information for the specified protection
- * space and given authorization scheme. The protection space is defined
- * by the given server URL and realm. Returns <code>null</code> if no
- * such information exists.
- *
- * @param serverUrl the URL identifying the server for the authorization
- * information. For example, "http://www.example.com/".
- * @param realm the subsection of the given server to which the
- * authorization information applies. For example,
- * "realm1@example.com" or "" for no realm.
- * @param authScheme the scheme for which the authorization information
- * applies. For example, "Basic" or "" for no authorization scheme
- * @return the authorization information for the specified protection
- * space and given authorization scheme, or <code>null</code> if no
- * such information exists
- *XXX Move to a plug-in to be defined (JAAS plugin).
- */
- public static synchronized Map getAuthorizationInfo(URL serverUrl, String realm, String authScheme) {
- Map info = null;
- try {
- loadKeyring();
- info = keyring.getAuthorizationInfo(serverUrl, realm, authScheme);
- } catch (CoreException e) {
- // The error has already been logged in loadKeyring()
- }
- return info == null ? null : new HashMap(info);
- }
-
- /**
- * Returns the protection space (realm) for the specified resource, or
- * <code>null</code> if the realm is unknown.
- *
- * @param resourceUrl the URL of the resource whose protection space is
- * returned. For example, "http://www.example.com/folder/".
- * @return the protection space (realm) for the specified resource, or
- * <code>null</code> if the realm is unknown
- * * XXX Move to a plug-in to be defined (JAAS plugin).
- */
- public static synchronized String getProtectionSpace(URL resourceUrl) {
- try {
- loadKeyring();
- } catch (CoreException e) {
- // The error has already been logged in loadKeyring()
- return null;
- }
- return keyring.getProtectionSpace(resourceUrl);
- }
-
- public static void setKeyringFile(String file) {
- if (keyringFile != null)
- throw new IllegalStateException(NLS.bind(Messages.meta_keyringFileAlreadySpecified, keyringFile));
- keyringFile = file;
- }
-
- public static void setPassword(String keyringPassword) {
- password = keyringPassword;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Cipher.java b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Cipher.java
deleted file mode 100644
index 7fa97d7..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Cipher.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime.auth;
-
-import java.io.UnsupportedEncodingException;
-import java.security.MessageDigest;
-import java.util.Random;
-
-/**
- * <P>Encrypts or decrypts a sequence of bytes. The bytes are decrypted
- * by supplying the same password that was given when the bytes were
- * encrypted.
- * <P>Here is an example showing how to encrypt and then decrypt the
- * string "Hello, world!" using the password "music":
- * <pre>
- * String password = "music";
- * byte[] data = "Hello, world!".getBytes("UTF8");
- *
- * // Encrypt
- * Cipher cipher = new Cipher(ENCRYPT_MODE, password);
- * byte[] encrypted = cipher.cipher(data);
- *
- * // Decrypt
- * cipher = new Cipher(DECRYPT_MODE, password);
- * byte[] decrypted = cipher.cipher(encrypted);
- * </pre>
- */
-public class Cipher {
- public static final int DECRYPT_MODE = -1;
- public static final int ENCRYPT_MODE = 1;
- private static final int RANDOM_SIZE = 16;
-
- private int mode = 0;
- private byte[] password = null;
-
- //the following fields are used for generating a secure byte stream
- //used by the decryption algorithm
- private byte[] byteStream;
- private int byteStreamOffset;
- private MessageDigest digest;
- private Random random;
- private final byte[] toDigest;
-
- /**
- * Initializes the cipher with the given mode and password. This method
- * must be called first (before any encryption of decryption takes
- * place) to specify whether the cipher should be in encrypt or decrypt
- * mode and to set the password.
- *
- * @param mode
- * @param passwordString
- */
- public Cipher(int mode, String passwordString) {
- this.mode = mode;
- try {
- this.password = passwordString.getBytes("UTF8"); //$NON-NLS-1$
- } catch (UnsupportedEncodingException e) {
- this.password = passwordString.getBytes();
- }
- toDigest = new byte[password.length + RANDOM_SIZE];
- }
-
- /**
- * Encrypts or decrypts (depending on which mode the cipher is in) the
- * given data and returns the result.
- *
- * @param data
- * @return the result of encrypting or decrypting the given data
- */
- public byte[] cipher(byte[] data) throws Exception {
- return transform(data, 0, data.length, mode);
- }
-
- /**
- * Encrypts or decrypts (depending on which mode the cipher is in) the
- * given data and returns the result.
- *
- * @param data the byte array containg the given data
- * @param off the index of the first byte in the given byte array
- * to be transformed
- * @param len the number of bytes to be transformed
- * @return the result of encrypting or decrypting the given data
- */
- public byte[] cipher(byte[] data, int off, int len) throws Exception {
- return transform(data, off, len, mode);
- }
-
- /**
- * Encrypts or decrypts (depending on which mode the cipher is in) the
- * given byte and returns the result.
- *
- * @param datum the given byte
- * @return the result of encrypting or decrypting the given byte
- */
- public byte cipher(byte datum) throws Exception {
- byte[] data = {datum};
- return cipher(data)[0];
- }
-
- /**
- * Generates a secure stream of bytes based on the input seed.
- * This routine works by combining the input seed with random bytes
- * generated by a random number generator, and then computing the
- * SHA-1 hash of those bytes.
- */
- private byte[] generateBytes() throws Exception {
- if (digest == null) {
- digest = MessageDigest.getInstance("SHA"); //$NON-NLS-1$
- //also seed random number generator based on password
- long seed = 0;
- for (int i = 0; i < password.length; i++)
- //this function is known to give good hash distribution for character data
- seed = (seed * 37) + password[i];
- random = new Random(seed);
- }
- //add random bytes to digest array
- random.nextBytes(toDigest);
-
- //overlay password onto digest array
- System.arraycopy(password, 0, toDigest, 0, password.length);
-
- //compute and return SHA-1 hash of digest array
- return digest.digest(toDigest);
- }
-
- /**
- * Returns a stream of cryptographically secure bytes of the given length.
- * The result is deterministically based on the input seed (password).
- */
- private byte[] nextRandom(int length) throws Exception {
- byte[] nextRandom = new byte[length];
- int nextRandomOffset = 0;
- while (nextRandomOffset < length) {
- if (byteStream == null || byteStreamOffset >= byteStream.length) {
- byteStream = generateBytes();
- byteStreamOffset = 0;
- }
- nextRandom[nextRandomOffset++] = byteStream[byteStreamOffset++];
- }
- return nextRandom;
- }
-
- private byte[] transform(byte[] data, int off, int len, int mod) throws Exception {
- byte[] result = nextRandom(len);
- for (int i = 0; i < len; ++i) {
- result[i] = (byte) (data[i + off] + mod * result[i]);
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/CipherInputStream.java b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/CipherInputStream.java
deleted file mode 100644
index ec8d276..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/CipherInputStream.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime.auth;
-
-import java.io.*;
-
-/**
- * Decrypts a stream of data that was encrypted using the
- * <code>Cipher</code> or <code>CipherOutputStream</code>.
- *
- * @see Cipher
- * @see CipherOutputStream
- */
-public class CipherInputStream extends FilterInputStream {
- private static final int SKIP_BUFFER_SIZE = 2048;
- private Cipher cipher;
-
- /**
- * Constructs a new <code>CipherInputStream</code> that decrypts the
- * data in the given <code>InputStream</code>. The data can only be
- * decrypted if the given password is the same as that which was used
- * to encrypt it.
- *
- * @param is
- * @param password
- */
- public CipherInputStream(InputStream is, String password) {
- super(is);
- cipher = new Cipher(Cipher.DECRYPT_MODE, password);
- }
-
- /**
- * @see InputStream#markSupported()
- */
- public boolean markSupported() {
- return false;
- }
-
- /**
- * @see InputStream#read()
- */
- public int read() throws IOException {
- int b = super.read();
- if (b == -1)
- return -1;
- try {
- return (cipher.cipher((byte) b)) & 0x00ff;
- } catch (Exception e) {
- throw new IOException(e.getMessage());
- }
- }
-
- /**
- * @see InputStream#read(byte[], int, int)
- */
- public int read(byte b[], int off, int len) throws IOException {
- int bytesRead = in.read(b, off, len);
- if (bytesRead == -1)
- return -1;
- try {
- byte[] result = cipher.cipher(b, off, bytesRead);
- for (int i = 0; i < result.length; ++i)
- b[i + off] = result[i];
- return bytesRead;
- } catch (Exception e) {
- throw new IOException(e.getMessage());
- }
- }
-
- /**
- * @see InputStream#skip(long)
- */
- public long skip(long n) throws IOException {
- byte[] buffer = new byte[SKIP_BUFFER_SIZE];
-
- int bytesRead = 0;
- long bytesRemaining = n;
-
- while (bytesRead != -1 && bytesRemaining > 0) {
- bytesRead = read(buffer, 0, (int) Math.min(SKIP_BUFFER_SIZE, bytesRemaining));
- if (bytesRead > 0) {
- bytesRemaining -= bytesRead;
- }
- }
-
- return n - bytesRemaining;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/CipherOutputStream.java b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/CipherOutputStream.java
deleted file mode 100644
index 7301435..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/CipherOutputStream.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime.auth;
-
-import java.io.*;
-
-/**
- * Encrypts a stream of data that can be decrypted using the
- * <code>Cipher</code> or <code>CipherInputStream</code>.
- *
- * @see Cipher
- * @see CipherInputStream
- */
-public class CipherOutputStream extends FilterOutputStream {
- private Cipher cipher;
-
- /**
- * Constructs a new <code>CipherOutputStream</code> that encrypts the
- * data in the given <code>OutputStream</code>. Once the data is
- * encrypted it can be decrypted by suppying the encrupted data and
- * given password to a <code>Cipher</code> or
- * <code>CipherInputStream</code>.
- *
- * @param os
- * @param password
- */
- public CipherOutputStream(OutputStream os, String password) {
- super(os);
- cipher = new Cipher(Cipher.ENCRYPT_MODE, password);
- }
-
- /**
- * @see OutputStream#write(int)
- */
- public void write(int b) throws IOException {
- try {
- out.write(cipher.cipher((byte) b));
- } catch (Exception e) {
- throw new IOException(e.getMessage());
- }
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Messages.java b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Messages.java
deleted file mode 100644
index d3bae1e..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Messages.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.core.internal.runtime.auth;
-
-import org.eclipse.osgi.util.NLS;
-
-// Runtime plugin message catalog
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.core.internal.runtime.auth.messages"; //$NON-NLS-1$
-
- public static String meta_authFormatChanged;
- public static String meta_keyringFileAlreadySpecified;
- public static String meta_unableToReadAuthorization;
- public static String meta_unableToWriteAuthorization;
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/URLTool.java b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/URLTool.java
deleted file mode 100644
index 87ad397..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/URLTool.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime.auth;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import org.eclipse.core.runtime.Assert;
-
-/**
- * A utility for manipulating <code>URL</code>s.
- */
-public class URLTool {
-
- /**
- * Returns the parent URL of the given URL, or <code>null</code> if the
- * given URL is the root.
- * <table>
- * <caption>Example</caption>
- * <tr>
- * <th>Given URL</th>
- * <th>Parent URL</th>
- * <tr>
- * <td>"http://hostname/"</td>
- * <td>null</td>
- * <tr>
- * <td>"http://hostname/folder/file</td>
- * <td>"http://hostname/folder/</td>
- * </table>
- *
- * @param url a URL
- * @return the parent of the given URL
- */
- public static URL getParent(URL url) {
- String file = url.getFile();
- int len = file.length();
- if (len == 0 || len == 1 && file.charAt(0) == '/')
- return null;
- int lastSlashIndex = -1;
- for (int i = len - 2; lastSlashIndex == -1 && i >= 0; --i) {
- if (file.charAt(i) == '/')
- lastSlashIndex = i;
- }
- if (lastSlashIndex == -1)
- file = ""; //$NON-NLS-1$
- else
- file = file.substring(0, lastSlashIndex + 1);
-
- try {
- url = new URL(url.getProtocol(), url.getHost(), url.getPort(), file);
- } catch (MalformedURLException e) {
- Assert.isTrue(false, e.getMessage());
- }
- return url;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/messages.properties b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/messages.properties
deleted file mode 100644
index da5d3da..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/messages.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-auth_notAvailable = Authorization infrastructure (org.eclipse.core.runtime.compatibility.auth) not installed.
-meta_authFormatChanged = The platform authorization database file format has changed. Cached authorization information will be lost.
-meta_keyringFileAlreadySpecified = The keyring file location has already been specified {0}.
-meta_unableToReadAuthorization = Unable to read authorization database: {0}.
-meta_unableToWriteAuthorization = Unable to write to authorization database: {0}.
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/.classpath b/bundles/org.eclipse.core.runtime.compatibility.registry/.classpath
deleted file mode 100644
index ce0c7a5..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.0%Foundation-1.0"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/.cvsignore b/bundles/org.eclipse.core.runtime.compatibility.registry/.cvsignore
deleted file mode 100644
index ba077a4..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/.project b/bundles/org.eclipse.core.runtime.compatibility.registry/.project
deleted file mode 100644
index 525a642..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.runtime.compatibility.registry</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.runtime.compatibility.registry/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 56cd28a..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Wed Apr 19 17:13:49 EDT 2006
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
-org.eclipse.jdt.core.compiler.compliance=1.3
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
-org.eclipse.jdt.core.compiler.source=1.3
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/.settings/org.eclipse.ltk.core.refactoring.prefs b/bundles/org.eclipse.core.runtime.compatibility.registry/.settings/org.eclipse.ltk.core.refactoring.prefs
deleted file mode 100644
index 56411a5..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/.settings/org.eclipse.ltk.core.refactoring.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Wed Feb 01 16:10:57 EST 2006
-eclipse.preferences.version=1
-org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.runtime.compatibility.registry/META-INF/MANIFEST.MF
deleted file mode 100644
index 1aa7ff3..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,12 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %fragmentName
-Bundle-SymbolicName: org.eclipse.core.runtime.compatibility.registry
-Bundle-Version: 3.2.200.qualifier
-Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.equinox.registry;bundle-version="[3.3.0,3.5.0)"
-Bundle-Localization: fragment
-Eclipse-PatchFragment: true
-Bundle-ClassPath: runtime_registry_compatibility.jar
-Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,
- J2SE-1.3
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/about.html b/bundles/org.eclipse.core.runtime.compatibility.registry/about.html
deleted file mode 100644
index 4602330..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/build.properties b/bundles/org.eclipse.core.runtime.compatibility.registry/build.properties
deleted file mode 100644
index 9c06951..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/build.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2005, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.runtime_registry_compatibility.jar = src/,\
- classes/
-output.runtime_registry_compatibility.jar = bin/
-bin.includes = META-INF/,\
- runtime_registry_compatibility.jar,\
- about.html,\
- fragment.properties
-extra.runtime_registry_compatibility.jar = classes/
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/classes/org/eclipse/core/runtime/IPluginDescriptor.class b/bundles/org.eclipse.core.runtime.compatibility.registry/classes/org/eclipse/core/runtime/IPluginDescriptor.class
deleted file mode 100644
index 817a1b8..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/classes/org/eclipse/core/runtime/IPluginDescriptor.class
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/fragment.properties b/bundles/org.eclipse.core.runtime.compatibility.registry/fragment.properties
deleted file mode 100644
index e60dbf5..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/fragment.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-providerName=Eclipse.org
-fragmentName=Eclipse Registry Compatibility Fragment
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/BundleHelper.java b/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/BundleHelper.java
deleted file mode 100644
index 9519509..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/BundleHelper.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import org.eclipse.core.internal.registry.osgi.Activator;
-import org.osgi.framework.Bundle;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.osgi.util.tracker.ServiceTracker;
-
-public class BundleHelper {
-
- private ServiceTracker bundleTracker = null;
-
- private static final BundleHelper singleton = new BundleHelper();
-
- public static BundleHelper getDefault() {
- return singleton;
- }
-
- /**
- * Private constructor to block instance creation.
- */
- private BundleHelper() {
- super();
- }
-
- private PackageAdmin getPackageAdmin() {
- if (bundleTracker == null) {
- bundleTracker = new ServiceTracker(Activator.getContext(), PackageAdmin.class.getName(), null);
- bundleTracker.open();
- }
- return (PackageAdmin) bundleTracker.getService();
- }
-
- public Bundle getBundle(String symbolicName) {
- PackageAdmin packageAdmin = getPackageAdmin();
- if (packageAdmin == null)
- return null;
- Bundle[] bundles = packageAdmin.getBundles(symbolicName, null);
- if (bundles == null)
- return null;
- //Return the first bundle that is not installed or uninstalled
- for (int i = 0; i < bundles.length; i++) {
- if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
- return bundles[i];
- }
- }
- return null;
- }
-
- public Bundle[] getHosts(Bundle bundle) {
- PackageAdmin packageAdmin = getPackageAdmin();
- if (packageAdmin == null)
- return null;
- return packageAdmin.getHosts(bundle);
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionHandle.java b/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionHandle.java
deleted file mode 100644
index 2e3421f..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionHandle.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
-import org.osgi.framework.Bundle;
-
-/**
- * This class contains only compatibility-specific code.
- *
- * @deprecated marked as deprecated to supress warnings
- */
-public class ExtensionHandle extends BaseExtensionHandle {
-
- static final ExtensionHandle[] EMPTY_ARRAY = new ExtensionHandle[0];
-
- public ExtensionHandle(IObjectManager objectManager, int id) {
- super(objectManager, id);
- }
-
- public IPluginDescriptor getDeclaringPluginDescriptor() throws InvalidRegistryObjectException {
- String namespace = getContributor().getName();
- IPluginDescriptor result = RegistryCompatibilityHelper.getPluginDescriptor(namespace);
- if (result == null) {
- Bundle underlyingBundle = BundleHelper.getDefault().getBundle(namespace);
- if (underlyingBundle != null) {
- Bundle[] hosts = BundleHelper.getDefault().getHosts(underlyingBundle);
- if (hosts != null)
- result = RegistryCompatibilityHelper.getPluginDescriptor(hosts[0].getSymbolicName());
- }
- }
-
- return result;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionPointHandle.java b/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionPointHandle.java
deleted file mode 100644
index 2487cd2..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionPointHandle.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import org.eclipse.core.runtime.IPluginDescriptor;
-
-/**
- * This class contains only compatibility-specific code.
- *
- * @deprecated marked as deprecated to supress warnings
- */
-public class ExtensionPointHandle extends BaseExtensionPointHandle {
-
- static final ExtensionPointHandle[] EMPTY_ARRAY = new ExtensionPointHandle[0];
-
- public ExtensionPointHandle(IObjectManager objectManager, int id) {
- super(objectManager, id);
- }
-
- public IPluginDescriptor getDeclaringPluginDescriptor() {
- return RegistryCompatibilityHelper.getPluginDescriptor(getContributor().getName());
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/RegistryCompatibilityHelper.java b/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/RegistryCompatibilityHelper.java
deleted file mode 100644
index 4659556..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/RegistryCompatibilityHelper.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import java.lang.reflect.Method;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.osgi.framework.Bundle;
-
-/**
- * This class isolates calls to the backward compatibility layer.
- * It uses reflection so it can be loaded with success even in the absence of
- * the compatibility plugin.
- *
- * @deprecated Marked as deprecated to suppress deprecation warnings.
- */
-public class RegistryCompatibilityHelper {
- public static final String PI_RUNTIME_COMPATIBILITY = "org.eclipse.core.runtime.compatibility"; //$NON-NLS-1$
- private static Bundle compatibility = null;
-
- public synchronized static Bundle initializeCompatibility() {
- // if compatibility is stale (has been uninstalled or unresolved)
- // then we try to get a new resolved compatibility bundle
- if (compatibility == null || (compatibility.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED | Bundle.STOPPING)) != 0) {
- compatibility = BundleHelper.getDefault().getBundle(PI_RUNTIME_COMPATIBILITY);
- }
- return compatibility;
- }
-
- public synchronized static IPluginDescriptor getPluginDescriptor(String pluginId) {
- //Here we use reflection so the runtime code can run without the compatibility
- initializeCompatibility();
- if (compatibility == null)
- throw new IllegalStateException();
-
- Class oldInternalPlatform = null;
- try {
- oldInternalPlatform = compatibility.loadClass("org.eclipse.core.internal.plugins.InternalPlatform"); //$NON-NLS-1$
- Method getPluginDescriptor = oldInternalPlatform.getMethod("getPluginDescriptor", new Class[] {String.class}); //$NON-NLS-1$
- return (IPluginDescriptor) getPluginDescriptor.invoke(oldInternalPlatform, new Object[] {pluginId});
- } catch (Exception e) {
- //Ignore the exceptions, return null
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtension.java b/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtension.java
deleted file mode 100644
index 4f66c75..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtension.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * An extension declared in a plug-in.
- * All information is obtained from the declaring plug-in's
- * manifest (<code>plugin.xml</code>) file.
- * <p>
- * These registry objects are intended for relatively short-term use. Clients that
- * deal with these objects must be aware that they may become invalid if the
- * declaring plug-in is updated or uninstalled. If this happens, all methods except
- * {@link #isValid()} will throw {@link InvalidRegistryObjectException}.
- * For extension objects, the most common case is code in a plug-in dealing
- * with extensions contributed to one of the extension points it declares.
- * Code in a plug-in that has declared that it is not dynamic aware (or not
- * declared anything) can safely ignore this issue, since the registry
- * would not be modified while it is active. However, code in a plug-in that
- * declares that it is dynamic aware must be careful when accessing the extension
- * objects because they become invalid if the contributing plug-in is removed.
- * Similarly, tools that analyze or display the extension registry are vulnerable.
- * Client code can pre-test for invalid objects by calling {@link #isValid()},
- * which never throws this exception. However, pre-tests are usually not sufficient
- * because of the possibility of the extension object becoming invalid as a
- * result of a concurrent activity. At-risk clients must treat
- * <code>InvalidRegistryObjectException</code> as if it were a checked exception.
- * Also, such clients should probably register a listener with the extension registry
- * so that they receive notification of any changes to the registry.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-public interface IExtension {
- /**
- * Returns all configuration elements declared by this extension.
- * These elements are a direct reflection of the configuration
- * markup supplied in the manifest (<code>plugin.xml</code>)
- * file for the plug-in that declares this extension.
- * Returns an empty array if this extension does not declare any
- * configuration elements.
- *
- * @return the configuration elements declared by this extension
- * @throws InvalidRegistryObjectException if this extension is no longer valid
- */
- public IConfigurationElement[] getConfigurationElements() throws InvalidRegistryObjectException;
-
- /**
- * Returns the namespace for this extension. This value can be used
- * in various global facilities to discover this extension's provider.
- *
- * @return the namespace for this extension
- * @throws InvalidRegistryObjectException if this extension is no longer valid
- * @see IExtensionRegistry
- * @since 3.0
- *
- * @deprecated As namespace is no longer restricted to the contributor name,
- * use {@link #getNamespaceIdentifier()} to obtain namespace name or {@link #getContributor()}
- * to get the name of the contributor of this registry element
- */
- public String getNamespace() throws InvalidRegistryObjectException;
-
- /**
- * Returns the namespace name for this extension.
- * @return the namespace name for this extension
- * @throws InvalidRegistryObjectException if this extension is no longer valid
- * @since org.eclipse.equinox.registry 3.2
- */
- public String getNamespaceIdentifier() throws InvalidRegistryObjectException;
-
- /**
- * Returns the contributor of the extension.
- * @return the contributor for this extension
- * @throws InvalidRegistryObjectException if this extension is no longer valid
- * @since org.eclipse.equinox.registry 3.2
- */
- public IContributor getContributor() throws InvalidRegistryObjectException;
-
- /**
- * Returns the unique identifier of the extension point
- * to which this extension should be contributed.
- *
- * @return the unique identifier of the relevant extension point
- * @throws InvalidRegistryObjectException if this extension is no longer valid
- */
- public String getExtensionPointUniqueIdentifier() throws InvalidRegistryObjectException;
-
- /**
- * Returns a displayable label for this extension.
- * Returns the empty string if no label for this extension
- * is specified in the plug-in manifest file.
- * <p> Note that any translation specified in the plug-in manifest
- * file is automatically applied.
- * <p>
- *
- * @return a displayable string label for this extension,
- * possibly the empty string
- * @throws InvalidRegistryObjectException if this extension is no longer valid
- */
- public String getLabel() throws InvalidRegistryObjectException;
-
- /**
- * Returns the simple identifier of this extension, or <code>null</code>
- * if this extension does not have an identifier.
- * This identifier is specified in the plug-in manifest (<code>plugin.xml</code>)
- * file as a non-empty string containing no period characters
- * (<code>'.'</code>) and must be unique within the defining plug-in.
- *
- * @return the simple identifier of the extension (e.g. <code>"main"</code>)
- * or <code>null</code>
- * @throws InvalidRegistryObjectException if this extension is no longer valid
- */
- public String getSimpleIdentifier() throws InvalidRegistryObjectException;
-
- /**
- * Returns the unique identifier of this extension, or <code>null</code>
- * if this extension does not have an identifier.
- * If available, this identifier is unique within the plug-in registry, and
- * is composed of the namespace where this extension
- * was declared and this extension's simple identifier.
- *
- * @return the unique identifier of the extension
- * (e.g. <code>"com.example.acme.main"</code>), or <code>null</code>
- * @throws InvalidRegistryObjectException if this extension is no longer valid
- */
- public String getUniqueIdentifier() throws InvalidRegistryObjectException;
-
- /* (non-javadoc)
- * @see Object#equals(java.lang.Object)
- */
- public boolean equals(Object o);
-
- /**
- * Returns whether this extension object is valid.
- *
- * @return <code>true</code> if the object is valid, and <code>false</code>
- * if it is no longer valid
- * @since 3.1
- */
- public boolean isValid();
-
- /**
- * Returns the descriptor of the plug-in that declares this extension.
- *
- * @return the plug-in that declares this extension
- * @throws InvalidRegistryObjectException if this extension is no longer valid
- * @deprecated IPluginDescriptor is not part of the new runtime and its function
- * has been split over several parts of the new runtime. This method
- * is not available (returns <tt>null</tt>) if the compatibility layer is not installed. Use getNamespace()
- * to get the symbolic id of the declaring plugin. See {@link IPluginDescriptor} to see how to
- * update your use-cases.
- */
- public IPluginDescriptor getDeclaringPluginDescriptor() throws InvalidRegistryObjectException;
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtensionPoint.java b/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtensionPoint.java
deleted file mode 100644
index e773ec0..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtensionPoint.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * An extension point declared in a plug-in.
- * Except for the list of extensions plugged in to it, the information
- * available for an extension point is obtained from the declaring plug-in's
- * manifest (<code>plugin.xml</code>) file.
- * <p>
- * These registry objects are intended for relatively short-term use. Clients that
- * deal with these objects must be aware that they may become invalid if the
- * declaring plug-in is updated or uninstalled. If this happens, all methods except
- * {@link #isValid()} will throw {@link InvalidRegistryObjectException}.
- * For extension point objects, the most common case is code in a plug-in dealing
- * with one of the extension points it declares. These extension point objects are
- * guaranteed to be valid while the plug-in is active. Code in a plug-in that has
- * declared that it is not dynamic aware (or not declared anything) can also safely
- * ignore this issue, since the registry would not be modified while it is
- * active. However, code in a plug-in that declares that it is dynamic aware
- * must be careful if it access the extension point object of a different plug-in,
- * because it's at risk if that other plug-in is removed. Similarly,
- * tools that analyze or display the extension registry are vulnerable.
- * Client code can pre-test for invalid objects by calling {@link #isValid()},
- * which never throws this exception. However, pre-tests are usually not sufficient
- * because of the possibility of the extension point object becoming invalid as a
- * result of a concurrent activity. At-risk clients must treat
- * <code>InvalidRegistryObjectException</code> as if it were a checked exception.
- * Also, such clients should probably register a listener with the extension registry
- * so that they receive notification of any changes to the registry.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-public interface IExtensionPoint {
- /**
- * Returns all configuration elements from all extensions configured
- * into this extension point. Returns an empty array if this extension
- * point has no extensions configured, or none of the extensions
- * contain configuration elements.
- *
- * @return the configuration elements for all extension configured
- * into this extension point
- * @throws InvalidRegistryObjectException if this extension point is no longer valid
- */
- public IConfigurationElement[] getConfigurationElements() throws InvalidRegistryObjectException;
-
- /**
- * Returns the namespace for this extension point. This value can be used
- * in various global facilities to discover this extension point's provider.
- *
- * @return the namespace for this extension point
- * @throws InvalidRegistryObjectException if this extension point is no longer valid
- * @see IExtensionRegistry
- * @since 3.0
- *
- * @deprecated As namespace is no longer restricted to the contributor name,
- * use {@link #getNamespaceIdentifier()} to obtain namespace name or {@link #getContributor()}
- * to get the name of the contributor of this registry element
- */
- public String getNamespace() throws InvalidRegistryObjectException;
-
- /**
- * Returns the namespace name for this extension point.
- * @return the namespace name for this extension point
- * @throws InvalidRegistryObjectException if this extension point is no longer valid
- * @since org.eclipse.equinox.registry 3.2
- */
- public String getNamespaceIdentifier() throws InvalidRegistryObjectException;
-
- /**
- * Returns the contributor of the extension point.
- * @return the contributor for this extension point
- * @throws InvalidRegistryObjectException if this extension point is no longer valid
- * @since org.eclipse.equinox.registry 3.2
- */
- public IContributor getContributor() throws InvalidRegistryObjectException;
-
- /**
- * Returns the extension with the given unique identifier configured into
- * this extension point, or <code>null</code> if there is no such extension.
- * Since an extension might not have an identifier, some extensions
- * can only be found via the <code>getExtensions</code> method.
- *
- * @param extensionId the unique identifier of an extension
- * (e.g. <code>"com.example.acme.main"</code>).
- * @return an extension, or <code>null</code>
- * @throws InvalidRegistryObjectException if this extension point is no longer valid
- */
- public IExtension getExtension(String extensionId) throws InvalidRegistryObjectException;
-
- /**
- * Returns all extensions configured into this extension point.
- * Returns an empty array if this extension point has no extensions.
- *
- * @return the extensions configured into this extension point
- * @throws InvalidRegistryObjectException if this extension point is no longer valid
- */
- public IExtension[] getExtensions() throws InvalidRegistryObjectException;
-
- /**
- * Returns a displayable label for this extension point.
- * Returns the empty string if no label for this extension point
- * is specified in the plug-in manifest file.
- * <p> Note that any translation specified in the plug-in manifest
- * file is automatically applied.
- * </p>
- *
- * @return a displayable string label for this extension point,
- * possibly the empty string
- * @throws InvalidRegistryObjectException if this extension point is no longer valid
- */
- public String getLabel() throws InvalidRegistryObjectException;
-
- /**
- * Returns reference to the extension point schema. The schema
- * reference is returned as a URL path relative to the plug-in
- * installation URL.
- * Returns the empty string if no schema for this extension point
- * is specified in the plug-in manifest file.
- *
- * @return a relative URL path, or an empty string
- * @throws InvalidRegistryObjectException if this extension point is no longer valid
- */
- public String getSchemaReference() throws InvalidRegistryObjectException;
-
- /**
- * Returns the simple identifier of this extension point.
- * This identifier is a non-empty string containing no
- * period characters (<code>'.'</code>) and is guaranteed
- * to be unique within the defining plug-in.
- *
- * @return the simple identifier of the extension point (e.g. <code>"builders"</code>)
- * @throws InvalidRegistryObjectException if this extension point is no longer valid
- */
- public String getSimpleIdentifier() throws InvalidRegistryObjectException;
-
- /**
- * Returns the unique identifier of this extension point.
- * This identifier is unique within the plug-in registry, and
- * is composed of the namespace for this extension point
- * and this extension point's simple identifier.
- *
- *
- * @return the unique identifier of the extension point
- * (e.g. <code>"org.eclipse.core.resources.builders"</code>)
- * @throws InvalidRegistryObjectException if this extension point is no longer valid
- */
- public String getUniqueIdentifier() throws InvalidRegistryObjectException;
-
- /* (non-javadoc)
- * @see Object#equals(java.lang.Object)
- */
- public boolean equals(Object o);
-
- /**
- * Returns whether this extension point object is valid.
- *
- * @return <code>true</code> if the object is valid, and <code>false</code>
- * if it is no longer valid
- * @since 3.1
- */
- public boolean isValid();
-
- /**
- * Returns the descriptor of the plug-in that declares this extension point.
- *
- * @return the plug-in that declares this extension point
- * @throws InvalidRegistryObjectException if this extension point is no longer valid
- * @deprecated IPluginDescriptor is not part of the new runtime and its function
- * has been split over several parts of the new runtime. This method
- * is not available (returns null) if the compatibility layer is not installed. Use getNamespace()
- * to get the symbolic id of the declaring plugin. See {@link IPluginDescriptor} to see how to
- * update your use-cases.
- */
- public IPluginDescriptor getDeclaringPluginDescriptor() throws InvalidRegistryObjectException;
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/.classpath b/bundles/org.eclipse.core.runtime.compatibility/.classpath
deleted file mode 100644
index 98a4507..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src-boot"/>
- <classpathentry kind="src" path="src-runtime"/>
- <classpathentry kind="src" path="src-model"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.core.runtime.compatibility/.cvsignore b/bundles/org.eclipse.core.runtime.compatibility/.cvsignore
deleted file mode 100644
index ba077a4..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/bundles/org.eclipse.core.runtime.compatibility/.project b/bundles/org.eclipse.core.runtime.compatibility/.project
deleted file mode 100644
index db79de4..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.runtime.compatibility</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.core.runtime.compatibility/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.core.runtime.compatibility/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 88ba90c..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue May 25 14:58:59 EDT 2004
-encoding/<project>=ISO-8859-1
-eclipse.preferences.version=1
diff --git a/bundles/org.eclipse.core.runtime.compatibility/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.runtime.compatibility/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 0fd4287..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,329 +0,0 @@
-#Fri Feb 23 16:59:10 EST 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.builder.cleanOutputFolder=clean
-org.eclipse.jdt.core.builder.duplicateResourceTask=warning
-org.eclipse.jdt.core.builder.invalidClasspath=abort
-org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
-org.eclipse.jdt.core.circularClasspath=error
-org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
-org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=error
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=false
-org.eclipse.jdt.core.formatter.comment.format_comments=false
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=80
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=800
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.incompatibleJDKLevel=ignore
-org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.core.runtime.compatibility/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.core.runtime.compatibility/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index d5e7183..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,9 +0,0 @@
-#Fri Feb 23 16:59:44 EST 2007
-eclipse.preferences.version=1
-formatter_profile=_core
-formatter_settings_version=11
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=;
-org.eclipse.jdt.ui.ondemandthreshold=3
-org.eclipse.jdt.ui.staticondemandthreshold=99
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return Returns the ${bare_field_name}.\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} The ${bare_field_name} to set.\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Copyright (c) ${year} IBM Corporation and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n ******************************************************************************/\r\n</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @since 3.2\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="New classes and interfaces" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) 2006 IBM Corporation and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n *******************************************************************************/\r\n${package_declaration}\r\n\r\n/**\r\n * \r\n */\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block&\#13;\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/bundles/org.eclipse.core.runtime.compatibility/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.runtime.compatibility/META-INF/MANIFEST.MF
deleted file mode 100644
index 04b35e8..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,25 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Version: 3.2.0.qualifier
-Bundle-SymbolicName: org.eclipse.core.runtime.compatibility; singleton:=true
-Bundle-Vendor: %providerName
-Bundle-Activator: org.eclipse.core.internal.plugins.CompatibilityActivator
-Bundle-Localization: plugin
-Export-Package: org.eclipse.core.boot,
- org.eclipse.core.internal.boot;x-internal:=true,
- org.eclipse.core.internal.compatibility;x-internal:=true,
- org.eclipse.core.internal.model;x-internal:=true,
- org.eclipse.core.internal.plugins;x-internal:=true,
- org.eclipse.core.runtime.model
-Require-Bundle:
- org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)";visibility:=reexport,
- org.eclipse.update.configurator;bundle-version="[3.1.100,4.0.0)";visibility:=reexport
-Eclipse-LazyStart: true
-Bundle-RequiredExecutionEnvironment:
- J2SE-1.4,
- CDC-1.0/Foundation-1.0,
- J2SE-1.3
-Import-Package: javax.xml.parsers,
- org.xml.sax,
- org.xml.sax.helpers
diff --git a/bundles/org.eclipse.core.runtime.compatibility/about.html b/bundles/org.eclipse.core.runtime.compatibility/about.html
deleted file mode 100644
index 4602330..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime.compatibility/build.properties b/bundles/org.eclipse.core.runtime.compatibility/build.properties
deleted file mode 100644
index 0cc9206..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/build.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2003, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = .,\
- META-INF/,\
- plugin.properties,\
- about.html
-source.. = src-runtime/, src-boot/, src-model/
-src.includes=about.html
-extra.compatibility.jar = ../org.eclipse.update.configurator/configurator.jar
-extra.prerequisites = org.eclipse.update.configurator
-jre.compilation.profile = J2SE-1.4
diff --git a/bundles/org.eclipse.core.runtime.compatibility/plugin.properties b/bundles/org.eclipse.core.runtime.compatibility/plugin.properties
deleted file mode 100644
index 9ad51ed..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/plugin.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# Copyright (c) 2003, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-pluginName = Core Runtime Plug-in Compatibility
-providerName = Eclipse.org
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/boot/BootLoader.java b/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/boot/BootLoader.java
deleted file mode 100644
index 03be6cc..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/boot/BootLoader.java
+++ /dev/null
@@ -1,651 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.boot;
-
-import java.io.IOException;
-import java.net.URL;
-import org.eclipse.core.internal.boot.PlatformConfiguration;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.update.configurator.IPlatformConfiguration;
-import org.eclipse.update.configurator.IPlatformConfigurationFactory;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-
-/**
- * Special boot loader class for the Eclipse Platform. This class cannot
- * be instantiated; all functionality is provided by static methods.
- * <p>
- * The Eclipse Platform makes heavy use of Java class loaders for
- * loading plug-ins. Even the Platform Core Runtime itself, including
- * the <code>Platform</code> class, needs to be loaded by a special
- * class loader. The upshot is that a client program (such as a Java main
- * program, a servlet) cannot directly reference even the
- * <code>Platform</code> class. Instead, a client must use this
- * loader class for initializing the platform, invoking functionality
- * defined in plug-ins, and shutting down the platform when done.
- * </p>
- *
- * @see Platform
- * @deprecated
- * In Eclipse 3.0 the runtime has been refactored such that the <code>BootLoader</code>
- * class is no longer relevant. Most of the function found on <code>BootLoader</code> is
- * however still supported and has been relocated described in the method comments.
- * <p>
- * This interface must only be used by plug-ins
- * which explicitly require the org.eclipse.core.runtime.compatibility plug-in.
- * </p>
- */
-public final class BootLoader {
-
- /**
- * Controls the debug of platform configuration.
- */
- public static boolean CONFIGURATION_DEBUG = false;
-
- /**
- * The unique identifier constant (value "<code>org.eclipse.core.boot</code>")
- * of the Core Boot (pseudo-) plug-in.
- */
- public static final String PI_BOOT = "org.eclipse.core.boot"; //$NON-NLS-1$
-
- /**
- * Constant string (value "win32") indicating the platform is running on a
- * Window 32-bit operating system (e.g., Windows 98, NT, 2000).
- * @deprecated Replaced by {@link Platform#OS_WIN32}.
- */
- public static final String OS_WIN32 = "win32";//$NON-NLS-1$
-
- /**
- * Constant string (value "linux") indicating the platform is running on a
- * Linux-based operating system.
- * @deprecated Replaced by {@link Platform#OS_LINUX}.
- */
- public static final String OS_LINUX = "linux";//$NON-NLS-1$
-
- /**
- * Constant string (value "aix") indicating the platform is running on an
- * AIX-based operating system.
- * @deprecated Replaced by {@link Platform#OS_AIX}.
- */
- public static final String OS_AIX = "aix";//$NON-NLS-1$
-
- /**
- * Constant string (value "solaris") indicating the platform is running on a
- * Solaris-based operating system.
- * @deprecated Replaced by {@link Platform#OS_SOLARIS}.
- */
- public static final String OS_SOLARIS = "solaris";//$NON-NLS-1$
-
- /**
- * Constant string (value "hpux") indicating the platform is running on an
- * HP/UX-based operating system.
- * @deprecated Replaced by {@link Platform#OS_HPUX}.
- */
- public static final String OS_HPUX = "hpux";//$NON-NLS-1$
-
- /**
- * Constant string (value "qnx") indicating the platform is running on a
- * QNX-based operating system.
- * @deprecated Replaced by {@link Platform#OS_QNX}.
- */
- public static final String OS_QNX = "qnx";//$NON-NLS-1$
-
- /**
- * Constant string (value "macosx") indicating the platform is running on a
- * Mac OS X operating system.
- * @since 2.0
- * @deprecated Replaced by {@link Platform#OS_MACOSX}.
- */
- public static final String OS_MACOSX = "macosx";//$NON-NLS-1$
-
- /**
- * Constant string (value "unknown") indicating the platform is running on a
- * machine running an unknown operating system.
- * @deprecated Replaced by {@link Platform#OS_UNKNOWN}.
- */
- public static final String OS_UNKNOWN = "unknown";//$NON-NLS-1$
-
- /**
- * Constant string (value "x86") indicating the platform is running on an
- * x86-based architecture.
- * @deprecated Replaced by {@link Platform#ARCH_X86}.
- */
- public static final String ARCH_X86 = "x86";//$NON-NLS-1$
-
- /**
- * Constant string (value "PA_RISC") indicating the platform is running on an
- * PA_RISC-based architecture.
- * @deprecated Replaced by {@link Platform#ARCH_PA_RISC}.
- */
- public static final String ARCH_PA_RISC = "PA_RISC";//$NON-NLS-1$
-
- /**
- * Constant string (value "ppc") indicating the platform is running on an
- * PowerPC-based architecture.
- * @since 2.0
- * @deprecated Replaced by {@link Platform#ARCH_PPC}.
- */
- public static final String ARCH_PPC = "ppc";//$NON-NLS-1$
-
- /**
- * Constant string (value "sparc") indicating the platform is running on an
- * Sparc-based architecture.
- * @since 2.0
- * @deprecated Replaced by {@link Platform#ARCH_SPARC}.
- */
- public static final String ARCH_SPARC = "sparc";//$NON-NLS-1$
-
- /**
- * Constant string (value "win32") indicating the platform is running on a
- * machine using the Windows windowing system.
- * @deprecated Replaced by {@link Platform#WS_WIN32}.
- */
- public static final String WS_WIN32 = "win32";//$NON-NLS-1$
-
- /**
- * Constant string (value "motif") indicating the platform is running on a
- * machine using the Motif windowing system.
- * @deprecated Replaced by {@link Platform#WS_MOTIF}.
- */
- public static final String WS_MOTIF = "motif";//$NON-NLS-1$
-
- /**
- * Constant string (value "gtk") indicating the platform is running on a
- * machine using the GTK windowing system.
- * @deprecated Replaced by {@link Platform#WS_GTK}.
- */
- public static final String WS_GTK = "gtk";//$NON-NLS-1$
-
- /**
- * Constant string (value "photon") indicating the platform is running on a
- * machine using the Photon windowing system.
- * @deprecated Replaced by {@link Platform#WS_PHOTON}.
- */
- public static final String WS_PHOTON = "photon";//$NON-NLS-1$
-
- /**
- * Constant string (value "carbon") indicating the platform is running on a
- * machine using the Carbon windowing system (Mac OS X).
- * @since 2.0
- * @deprecated Replaced by {@link Platform#WS_CARBON}.
- */
- public static final String WS_CARBON = "carbon";//$NON-NLS-1$
-
- /**
- * Constant string (value "unknown") indicating the platform is running on a
- * machine running an unknown windowing system.
- * @deprecated Replaced by {@link Platform#WS_UNKNOWN}.
- */
- public static final String WS_UNKNOWN = "unknown";//$NON-NLS-1$
-
- /**
- * Private constructor to block instance creation.
- */
- private BootLoader() {
- // not allowed
- }
-
- /**
- * Returns the command line args provided to the platform when it was first run.
- * Note that individual platform runnables may be provided with different arguments
- * if they are being run individually rather than with <code>Platform.run()</code>.
- *
- * @return the command line used to start the platform
- * @deprecated Replaced by {@link Platform#getCommandLineArgs()}.
- */
- public static String[] getCommandLineArgs() {
- return InternalPlatform.getDefault().getApplicationArgs();
- }
-
- /**
- * Returns the current platform configuration.
- *
- * @return platform configuration used in current instance of platform
- * @since 2.0
- * @deprecated This functionality has moved to the Eclipse Update manager plug-in.
- */
- public static org.eclipse.core.boot.IPlatformConfiguration getCurrentPlatformConfiguration() {
- BundleContext context = InternalPlatform.getDefault().getBundleContext();
- // acquire factory service first
- ServiceReference configFactorySR = context.getServiceReference(IPlatformConfigurationFactory.class.getName());
- if (configFactorySR == null)
- throw new IllegalStateException();
- IPlatformConfigurationFactory configFactory = (IPlatformConfigurationFactory) context.getService(configFactorySR);
- if (configFactory == null)
- throw new IllegalStateException();
- // get the configuration using the factory
- IPlatformConfiguration currentConfig = configFactory.getCurrentPlatformConfiguration();
- context.ungetService(configFactorySR);
- return new PlatformConfiguration(currentConfig);
- }
-
- /**
- * Returns URL at which the Platform runtime executables and libraries are installed.
- * The returned value is distinct from the location of any given platform's data.
- *
- * @return the URL indicating where the platform runtime is installed.
- * @deprecated Use <code>Platform.getInstallLocation().getURL()</code>
- */
- public static URL getInstallURL() {
- return InternalPlatform.getDefault().getInstallURL();
- }
-
- /**
- * Returns the string name of the current locale for use in finding files
- * whose path starts with <code>$nl$</code>.
- *
- * @return the string name of the current locale
- * @deprecated Replaced by {@link Platform#getNL()}.
- */
- public static String getNL() {
- return InternalPlatform.getDefault().getNL();
- }
-
- /**
- * Returns the string name of the current operating system for use in finding
- * files whose path starts with <code>$os$</code>. <code>OS_UNKNOWN</code> is
- * returned if the operating system cannot be determined.
- * The value may indicate one of the operating systems known to the platform
- * (as specified in <code>knownOSValues</code>) or a user-defined string if
- * the operating system name is specified on the command line.
- *
- * @return the string name of the current operating system
- * @see #knownOSValues
- * @deprecated Replaced by {@link Platform#getOS()}.
- */
- public static String getOS() {
- return InternalPlatform.getDefault().getOS();
- }
-
- /**
- * Returns the string name of the current system architecture.
- * The value is a user-defined string if the architecture is
- * specified on the command line, otherwise it is the value
- * returned by <code>java.lang.System.getProperty("os.arch")</code>.
- *
- * @return the string name of the current system architecture
- * @since 2.0
- * @deprecated Replaced by {@link Platform#getOSArch()}.
- */
- public static String getOSArch() {
- return InternalPlatform.getDefault().getOSArch();
- }
-
- /**
- * Returns a platform configuration object, optionally initialized with previously saved
- * configuration information.
- *
- * @param url location of previously save configuration information. If <code>null</code>
- * is specified, an empty configuration object is returned
- * @return platform configuration used in current instance of platform
- * @exception IOException if the configuration cannot be read
- * @since 2.0
- * @deprecated This functionality has moved to the Eclipse Update manager plug-in.
- */
- public static org.eclipse.core.boot.IPlatformConfiguration getPlatformConfiguration(URL url) throws IOException {
- BundleContext context = InternalPlatform.getDefault().getBundleContext();
- // acquire factory service first
- ServiceReference configFactorySR = context.getServiceReference(IPlatformConfigurationFactory.class.getName());
- if (configFactorySR == null)
- throw new IllegalStateException();
- IPlatformConfigurationFactory configFactory = (IPlatformConfigurationFactory) context.getService(configFactorySR);
- if (configFactory == null)
- throw new IllegalStateException();
- // get the configuration using the factory
- IPlatformConfiguration config = configFactory.getPlatformConfiguration(url);
- context.ungetService(configFactorySR);
- return new PlatformConfiguration(config);
- }
-
- /**
- * Returns the string name of the current window system for use in finding files
- * whose path starts with <code>$ws$</code>. <code>null</code> is returned
- * if the window system cannot be determined.
- *
- * @return the string name of the current window system or <code>null</code>
- * @deprecated Replaced by {@link Platform#getWS()}.
- */
- public static String getWS() {
- return InternalPlatform.getDefault().getWS();
- }
-
- /**
- * Returns a list of known system architectures.
- * <p>
- * Note that this list is not authoritative; there may be legal values
- * not included in this list. Indeed, the value returned by
- * <code>getOSArch</code> may not be in this list. Also, this list may
- * change over time as Eclipse comes to run on more operating environments.
- * </p>
- *
- * @return the list of system architectures known to the system
- * @see #getOSArch()
- * @since 2.0
- * @deprecated Replaced by {@link Platform#knownOSArchValues()}.
- */
- public static String[] knownOSArchValues() {
- return Platform.knownOSArchValues();
- }
-
- /**
- * Returns a list of known operating system names.
- * <p>
- * Note that this list is not authoritative; there may be legal values
- * not included in this list. Indeed, the value returned by
- * <code>getOS</code> may not be in this list. Also, this list may
- * change over time as Eclipse comes to run on more operating environments.
- * </p>
- *
- * @return the list of operating systems known to the system
- * @see #getOS()
- * @since 2.0
- * @deprecated Replaced by {@link Platform#knownOSValues()}.
- */
- public static String[] knownOSValues() {
- return Platform.knownOSValues();
- }
-
- /**
- * Returns a list of known windowing system names.
- * <p>
- * Note that this list is not authoritative; there may be legal values
- * not included in this list. Indeed, the value returned by
- * <code>getWS</code> may not be in this list. Also, this list may
- * change over time as Eclipse comes to run on more operating environments.
- * </p>
- *
- * @return the list of window systems known to the system
- * @see #getWS()
- * @since 2.0
- * @deprecated Replaced by {@link Platform#knownWSValues()}.
- */
- public static String[] knownWSValues() {
- return Platform.knownWSValues();
- }
-
- /**
- * Returns <code>true</code> if the platform is currently running in
- * debug mode. The platform is run
- * in debug mode using the "-debug" command line argument.
- *
- * @return whether or not the platform is running in debug mode
- * @deprecated Replaced by {@link Platform#inDebugMode()}.
- */
- public static boolean inDebugMode() {
- return Platform.inDebugMode();
- }
-
- /**
- * Returns <code>true</code> if the platform is currently running in
- * development mode. That is, if special procedures are to be
- * taken when defining plug-in class paths. The platform is run
- * in development mode using the "-dev" command line argument.
- *
- * @return whether or not the platform is running in development mode
- * @deprecated Replaced by {@link Platform#inDevelopmentMode()}.
- */
- public static boolean inDevelopmentMode() {
- return Platform.inDevelopmentMode();
- }
-
- /**
- * Returns whether the platform is running.
- *
- * @return <code>true</code> if the platform is running,
- * and <code>false</code> otherwise
- * @deprecated Replaced by {@link Platform#isRunning()}.
- */
- public static boolean isRunning() {
- return InternalPlatform.getDefault().isRunning();
- }
-
- /**
- * Returns the complete plugin path defined by the file at the given location.
- * If the given location is <code>null</code> or does not indicate a valid
- * plug-in path definition file, <code>null</code> is returned.
- *
- * @param pluginPathLocation the location of the plug-in path to load
- * @return the complete set of URLs which locate plug-ins
- * @deprecated This functionality has moved to the Eclipse Update manager plug-in.
- */
- public static URL[] getPluginPath(URL pluginPathLocation) {
- return InternalPlatform.getDefault().getPluginPath(pluginPathLocation);
- }
-
- /**
- * Returns whether the given location (typically a directory in the
- * local file system) contains the saved data for a platform. The
- * saved data for the platform is recognizable by the presence of
- * a special platform metadata subdirectory; however, this metadata
- * directory is not usually created unless there is some reason to do so
- * (for example, so that an active plug-in can save its state).
- *
- * @return <code>true</code> if the location contains the
- * saved data for a platform, and <code>false</code> otherwise
- * @deprecated In Eclipse 3.0 this method is no longer supported.
- * The implementation always returns <code>true</code>.
- */
- public static boolean containsSavedPlatform(String location) {
- return true;
- }
-
- /**
- * Instantiates and returns an instance of the named application's
- * runnable entry point.
- * <code>null</code> is returned if the runnable cannot be found.
- *
- * @param applicationName the fully qualified name of an
- * extension installed in the platform's <code>applications</code>
- * extension point (i.e., <code>org.eclipse.core.applications</code>).
- * @return a platform runnable
- * @exception Exception if there is a problem instantiating the specified runnable
- * @deprecated In Eclipse 3.0 this method is no longer supported.
- * The implementation always returns <code>null</code>. See the related but
- * non-API methods on <code>org.eclipse.core.runtime.adaptor.EclipseStarter</code>
- * in the org.eclipse.osgi plug-in.
- */
- public static IPlatformRunnable getRunnable(String applicationName) throws Exception {
- return null;
- }
- /**
- * Instantiates and returns an instance of the named class. The class
- * must implement <code>IPlatformRunnable</code>.
- * If the class implements <code>IExecutableExtension</code>, the created
- * instance is initialized with the given arguments.
- * <code>null</code> is returned if the runnable cannot be found.
- *
- * @param pluginId the unique identifier of the plug-in containing the given class
- * @param className the fully qualified name of the class to instantiate
- * @param args the initialization arguments passed to the new instance
- * @return a platform runnable, or <code>null</code> if the runnable cannot
- * be found
- * @exception Exception if there is a problem instantiating the specified runnable
- * @deprecated In Eclipse 3.0 this method is no longer supported.
- * The implementation always returns <code>null</code>. See the related but
- * non-API methods on <code>org.eclipse.core.runtime.adaptor.EclipseStarter</code>
- * in the org.eclipse.osgi plug-in.
- */
- public static IPlatformRunnable getRunnable(String pluginId, String className, Object args) throws Exception {
- return null;
- }
-
- /**
- * Launches the Platform to run a single application.
- * This convenince method starts up the Platform,
- * runs the indicated application, and then shuts down
- * the Platform. The Platform must not be running already.
- *
- * @param applicationName The fully qualified name of an
- * extension installed in the Platform plug-in's <code>applications</code>
- * extension-point (i.e., <code>org.eclipse.core.runtime.applications</code>).
- * @param pluginPathLocation the URL of the plug-in path; this is where
- * the Platform is to find the code for plug-ins
- * @param location the location (usually a string path in the local file
- * file system) for the saved platform state
- * @param args the array of command-line style argments which are passed
- * to the Platform on initialization. The arguments which are consumed by the
- * Platform's initialization are removed from the arg list. This modified arg list is
- * the return value of this method.
- *@return the list of <code>args</code> which were supplied but not consumed
- * by this method.
- * @return the result, or <code>null</code> if none
- * @exception Exception if anything goes wrong
- * @see #startup
- * @deprecated In Eclipse 3.0 this method is no longer supported.
- * The implementation always returns <code>null</code>. See the related but
- * non-API methods on <code>org.eclipse.core.runtime.adaptor.EclipseStarter</code>
- * in the org.eclipse.osgi plug-in.
- */
- public static Object run(String applicationName, URL pluginPathLocation, String location, String[] args) throws Exception {
- return null;
- }
- /**
- * Launches the Platform to run a single application.
- * This convenince method starts up the Platform,
- * runs the indicated application, and then shuts down
- * the Platform. The Platform must not be running already.
- *
- * @param applicationName The fully qualified name of an
- * extension installed in the Platform plug-in's <code>applications</code>
- * extension-point (i.e., <code>org.eclipse.core.runtime.applications</code>).
- * @param pluginPathLocation the URL of the plug-in path; this is where
- * the Platform is to find the code for plug-ins
- * @param location the location (usually a string path in the local file
- * file system) for the saved platform state
- * @param args the array of command-line style argments which are passed
- * to the Platform on initialization. The arguments which are consumed by the
- * Platform's initialization are removed from the arg list. This modified arg list is
- * the return value of this method.
- * @param handler an optional handler invoked by the launched application
- * at the point the application considers itself initialized. A typical
- * use for the handler would be to take down any splash screen
- * that was displayed by the caller of this method.
- *@return the list of <code>args</code> which were supplied but not consumed
- * by this method.
- * @return the result, or <code>null</code> if none
- * @exception Exception if anything goes wrong
- * @see #startup
- * @deprecated In Eclipse 3.0 this method is no longer supported.
- * The implementation always returns <code>null</code>. See the related but
- * non-API methods on <code>org.eclipse.core.runtime.adaptor.EclipseStarter</code>
- * in the org.eclipse.osgi plug-in.
- */
- public static Object run(String applicationName, URL pluginPathLocation, String location, String[] args, Runnable handler) throws Exception {
- return null;
- }
- /**
- * Shuts down the Platform. The Platform must be running. In the process,
- * each active plug-in is told to shutdown via <code>Plugin.shutdown</code>.
- * <p>
- * Note that the state of the Platform is not automatically saved
- * before shutting down.
- * </p>
- * <p>
- * On return, the Platform will no longer be running (but could
- * be re-launched with another call to <code>startup</code>).
- * Any objects handed out by running Platform, including
- * Platform runnables obtained via <code>getRunnable</code>,
- * will be permanently invalid. The effects of attempting to invoke
- * methods on invalid objects is undefined.
- * </p>
- * @exception Exception if there were problems shutting down
- * @deprecated In Eclipse 3.0 this method is no longer supported.
- * The implementation does nothing. See the related but
- * non-API methods on <code>org.eclipse.core.runtime.adaptor.EclipseStarter</code>
- * in the org.eclipse.osgi plug-in.
- */
- public static void shutdown() throws Exception {
- }
- /**
- * Launches the Eclipse Platform. The Platform must not be running.
- * <p>
- * The location of the started Platform is defined as follows:
- * <ul>
- * <li>If the <code>location</code> argument is specified, that value is used.
- * <li>If <code>location</code> is <code>null</code> but <code>args</code>
- * contains a <code>-data<location></code> pair, then the given value is used.
- * <li> If neither is specified, <code>System.getProperty("user.dir")</code> is used.
- * </ul>
- * The plug-in path of the started Platform is defined as follows:
- * <ul>
- * <li>If the <code>pluginPathLocation</code> argument is specified, that value is tried.
- * <li>If <code>pluginPathLocation</code> is <code>null</code> but <code>args</code>
- * contains a <code>-plugins <location></code> pair, then the given value is tried.
- * <li>If neither value is specified or a given location does not exist,
- * the Platform's location is searched.
- * <li>Finally, the default plug-in path is used. This value identifies the plug-ins in the
- * Platform's install location.
- * </ul>
- * @param pluginPathLocation the URL of the plug-in path; this is where
- * the Platform is to find the code for plug-ins
- * @param location the location (usually a string path in the local file
- * file system) for the saved Platform state
- * @param args the array of command-line style argments which are passed
- * to the platform on initialization. The arguments which are consumed by the
- * Platform's initialization are removed from the arg list. This modified arg list is
- * the return value of this method.
- * @return the list of <code>args</code> which were supplied but not consumed
- * by this method.
- * @exception Exception if there are problems starting the platform
- * @deprecated In Eclipse 3.0 this method is no longer supported.
- * The implementation always returns <code>null</code>. See the related but
- * non-API methods on <code>org.eclipse.core.runtime.adaptor.EclipseStarter</code>
- * in the org.eclipse.osgi plug-in.
- */
- public static String[] startup(URL pluginPathLocation, String location, String[] args) throws Exception {
- return null;
- }
- /**
- * Launches the Eclipse Platform. The Platform must not be running.
- * <p>
- * The location of the started Platform is defined as follows:
- * <ul>
- * <li>If the <code>location</code> argument is specified, that value is used.
- * <li>If <code>location</code> is <code>null</code> but <code>args</code>
- * contains a <code>-data <location></code> pair, then the given value is used.
- * <li> If neither is specified, <code>System.getProperty("user.dir")</code> is used.
- * </ul>
- * The plug-in path of the started Platform is defined as follows:
- * <ul>
- * <li>If the <code>pluginPathLocation</code> argument is specified, that value is tried.
- * <li>If <code>pluginPathLocation</code> is <code>null</code> but <code>args</code>
- * contains a <code>-plugins <location></code> pair, then the given value is tried.
- * <li>If neither value is specified or a given location does not exist,
- * the Platform's location is searched.
- * <li>Finally, the default plug-in path is used. This value identifies the plug-ins in the
- * Platform's install location.
- * </ul>
- * @param pluginPathLocation the URL of the plug-in path; this is where
- * the Platform is to find the code for plug-ins
- * @param location the location (usually a string path in the local file
- * file system) for the saved Platform state
- * @param args the array of command-line style argments which are passed
- * to the platform on initialization. The arguments which are consumed by the
- * Platform's initialization are removed from the arg list. This modified arg list is
- * the return value of this method.
- * @param handler an optional handler invoked by the launched application
- * at the point the application considers itself initialized. A typical
- * use for the handler would be to take down any splash screen
- * that was displayed by the caller of this method.
- * @return the list of <code>args</code> which were supplied but not consumed
- * by this method.
- * @exception Exception if there are problems starting the platform
- * @deprecated In Eclipse 3.0 this method is no longer supported.
- * The implementation always returns <code>null</code>. See the related but
- * non-API methods on <code>org.eclipse.core.runtime.adaptor.EclipseStarter</code>
- * in the org.eclipse.osgi plug-in.
- */
- public static String[] startup(URL pluginPathLocation, String location, String[] args, Runnable handler) throws Exception {
- return null;
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/boot/IPlatformConfiguration.java b/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/boot/IPlatformConfiguration.java
deleted file mode 100644
index 0598663..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/boot/IPlatformConfiguration.java
+++ /dev/null
@@ -1,575 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.boot;
-
-import java.io.IOException;
-import java.net.URL;
-
-/**
- * Platform configuration interface. Represents the runtime
- * configuration used by the Eclipse platform. Any configuration
- * changes do not take effect until next startup of the Eclipse
- * platform
- *
- * @since 2.0
- * @deprecated
- * In Eclipse 3.0 the Update mechanism was cleanly separated from the runtime.
- * <code>IPlatformConfiguration</code> is part of the Update story and as such has
- * been moved to {@link org.eclipse.update.configurator.IPlatformConfiguration} in the
- * <code>org.eclipse.update.configurator</code> plug-in.
- * <p>
- * This interface must only be used by plug-ins
- * which explicitly require the org.eclipse.core.runtime.compatibility plug-in.
- * </p>
- */
-public interface IPlatformConfiguration {
-
- /**
- * Configuration entry representing an install site.
- *
- * @since 2.0
- */
- public interface ISiteEntry {
-
- /**
- * Returns the URL for this site
- *
- * @return site url
- * @since 2.0
- */
- public URL getURL();
-
- /**
- * Returns the policy for this site
- *
- * @return site policy
- * @since 2.0
- */
- public ISitePolicy getSitePolicy();
-
- /**
- * Sets the site policy
- *
- * @param policy site policy
- * @since 2.0
- */
- public void setSitePolicy(ISitePolicy policy);
-
- /**
- * Returns a list of features visible on the site. Note, that this is simply a
- * reflection of the site content. The features may or may not be actually configured.
- *
- * @return an array of feature entries, or an empty array if no features are found.
- * A feature entry is returned as a path relative to the site URL
- * @since 2.0
- */
- public String[] getFeatures();
-
- /**
- * Returns a list of plug-ins visible on the site. Note, that this is simply a
- * reflection of the site content and the current policy for the site. The plug-ins
- * may or may not end up being used by Eclipse (depends on which plug-in are
- * actually bound by the platform).
- *
- * @return an array of plug-in entries, or an empty array if no plug-ins are found.
- * A plug-in entry is returned as a path relative to the site URL *
- * @since 2.0
- */
- public String[] getPlugins();
-
- /**
- * Returns a stamp reflecting the current state of the site. If called repeatedly,
- * returns the same value as long as no changes were made to the site (changes to
- * features or plugins).
- *
- * @return site change stamp
- * @since 2.0
- */
- public long getChangeStamp();
-
- /**
- * Returns a stamp reflecting the current state of the features on the site.
- * If called repeatedly, returns the same value as long as no changes were made to
- * features on the site.
- *
- * @return site features change stamp
- * @since 2.0
- */
- public long getFeaturesChangeStamp();
-
- /**
- * Returns a stamp reflecting the current state of the plug-ins on the site.
- * If called repeatedly, returns the same value as long as no changes were made to
- * plug-ins on the site.
- *
- * @return site plug-ins change stamp
- * @since 2.0
- */
- public long getPluginsChangeStamp();
-
- /**
- * Returns an indication whether the site can be updated.
- *
- * @return <code>true</code> if site can be updated, <code>false</code> otherwise
- * @since 2.0
- */
- public boolean isUpdateable();
-
- /**
- * Returns an indication whether the site represents an install site
- * that has been linked via a native installer (using the links/<linkfile>
- * mechanism)
- *
- * @return <code>true</code> if the site is linked, <code>false</code> otherwise
- * @since 2.0
- */
- public boolean isNativelyLinked();
- }
-
- /**
- * Site policy. The site policy object determines how plug-ins
- * contained on the site are processed during startup. In general,
- * there are 3 ways of configuring a site policy
- * <ul>
- * <li>explicitly specify which plug-ins are to be included at
- * startup (type==USER_INCLUDE). Any other plug-ins located
- * at the site are ignored at startup. This is typically the best
- * policy when using remote sites where the user wishes
- * to retain explicit control over the plug-ins that are included
- * from such site.
- * <li>explicitly specify which plug-ins are to be excluded at
- * startup (type==USER-EXCLUDE). All other plug-ins located
- * at the site are used at startup. This policy requires that
- * the site support an access "protocol" that allows plug-in
- * discovery. In general, these are sites defined using the "file"
- * URL protocol. This is typically the best policy for local
- * install sites (on the user system).
- * </ul>
- *
- * @since 2.0
- */
- public interface ISitePolicy extends org.eclipse.update.configurator.IPlatformConfiguration.ISitePolicy {
-
- /**
- * Policy type constants.
- */
-
- /**
- * User-defined inclusion list. The list associated with this
- * policy type is interpreted as path entries to included plugin.xml
- * or fragment.xml <b>relative</b> to the site URL
- */
- public static final int USER_INCLUDE = 0;
-
- /**
- * User-defined exclusion list. The list associated with this
- * policy type is interpreted as path entries to excluded plugin.xml
- * or fragment.xml <b>relative</b> to the site URL
- */
- public static final int USER_EXCLUDE = 1;
-
- /**
- * Return policy type
- *
- * @return policy type
- * @since 2.0
- */
- public int getType();
-
- /**
- * Return policy inclusion/ exclusion list
- *
- * @return the list as an array
- * @since 2.0
- */
- public String[] getList();
-
- /**
- * Set new policy list. The list entries are interpreted based on the policy
- * type. See description of the policy type constants for details.
- *
- * @param list policy inclusion/ exclusion list as an array.
- * Returns an empty array if there are no entries.
- * @see #USER_INCLUDE
- * @see #USER_EXCLUDE
- * @since 2.0
- */
- public void setList(String[] list);
- }
-
- /**
- * Feature entry.
- * Represents runtime "hints" about configured features.
- * The information is used during execution to locate the
- * correct attribution information for a feature. Note,
- * that a typical configuration can declare multiple feature
- * entries. At execution time, only one can be selected as
- * the active primary feature. This is determined based on
- * specified command line arguments or computed defaults.
- *
- * @since 2.0
- */
- public interface IFeatureEntry {
-
- /**
- * Returns feature identifier.
- * @return feature identifier
- * @since 2.0
- */
- public String getFeatureIdentifier();
-
- /**
- * Returns the currently configured version for the feature.
- * @return feature version (as string), or <code>null</code>
- * @since 2.0
- */
- public String getFeatureVersion();
-
- /**
- * Returns the identifier of the feature plug-in for this feature entry.
- * Note, that there is no guarantee that a feature in fact
- * supplies a corresponding feature plugin, so the result can be
- * <code>null</code>. Also, if supplied, there is no guarantee that the
- * plugin will in fact be loaded into the plug-in registry at runtime
- * (due to rules and constraint checking performed by the registry
- * loading support). Consequently code making use of this method must
- * handle these conditions.
- * @return feature identifier (as string), or <code>null</code>
- * @since 2.1
- */
- public String getFeaturePluginIdentifier();
-
- /**
- * Returns the version of the feature plug-in for this feature
- * entry. Note, that there is no guarantee that a feature in fact
- * supplies a corresponding feature plugin, so the result can be
- * <code>null</code>. Also, if supplied, there is no guarantee that the
- * plugin will in fact be loaded into the plug-in registry at runtime
- * (due to rules and constraint checking performed by the registry
- * loading support). Consequently code making use of this method must
- * handle these conditions.
- * @return feature version (as string), or <code>null</code>
- * @since 2.0
- */
- public String getFeaturePluginVersion();
-
- /**
- * Returns the application to run when this feature is the
- * primary feature.
- * @return application identifier, or <code>null</code>
- * @since 2.0
- */
- public String getFeatureApplication();
-
- /**
- * Returns URLs to the feature "root" locations. The root
- * URLs are install locations of the feature plugin and its
- * fragments.
- *
- * @return array of URLs, or an empty array
- * @since 2.0
- */
- public URL[] getFeatureRootURLs();
-
- /**
- * Returns an indication whether this feature has been defined
- * to act as a primary feature.
- * @return <code>true</code> if the feature can be primary,
- * <code>false</code> otherwise.
- * @since 2.0
- */
- public boolean canBePrimary();
- }
-
- /**
- * Create a site entry
- *
- * @param url site URL
- * @param policy site policy
- * @return created site entry
- * @since 2.0
- */
- public ISiteEntry createSiteEntry(URL url, ISitePolicy policy);
-
- /**
- * Create a site policy. The policy determines the way the site
- * plug-in are processed at startpu
- *
- * @param type policy type
- * @param list an array of site-relative paths representing the
- * inclusion/ exclusion list
- * @return created site policy entry
- * @since 2.0
- */
- public ISitePolicy createSitePolicy(int type, String[] list);
-
- /**
- * Create a feature entry
- * @param id feature identifier. Must not be <code>null</code>.
- * @param version feature version (as String). Can be <code>null</code>.
- * @param pluginVersion version of the feature plugin (as String). Can be
- * <code>null</code>.
- * @param primary <code>true</code> if the feature is defined as a primary
- * feature, otherwise <code>false</code>.
- * @param application identifier of the application to run when
- * this feature is the primary feature. Can be <code>null</code>.
- * If specified, the identifier must represent a valid extension
- * registered in the <code>org.eclipse.core.runtime.applications</code>
- * extension point.
- * @param an array of URLs to feature root directories.
- * These are URLs to install locations for the feature plugin
- * and its fragments. Can be <code>null</code>.
- * @return create feature entry
- * @since 2.0
- */
- public IFeatureEntry createFeatureEntry(String id, String version, String pluginVersion, boolean primary, String application, URL[] root);
-
- /**
- * Create a feature entry
- * @param id feature identifier. Must not be <code>null</code>.
- * @param version feature version (as String). Can be <code>null</code>.
- * @param pluginIdentifier identifier of the feature plugin (as String). Can
- * be <code>null</code>.
- * @param pluginVersion version of the feature plugin (as String). Can be
- * <code>null</code>.
- * @param primary <code>true</code> if the feature is defined as a primary
- * feature, otherwise <code>false</code>.
- * @param application identifier of the application to run when
- * this feature is the primary feature. Can be <code>null</code>.
- * If specified, the identifier must represent a valid extension
- * registered in the <code>org.eclipse.core.runtime.applications</code>
- * extension point.
- * @param an array of URLs to feature root directories.
- * These are URLs to install locations for the feature plugin
- * and its fragments. Can be <code>null</code>.
- * @return create feature entry
- * @since 2.1
- */
- public IFeatureEntry createFeatureEntry(String id, String version, String pluginIdentifier, String pluginVersion, boolean primary, String application, URL[] root);
-
- /**
- * Configures the specified site entry. If a site entry with the
- * same site URL is already configured, the entry is <b>not</b> replaced.
- *
- * @param entry site entry
- * @since 2.0
- */
- public void configureSite(ISiteEntry entry);
-
- /**
- * Configures the specified site entry. If a site entry with the
- * same site URL is already configured, the replacement behavior for
- * the entry can be specified.
- *
- * @param entry site entry
- * @param flag indicating whether an existing configured entry with
- * the same URL should be replaced (<code>true</code>) or not (<code>false</code>).
- * @since 2.0
- */
- public void configureSite(ISiteEntry entry, boolean replace);
-
- /**
- * Unconfigures the specified entry. Does not do anything if the entry
- * is not configured.
- *
- * @param entry site entry
- * @since 2.0
- */
- public void unconfigureSite(ISiteEntry entry);
-
- /**
- * Returns configured site entries
- *
- * @return array of site entries. Returns an empty array if no sites are
- * configured
- * @since 2.0
- */
- public ISiteEntry[] getConfiguredSites();
-
- /**
- * Returns a site entry matching the specified URL
- *
- * @param url site url
- * @return matching site entry, or <code>null</code> if no match found
- * @since 2.0
- */
- public ISiteEntry findConfiguredSite(URL url);
-
- /**
- * Configures the feature entry.
- * If another feature entry with the same feature identifier
- * already exists, it is replaced.
- * @param entry feature entry
- * @since 2.0
- */
- public void configureFeatureEntry(IFeatureEntry entry);
-
- /**
- * Unconfigures the specified feature entry if it exists.
- * @param entry feature entry
- * @since 2.0
- */
- public void unconfigureFeatureEntry(IFeatureEntry entry);
-
- /**
- * Returns a list of configured feature entries.
- * @return array or entries, or an empty array if no entries
- * are configured
- * @since 2.0
- */
- public IFeatureEntry[] getConfiguredFeatureEntries();
-
- /**
- * Locates the specified feature entry.
- * @param id feature identifier
- * @return ferature entry, or <code>null</code>.
- * @since 2.0
- */
- public IFeatureEntry findConfiguredFeatureEntry(String id);
-
- /**
- * Returns the URL location of the configuration information
- *
- * @return configuration location URL, or <code>null</code> if the
- * configuration location could not be determined.
- * @since 2.0
- */
- public URL getConfigurationLocation();
-
- /**
- * Returns a stamp reflecting the current state of the configuration. If called repeatedly,
- * returns the same value as long as no changes were made to the configuration (changes to
- * sites, features or plugins).
- *
- * @return configuration change stamp
- * @since 2.0
- */
- public long getChangeStamp();
-
- /**
- * Returns a stamp reflecting the current state of the features in the configuration.
- * If called repeatedly, returns the same value as long as no changes were made to
- * features in the configuration.
- *
- * @return configuration features change stamp
- * @since 2.0
- */
- public long getFeaturesChangeStamp();
-
- /**
- * Returns a stamp reflecting the current state of the plug-ins in the configuration.
- * If called repeatedly, returns the same value as long as no changes were made to
- * plug-ins in the configuration.
- *
- * @return configuration plug-ins change stamp
- * @since 2.0
- */
- public long getPluginsChangeStamp();
-
- /**
- * Returns the identifier of the configured primary feature. A primary feature
- * is used to specify product customization information for a running instance
- * of Eclipse.
- *
- * @return primary feature identifier, or <code>null</code> if none configured
- * @since 2.0
- */
- public String getPrimaryFeatureIdentifier();
-
- /**
- * Computes the plug-in path for this configuration. The result includes all plug-ins
- * visible on each of the configured sites based on each site policy.
- *
- * @return an array of plug-in path elements (full URL entries), or an empty array.
- * @since 2.0
- */
- public URL[] getPluginPath();
-
- /**
- * Returns an array of bootstrap plugin identifiers whose
- * location needs to be explicitly identified in the configuration.
- *
- * @return an array of identifiers, or empty array
- * otherwise
- * @since 2.0
- */
- public String[] getBootstrapPluginIdentifiers();
-
- /**
- * Sets the location of a bootstrap plugin.
- *
- * @see IPlatformConfiguration#getBootstrapPluginIdentifiers()
- * @param id plugin identifier. Must match one of the entries returned
- * by getBootstrapPluginIdentifiers()
- * @param location
- * @since 2.0
- */
- public void setBootstrapPluginLocation(String id, URL location);
-
- /**
- * Returns an indication whether the configuration can be updated.
- *
- * @return <code>true</code> if configuration can be updated, <code>false</code>
- * otherwise
- * @since 2.0
- */
- public boolean isUpdateable();
-
- /**
- * Returns an indication whether the configuration is transient. A transient
- * configuration typically represents a scenario where the configuration
- * was computed for a single instantiation of the platform and is not
- * guaranteed to be valid on subsequent instantiations.
- *
- * @return <code>true</code> if configuration is transient, <code>false</code>
- * otherwise
- * @since 2.0
- */
- public boolean isTransient();
-
- /**
- * Indicates whether the configuration is transient or not. A transient
- * configuration typically represents a scenario where the configuration
- * was computed for a single instantiation of the platform and is not
- * guaranteed to be valid on subsequent instantiations. This method has
- * no effect if called on the current platform configuration.
- *
- * @see BootLoader#getCurrentPlatformConfiguration()
- * @param value <code>true</code> if configuration is transient, <code>false</code>
- * otherwise
- * @since 2.0
- */
- public void isTransient(boolean value);
-
- /**
- * Called to refresh the configuration information. In particular,
- * causes change stamps to be recomputed based on the current
- * configuration state, and updates the lists of available plug-ins.
- * @since 2.0
- */
- public void refresh();
-
- /**
- * Called to save the configuration information
- * @since 2.0
- */
- public void save() throws IOException;
-
- /**
- * Called to save the configuration information in the
- * specified location
- *
- * @param url save location.
- * @since 2.0
- */
- public void save(URL url) throws IOException;
-
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/boot/IPlatformRunnable.java b/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/boot/IPlatformRunnable.java
deleted file mode 100644
index 21a5c31..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/boot/IPlatformRunnable.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.boot;
-
-/**
- * Bootstrap type for the platform. Platform runnables represent executable
- * entry points into plug-ins. Runnables can be configured into the Platform's
- * <code>org.eclipse.core.runtime.applications</code> extension-point
- * or be made available through code or extensions on other plug-in's extension-points.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @deprecated In Eclipse 3.0 the boot plug-in and packages were deprecated.
- * This class has been replaced by an equivalent class in the org.eclipse.core.runtime package.
- *
- * @see org.eclipse.core.runtime.IPlatformRunnable
- */
-
-public interface IPlatformRunnable extends org.eclipse.core.runtime.IPlatformRunnable {
-
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/FeatureEntry.java b/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/FeatureEntry.java
deleted file mode 100644
index 1c9025a..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/FeatureEntry.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.boot;
-
-import java.net.URL;
-import org.eclipse.core.boot.IPlatformConfiguration.IFeatureEntry;
-import org.eclipse.update.configurator.IPlatformConfiguration;
-
-public class FeatureEntry implements IFeatureEntry {
- private IPlatformConfiguration.IFeatureEntry newFeatureEntry;
-
- public FeatureEntry(IPlatformConfiguration.IFeatureEntry fe) {
- newFeatureEntry = fe;
- }
-
- public String getFeatureIdentifier() {
- return newFeatureEntry.getFeatureIdentifier();
- }
-
- public String getFeatureVersion() {
- return newFeatureEntry.getFeatureVersion();
- }
-
- public String getFeaturePluginIdentifier() {
- return newFeatureEntry.getFeaturePluginIdentifier();
- }
-
- public String getFeaturePluginVersion() {
- return newFeatureEntry.getFeaturePluginVersion();
- }
-
- public String getFeatureApplication() {
- return newFeatureEntry.getFeatureApplication();
- }
-
- public URL[] getFeatureRootURLs() {
- return newFeatureEntry.getFeatureRootURLs();
- }
-
- public boolean canBePrimary() {
- return newFeatureEntry.canBePrimary();
- }
-
- public IPlatformConfiguration.IFeatureEntry getNewFeatureEntry() {
- return newFeatureEntry;
- }
-
- public boolean equals(Object o) {
- if (o instanceof FeatureEntry) {
- return newFeatureEntry.equals(((FeatureEntry) o).newFeatureEntry);
- }
- return false;
- }
-
- public int hashCode() {
- return newFeatureEntry.hashCode();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/PlatformConfiguration.java b/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/PlatformConfiguration.java
deleted file mode 100644
index 72508be..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/PlatformConfiguration.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.boot;
-
-import java.io.IOException;
-import java.net.URL;
-import org.eclipse.core.boot.IPlatformConfiguration;
-
-public class PlatformConfiguration implements IPlatformConfiguration {
- private org.eclipse.update.configurator.IPlatformConfiguration newConfig;
-
- public PlatformConfiguration(org.eclipse.update.configurator.IPlatformConfiguration config) {
- newConfig = config;
- }
-
- public ISiteEntry createSiteEntry(URL url, ISitePolicy policy) {
- return new SiteEntry(newConfig.createSiteEntry(url, ((SitePolicy) policy).getNewPolicy()));
- }
-
- public ISitePolicy createSitePolicy(int type, String[] list) {
- return new SitePolicy(newConfig.createSitePolicy(type, list));
- }
-
- public IFeatureEntry createFeatureEntry(String id, String version, String pluginVersion, boolean primary, String application, URL[] root) {
- return new FeatureEntry(newConfig.createFeatureEntry(id, version, pluginVersion, primary, application, root));
- }
-
- public IFeatureEntry createFeatureEntry(String id, String version, String pluginIdentifier, String pluginVersion, boolean primary, String application, URL[] root) {
- return new FeatureEntry(newConfig.createFeatureEntry(id, version, pluginIdentifier, pluginVersion, primary, application, root));
- }
-
- public void configureSite(ISiteEntry entry) {
- newConfig.configureSite(((SiteEntry) entry).getNewSiteEntry());
- }
-
- public void configureSite(ISiteEntry entry, boolean replace) {
- newConfig.configureSite(((SiteEntry) entry).getNewSiteEntry(), replace);
- }
-
- public void unconfigureSite(ISiteEntry entry) {
- newConfig.unconfigureSite(((SiteEntry) entry).getNewSiteEntry());
- }
-
- public ISiteEntry[] getConfiguredSites() {
- org.eclipse.update.configurator.IPlatformConfiguration.ISiteEntry[] sites = newConfig.getConfiguredSites();
- SiteEntry[] oldSites = new SiteEntry[sites.length];
- for (int i = 0; i < sites.length; i++)
- oldSites[i] = new SiteEntry(sites[i]);
- return oldSites;
- }
-
- public ISiteEntry findConfiguredSite(URL url) {
- org.eclipse.update.configurator.IPlatformConfiguration.ISiteEntry siteEntry = newConfig.findConfiguredSite(url);
- if (siteEntry == null)
- return null;
- return new SiteEntry(siteEntry);
- }
-
- public void configureFeatureEntry(IFeatureEntry entry) {
- newConfig.configureFeatureEntry(((FeatureEntry) entry).getNewFeatureEntry());
- }
-
- public void unconfigureFeatureEntry(IFeatureEntry entry) {
- newConfig.unconfigureFeatureEntry(((FeatureEntry) entry).getNewFeatureEntry());
- }
-
- public IFeatureEntry[] getConfiguredFeatureEntries() {
- org.eclipse.update.configurator.IPlatformConfiguration.IFeatureEntry[] entries = newConfig.getConfiguredFeatureEntries();
- FeatureEntry[] oldEntries = new FeatureEntry[entries.length];
- for (int i = 0; i < entries.length; i++)
- oldEntries[i] = new FeatureEntry(entries[i]);
- return oldEntries;
- }
-
- public IFeatureEntry findConfiguredFeatureEntry(String id) {
- return new FeatureEntry(newConfig.findConfiguredFeatureEntry(id));
- }
-
- public URL getConfigurationLocation() {
- return newConfig.getConfigurationLocation();
- }
-
- public long getChangeStamp() {
- return newConfig.getChangeStamp();
- }
-
- public long getFeaturesChangeStamp() {
- return newConfig.getFeaturesChangeStamp();
- }
-
- public long getPluginsChangeStamp() {
- return newConfig.getPluginsChangeStamp();
- }
-
- public String getPrimaryFeatureIdentifier() {
- return newConfig.getPrimaryFeatureIdentifier();
- }
-
- public URL[] getPluginPath() {
- return newConfig.getPluginPath();
- }
-
- public String[] getBootstrapPluginIdentifiers() {
- return newConfig.getBootstrapPluginIdentifiers();
- }
-
- public void setBootstrapPluginLocation(String id, URL location) {
- newConfig.setBootstrapPluginLocation(id, location);
- }
-
- public boolean isUpdateable() {
- return newConfig.isUpdateable();
- }
-
- public boolean isTransient() {
- return newConfig.isTransient();
- }
-
- public void isTransient(boolean value) {
- newConfig.isTransient(value);
- }
-
- public void refresh() {
- newConfig.refresh();
- }
-
- public void save() throws IOException {
- newConfig.save();
- }
-
- public void save(URL url) throws IOException {
- newConfig.save(url);
- }
-
- public boolean equals(Object o) {
- if (o instanceof PlatformConfiguration)
- return newConfig.equals(((PlatformConfiguration) o).newConfig);
- return false;
- }
-
- public int hashCode() {
- return newConfig.hashCode();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/SiteEntry.java b/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/SiteEntry.java
deleted file mode 100644
index 8ef7cbe..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/SiteEntry.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.boot;
-
-import java.net.URL;
-import org.eclipse.core.boot.IPlatformConfiguration.ISiteEntry;
-import org.eclipse.core.boot.IPlatformConfiguration.ISitePolicy;
-import org.eclipse.update.configurator.IPlatformConfiguration;
-
-public class SiteEntry implements ISiteEntry {
- private org.eclipse.update.configurator.IPlatformConfiguration.ISiteEntry newSiteEntry;
-
- public SiteEntry(IPlatformConfiguration.ISiteEntry entry) {
- newSiteEntry = entry;
- }
-
- public URL getURL() {
- return newSiteEntry.getURL();
- }
-
- public ISitePolicy getSitePolicy() {
- return new SitePolicy(newSiteEntry.getSitePolicy());
- }
-
- public void setSitePolicy(ISitePolicy policy) {
- newSiteEntry.setSitePolicy(((SitePolicy) policy).getNewPolicy());
- }
-
- public String[] getFeatures() {
- return newSiteEntry.getFeatures();
- }
-
- public String[] getPlugins() {
- return newSiteEntry.getPlugins();
- }
-
- public long getChangeStamp() {
- return newSiteEntry.getChangeStamp();
- }
-
- public long getFeaturesChangeStamp() {
- return newSiteEntry.getFeaturesChangeStamp();
- }
-
- public long getPluginsChangeStamp() {
- return newSiteEntry.getPluginsChangeStamp();
- }
-
- public boolean isUpdateable() {
- return newSiteEntry.isUpdateable();
- }
-
- public boolean isNativelyLinked() {
- return newSiteEntry.isNativelyLinked();
- }
-
- public org.eclipse.update.configurator.IPlatformConfiguration.ISiteEntry getNewSiteEntry() {
- return newSiteEntry;
- }
-
- public boolean equals(Object o) {
- if (o instanceof SiteEntry)
- return newSiteEntry.equals(((SiteEntry) o).newSiteEntry);
- return false;
- }
-
- public int hashCode() {
- return newSiteEntry.hashCode();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/SitePolicy.java b/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/SitePolicy.java
deleted file mode 100644
index b7b54e9..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-boot/org/eclipse/core/internal/boot/SitePolicy.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.boot;
-
-import org.eclipse.core.boot.IPlatformConfiguration.ISitePolicy;
-import org.eclipse.update.configurator.IPlatformConfiguration;
-
-public class SitePolicy implements ISitePolicy {
- private IPlatformConfiguration.ISitePolicy newPolicy;
-
- public SitePolicy(IPlatformConfiguration.ISitePolicy policy) {
- newPolicy = policy;
- }
-
- public int getType() {
- return newPolicy.getType();
- }
-
- public String[] getList() {
- return newPolicy.getList();
- }
-
- public void setList(String[] list) {
- newPolicy.setList(list);
- }
-
- public IPlatformConfiguration.ISitePolicy getNewPolicy() {
- return newPolicy;
- }
-
- public boolean equals(Object o) {
- if (o instanceof SitePolicy)
- return newPolicy.equals(((SitePolicy) o).newPolicy);
- return false;
- }
-
- public int hashCode() {
- return newPolicy.hashCode();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/IModel.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/IModel.java
deleted file mode 100644
index 955438d..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/IModel.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.core.internal.model;
-
-public interface IModel {
-
- public static final int INDENT = 2;
- public static final int RADIX = 36;
-
- public static final String TRUE = "true"; //$NON-NLS-1$
- public static final String FALSE = "false"; //$NON-NLS-1$
-
- public static final String REGISTRY = "plugin-registry"; //$NON-NLS-1$
- public static final String REGISTRY_PATH = "path"; //$NON-NLS-1$
-
- public static final String FRAGMENT = "fragment"; //$NON-NLS-1$
- public static final String FRAGMENT_ID = "id"; //$NON-NLS-1$
- public static final String FRAGMENT_NAME = "name"; //$NON-NLS-1$
- public static final String FRAGMENT_PROVIDER = "provider-name"; //$NON-NLS-1$
- public static final String FRAGMENT_VERSION = "version"; //$NON-NLS-1$
- public static final String FRAGMENT_PLUGIN_ID = "plugin-id"; //$NON-NLS-1$
- public static final String FRAGMENT_PLUGIN_VERSION = "plugin-version"; //$NON-NLS-1$
- public static final String FRAGMENT_PLUGIN_MATCH = "match"; //$NON-NLS-1$
- public static final String FRAGMENT_PLUGIN_MATCH_PERFECT = "perfect"; //$NON-NLS-1$
- public static final String FRAGMENT_PLUGIN_MATCH_EQUIVALENT = "equivalent"; //$NON-NLS-1$
- public static final String FRAGMENT_PLUGIN_MATCH_COMPATIBLE = "compatible"; //$NON-NLS-1$
- public static final String FRAGMENT_PLUGIN_MATCH_GREATER_OR_EQUAL = "greaterOrEqual"; //$NON-NLS-1$
-
- public static final String PLUGIN = "plugin"; //$NON-NLS-1$
- public static final String PLUGIN_ID = "id"; //$NON-NLS-1$
- public static final String PLUGIN_NAME = "name"; //$NON-NLS-1$
- public static final String PLUGIN_VENDOR = "vendor-name"; //$NON-NLS-1$
- public static final String PLUGIN_PROVIDER = "provider-name"; //$NON-NLS-1$
- public static final String PLUGIN_VERSION = "version"; //$NON-NLS-1$
- public static final String PLUGIN_CLASS = "class"; //$NON-NLS-1$
-
- public static final String PLUGIN_REQUIRES = "requires"; //$NON-NLS-1$
- public static final String PLUGIN_REQUIRES_PLATFORM = "platform-version"; //$NON-NLS-1$
- public static final String PLUGIN_REQUIRES_PLUGIN = "plugin"; //$NON-NLS-1$
- public static final String PLUGIN_REQUIRES_PLUGIN_VERSION = "version"; //$NON-NLS-1$
- public static final String PLUGIN_REQUIRES_OPTIONAL = "optional"; //$NON-NLS-1$
- public static final String PLUGIN_REQUIRES_IMPORT = "import"; //$NON-NLS-1$
- public static final String PLUGIN_REQUIRES_EXPORT = "export"; //$NON-NLS-1$
- public static final String PLUGIN_REQUIRES_MATCH = "match"; //$NON-NLS-1$
- public static final String PLUGIN_REQUIRES_MATCH_EXACT = "exact"; //$NON-NLS-1$
- public static final String PLUGIN_REQUIRES_MATCH_PERFECT = "perfect"; //$NON-NLS-1$
- public static final String PLUGIN_REQUIRES_MATCH_EQUIVALENT = "equivalent"; //$NON-NLS-1$
- public static final String PLUGIN_REQUIRES_MATCH_COMPATIBLE = "compatible"; //$NON-NLS-1$
- public static final String PLUGIN_REQUIRES_MATCH_GREATER_OR_EQUAL = "greaterOrEqual"; //$NON-NLS-1$
-
- public static final String PLUGIN_KEY_VERSION_SEPARATOR = "_"; //$NON-NLS-1$
-
- public static final String RUNTIME = "runtime"; //$NON-NLS-1$
-
- public static final String LIBRARY = "library"; //$NON-NLS-1$
- public static final String LIBRARY_NAME = "name"; //$NON-NLS-1$
- public static final String LIBRARY_SOURCE = "source"; //$NON-NLS-1$
- public static final String LIBRARY_TYPE = "type"; //$NON-NLS-1$
- public static final String LIBRARY_EXPORT = "export"; //$NON-NLS-1$
- public static final String LIBRARY_EXPORT_MASK = "name"; //$NON-NLS-1$
- public static final String LIBRARY_PACKAGES = "packages"; //$NON-NLS-1$
- public static final String LIBRARY_PACKAGES_PREFIXES = "prefixes"; //$NON-NLS-1$
-
- public static final String EXTENSION_POINT = "extension-point"; //$NON-NLS-1$
- public static final String EXTENSION_POINT_NAME = "name"; //$NON-NLS-1$
- public static final String EXTENSION_POINT_ID = "id"; //$NON-NLS-1$
- public static final String EXTENSION_POINT_SCHEMA = "schema"; //$NON-NLS-1$
-
- public static final String EXTENSION = "extension"; //$NON-NLS-1$
- public static final String EXTENSION_NAME = "name"; //$NON-NLS-1$
- public static final String EXTENSION_ID = "id"; //$NON-NLS-1$
- public static final String EXTENSION_TARGET = "point"; //$NON-NLS-1$
-
- public static final String ELEMENT = "element"; //$NON-NLS-1$
- public static final String ELEMENT_NAME = "name"; //$NON-NLS-1$
- public static final String ELEMENT_VALUE = "value"; //$NON-NLS-1$
-
- public static final String PROPERTY = "property"; //$NON-NLS-1$
- public static final String PROPERTY_NAME = "name"; //$NON-NLS-1$
- public static final String PROPERTY_VALUE = "value"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/PluginMap.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/PluginMap.java
deleted file mode 100644
index 0dfd04b..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/PluginMap.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.model;
-
-import java.util.*;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.PluginVersionIdentifier;
-import org.eclipse.core.runtime.model.PluginModel;
-
-/**
- * A map specialized to manage plugin models (either for plugins or fragments).
- */
-public class PluginMap {
- private Map map;
- private boolean preserveOrder;
- private int size;
- private boolean replaceDuplicates;
-
- public PluginMap(Map pluginModels) {
- this(pluginModels, true, false);
- }
-
- public PluginMap(Map pluginModels, boolean preserveOrder, boolean replaceDuplicates) {
- this.map = pluginModels;
- this.preserveOrder = preserveOrder;
- this.replaceDuplicates = replaceDuplicates;
- }
-
- public void add(PluginModel pluginModel) {
-
- String key = pluginModel.getId();
- List verList = (List) map.get(key);
-
- // create new index entry if one does not exist for plugin
- if (verList == null) {
- verList = new LinkedList();
- map.put(key, verList);
- }
-
- int i = 0;
- // insert plugin into list maintaining version order
- if (preserveOrder)
- for (; i < verList.size(); i++) {
- PluginModel element = (PluginModel) verList.get(i);
- if (getVersionIdentifier(pluginModel).equals(getVersionIdentifier(element))) {
- if (replaceDuplicates)
- verList.set(i, pluginModel);
- return; // ignore duplicates
- }
- if (getVersionIdentifier(pluginModel).isGreaterThan(getVersionIdentifier(element)))
- break;
- }
- verList.add(i, pluginModel);
- size++;
- }
-
- public PluginModel get(String id, String version) {
- List versions = (List) map.get(id);
- if (versions == null || versions.isEmpty())
- return null;
- if (version == null)
- // Just return the first one in the list (random)
- return (PluginModel) versions.get(0);
- int versionCount = versions.size();
- for (int i = 0; i < versionCount; i++) {
- PluginModel pluginModel = (PluginModel) versions.get(i);
- if (pluginModel.getVersion().equals(version))
- return pluginModel;
- }
- return null;
- }
-
- public List getVersions(String id) {
- return (List) map.get(id);
- }
-
- public PluginModel getAny(String id) {
- List versions = (List) map.get(id);
- if (versions == null || versions.isEmpty())
- return null;
- return (PluginModel) versions.get(0);
- }
-
- private PluginVersionIdentifier getVersionIdentifier(PluginModel model) {
- if (PluginVersionIdentifier.validateVersion(model.getVersion()).getSeverity() != IStatus.OK)
- return new PluginVersionIdentifier("0.0.0"); //$NON-NLS-1$
- return new PluginVersionIdentifier(model.getVersion());
- }
-
- public int size() {
- return size;
- }
-
- public void markReadOnly() {
- for (Iterator it = map.values().iterator(); it.hasNext();) {
- List list = (List) it.next();
- int count = list.size();
- for (int i = 0; i < count; i++)
- ((PluginModel) list.get(i)).markReadOnly();
- }
- }
-
- public PluginModel remove(String pluginId, String version) {
- List versions = (List) map.get(pluginId);
- if (versions == null)
- return null;
- for (Iterator iter = versions.iterator(); iter.hasNext();) {
- PluginModel pluginModel = (PluginModel) iter.next();
- if (pluginModel.getId().equals(pluginId) && pluginModel.getVersion().equals(version)) {
- if (versions.size() == 1)
- map.remove(pluginId);
- else
- iter.remove();
- size--;
- return pluginModel;
- }
- }
- return null;
- }
-
- public void removeVersions(String pluginId) {
- List versions = (List) map.remove(pluginId);
- if (versions != null)
- size -= versions.size();
- }
-
- public void copyToArray(Object[] array) {
- int index = 0;
- for (Iterator mapIter = map.values().iterator(); mapIter.hasNext();) {
- List versions = (List) mapIter.next();
- for (Iterator listIiter = versions.iterator(); listIiter.hasNext();)
- array[index++] = listIiter.next();
- }
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/PluginParser.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/PluginParser.java
deleted file mode 100644
index e98d7cc..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/PluginParser.java
+++ /dev/null
@@ -1,795 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.core.internal.model;
-
-import java.util.*;
-import javax.xml.parsers.SAXParserFactory;
-import org.eclipse.core.internal.runtime.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.model.*;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.ServiceReference;
-import org.xml.sax.*;
-import org.xml.sax.helpers.DefaultHandler;
-
-public class PluginParser extends DefaultHandler implements IModel {
-
- // concrete object factory
- Factory factory;
-
- // File name for this plugin or fragment
- // This to help with error reporting
- String locationName = null;
-
- // Current State Information
- Stack stateStack = new Stack();
-
- // Current object stack (used to hold the current object we are
- // populating in this plugin descriptor
- Stack objectStack = new Stack();
-
- Locator locator = null;
-
- // Valid States
- private static final int IGNORED_ELEMENT_STATE = 0;
- private static final int INITIAL_STATE = 1;
- private static final int PLUGIN_STATE = 2;
- private static final int PLUGIN_RUNTIME_STATE = 3;
- private static final int PLUGIN_REQUIRES_STATE = 4;
- private static final int PLUGIN_EXTENSION_POINT_STATE = 5;
- private static final int PLUGIN_EXTENSION_STATE = 6;
- private static final int RUNTIME_LIBRARY_STATE = 7;
- private static final int LIBRARY_EXPORT_STATE = 8;
-// private static final int LIBRARY_PACKAGES_STATE = 12;
- private static final int PLUGIN_REQUIRES_IMPORT_STATE = 9;
- private static final int CONFIGURATION_ELEMENT_STATE = 10;
- private static final int FRAGMENT_STATE = 11;
-
- // Keep a group of vectors as a temporary scratch space. These
- // vectors will be used to populate arrays in the plugin descriptor
- // once processing of the XML file is complete.
- private static final int EXTENSION_POINT_INDEX = 0;
- private static final int EXTENSION_INDEX = 1;
- private static final int LAST_INDEX = 1;
- private Vector scratchVectors[] = new Vector[LAST_INDEX + 1];
-
- private ServiceReference parserReference;
-
- public PluginParser(Factory factory) {
- super();
- this.factory = factory;
- }
-
- /**
- * Receive a Locator object for document events.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass if they wish to store the locator for use
- * with other document events.</p>
- *
- * @param locator A locator for all SAX document events.
- * @see org.xml.sax.ContentHandler#setDocumentLocator
- * @see org.xml.sax.Locator
- */
- public void setDocumentLocator(Locator locator) {
- this.locator = locator;
- }
-
- public void characters(char[] ch, int start, int length) {
- int state = ((Integer) stateStack.peek()).intValue();
- if (state != CONFIGURATION_ELEMENT_STATE)
- return;
- if (state == CONFIGURATION_ELEMENT_STATE) {
- // Accept character data within an element, is when it is
- // part of a configuration element (i.e. an element within an EXTENSION element
- ConfigurationElementModel currentConfigElement = (ConfigurationElementModel) objectStack.peek();
- String value = new String(ch, start, length);
- String oldValue = currentConfigElement.getValueAsIs();
- if (oldValue == null) {
- if (value.trim().length() != 0)
- currentConfigElement.setValue(value);
- } else {
- currentConfigElement.setValue(oldValue + value);
- }
- }
- }
-
- public void endDocument() {
- }
-
- public void endElement(String uri, String elementName, String qName) {
- switch (((Integer) stateStack.peek()).intValue()) {
- case IGNORED_ELEMENT_STATE :
- stateStack.pop();
- break;
- case INITIAL_STATE :
- // shouldn't get here
- internalError(NLS.bind(Messages.parse_internalStack, elementName));
- break;
- case PLUGIN_STATE :
- case FRAGMENT_STATE :
- if (elementName.equals(PLUGIN) || elementName.equals(FRAGMENT)) {
- stateStack.pop();
- PluginModel root = (PluginModel) objectStack.peek();
-
- // Put the extension points into this plugin
- Vector extPointVector = scratchVectors[EXTENSION_POINT_INDEX];
- if (extPointVector.size() > 0) {
- root.setDeclaredExtensionPoints((ExtensionPointModel[]) extPointVector.toArray(new ExtensionPointModel[extPointVector.size()]));
- scratchVectors[EXTENSION_POINT_INDEX].removeAllElements();
- }
-
- // Put the extensions into this plugin too
- Vector extVector = scratchVectors[EXTENSION_INDEX];
- if (extVector.size() > 0) {
- root.setDeclaredExtensions((ExtensionModel[]) extVector.toArray(new ExtensionModel[extVector.size()]));
- scratchVectors[EXTENSION_INDEX].removeAllElements();
- }
- }
- break;
- case PLUGIN_RUNTIME_STATE :
- if (elementName.equals(RUNTIME)) {
- stateStack.pop();
- // take the vector of library entries and put them into the plugin
- // descriptor
- Vector libVector = (Vector) objectStack.pop();
- if (libVector.size() > 0) {
- PluginModel model = (PluginModel) objectStack.peek();
- model.setRuntime((LibraryModel[]) libVector.toArray(new LibraryModel[libVector.size()]));
- }
- }
- break;
- case PLUGIN_REQUIRES_STATE :
- if (elementName.equals(PLUGIN_REQUIRES)) {
- stateStack.pop();
- // take the vector of prerequisites and put them into the plugin
- // descriptor
- Vector importVector = (Vector) objectStack.pop();
- if (importVector.size() > 0) {
- PluginModel parentDescriptor = (PluginModel) objectStack.peek();
- parentDescriptor.setRequires((PluginPrerequisiteModel[]) importVector.toArray(new PluginPrerequisiteModel[importVector.size()]));
- }
- }
- break;
- case PLUGIN_EXTENSION_POINT_STATE :
- if (elementName.equals(EXTENSION_POINT)) {
- stateStack.pop();
- }
- break;
- case PLUGIN_EXTENSION_STATE :
- if (elementName.equals(EXTENSION)) {
- stateStack.pop();
- // Finish up extension object
- ExtensionModel currentExtension = (ExtensionModel) objectStack.pop();
- PluginModel parent = (PluginModel) objectStack.peek();
- currentExtension.setParent(parent);
- scratchVectors[EXTENSION_INDEX].addElement(currentExtension);
- }
- break;
- case RUNTIME_LIBRARY_STATE :
- if (elementName.equals(LIBRARY)) {
- LibraryModel curLibrary = (LibraryModel) objectStack.pop();
- // Clean up the exports for this library entry
- Vector exportsVector = (Vector) objectStack.pop();
- if (exportsVector.size() > 0) {
- curLibrary.setExports((String[]) exportsVector.toArray(new String[exportsVector.size()]));
- }
-
- // Add this library element to the vector "runtime" on the stack
- Vector libraryVector = (Vector) objectStack.peek();
- libraryVector.addElement(curLibrary);
- stateStack.pop();
- }
- break;
- case LIBRARY_EXPORT_STATE :
- if (elementName.equals(LIBRARY_EXPORT)) {
- stateStack.pop();
- }
- break;
- case PLUGIN_REQUIRES_IMPORT_STATE :
- if (elementName.equals(PLUGIN_REQUIRES_IMPORT)) {
- stateStack.pop();
- }
- break;
- case CONFIGURATION_ELEMENT_STATE :
- // We don't care what the element name was
- stateStack.pop();
- // Now finish up the configuration element object
- ConfigurationElementModel currentConfigElement = (ConfigurationElementModel) objectStack.pop();
-
- String value = currentConfigElement.getValueAsIs();
- if (value != null) {
- currentConfigElement.setValue(value.trim());
- }
-
- Object parent = objectStack.peek();
- currentConfigElement.setParent(parent);
- if (((Integer) stateStack.peek()).intValue() == PLUGIN_EXTENSION_STATE) {
- // Want to add this configuration element to the subelements of an extension
- ConfigurationElementModel[] oldValues = (ConfigurationElementModel[]) ((ExtensionModel) parent).getSubElements();
- int size = (oldValues == null) ? 0 : oldValues.length;
- ConfigurationElementModel[] newValues = new ConfigurationElementModel[size + 1];
- for (int i = 0; i < size; i++) {
- newValues[i] = oldValues[i];
- }
- newValues[size] = currentConfigElement;
- ((ExtensionModel) parent).setSubElements(newValues);
- } else {
- ConfigurationElementModel[] oldValues = (ConfigurationElementModel[]) ((ConfigurationElementModel) parent).getSubElements();
- int size = (oldValues == null) ? 0 : oldValues.length;
- ConfigurationElementModel[] newValues = new ConfigurationElementModel[size + 1];
- for (int i = 0; i < size; i++) {
- newValues[i] = oldValues[i];
- }
- newValues[size] = currentConfigElement;
- ((ConfigurationElementModel) parent).setSubElements(newValues);
- }
- break;
- }
- }
-
- public void error(SAXParseException ex) {
- logStatus(ex);
- }
-
- public void fatalError(SAXParseException ex) throws SAXException {
- logStatus(ex);
- throw ex;
- }
-
- public void handleExtensionPointState(String elementName, Attributes attributes) {
-
- // We ignore all elements under extension points (if there are any)
- stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
- internalError(NLS.bind(Messages.parse_unknownElement, EXTENSION_POINT, elementName));
- }
-
- public void handleExtensionState(String elementName, Attributes attributes) {
-
- // You need to change the state here even though we will be executing the same
- // code for ExtensionState and ConfigurationElementState. We ignore the name
- // of the element for ConfigurationElements. When we are wrapping up, we will
- // want to add each configuration element object to the subElements vector of
- // its parent configuration element object. However, the first configuration
- // element object we created (the last one we pop off the stack) will need to
- // be added to a vector in the extension object called _configuration.
- stateStack.push(new Integer(CONFIGURATION_ELEMENT_STATE));
-
- // create a new Configuration Element and push it onto the object stack
- ConfigurationElementModel currentConfigurationElement = factory.createConfigurationElement();
- objectStack.push(currentConfigurationElement);
- currentConfigurationElement.setName(elementName);
-
- // Processing the attributes of a configuration element involves creating
- // a new configuration property for each attribute and populating the configuration
- // property with the name/value pair of the attribute. Note there will be one
- // configuration property for each attribute
- parseConfigurationElementAttributes(attributes);
- }
-
- public void handleInitialState(String elementName, Attributes attributes) {
- if (elementName.equals(PLUGIN)) {
- stateStack.push(new Integer(PLUGIN_STATE));
- parsePluginAttributes(attributes);
- } else if (elementName.equals(FRAGMENT)) {
- stateStack.push(new Integer(FRAGMENT_STATE));
- parseFragmentAttributes(attributes);
- } else {
- stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
- internalError(NLS.bind(Messages.parse_unknownTopElement, elementName));
- }
- }
-
- public void handleLibraryExportState(String elementName, Attributes attributes) {
-
- // All elements ignored.
- stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
- internalError(NLS.bind(Messages.parse_unknownElement, LIBRARY_EXPORT, elementName));
- }
-
- public void handleLibraryState(String elementName, Attributes attributes) {
- if (elementName.equals(LIBRARY_EXPORT)) {
- // Change State
- stateStack.push(new Integer(LIBRARY_EXPORT_STATE));
- // The top element on the stack much be a library element
- LibraryModel currentLib = (LibraryModel) objectStack.peek();
-
- if (attributes == null)
- return;
-
- String maskValue = null;
-
- // Process Attributes
- int len = attributes.getLength();
- for (int i = 0; i < len; i++) {
- String attrName = attributes.getLocalName(i);
- String attrValue = attributes.getValue(i).trim();
-
- if (attrName.equals(LIBRARY_EXPORT_MASK))
- maskValue = attrValue;
- else
- internalError(NLS.bind(Messages.parse_unknownAttribute, LIBRARY, attrName));
- }
-
- // set up mask tables
- // pop off the library - already in currentLib
- objectStack.pop();
- Vector exportMask = (Vector) objectStack.peek();
- // push library back on
- objectStack.push(currentLib);
- if ((maskValue != null) && (!exportMask.contains(maskValue)))
- exportMask.addElement(maskValue);
- return;
- }
-
- if (elementName.equals(LIBRARY_PACKAGES)) {
- LibraryModel currentLib = (LibraryModel) objectStack.peek();
- if (attributes == null)
- return;
- for (int i = 0; i < attributes.getLength(); i++) {
- if (LIBRARY_PACKAGES_PREFIXES.equals(attributes.getLocalName(i))) {
- String line = attributes.getValue(i);
- String[] prefixes = getArrayFromList(line);
- currentLib.setPackagePrefixes(prefixes);
- }
- }
- return;
- }
-
- // Any other element is invalid
- stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
- internalError(NLS.bind(Messages.parse_unknownElement, LIBRARY, elementName));
- return;
- }
-
- /**
- * convert a list of comma-separated tokens into an array
- */
- protected static String[] getArrayFromList(String line) {
- if (line == null || line.trim().length() == 0)
- return null;
- Vector list = new Vector();
- StringTokenizer tokens = new StringTokenizer(line, ","); //$NON-NLS-1$
- while (tokens.hasMoreTokens()) {
- String token = tokens.nextToken().trim();
- if (token.length() != 0)
- list.addElement(token);
- }
- return list.isEmpty() ? null : (String[]) list.toArray(new String[0]);
- }
-
- public void handlePluginState(String elementName, Attributes attributes) {
-
- if (elementName.equals(RUNTIME)) {
- // We should only have one Runtime element in a plugin or fragment
- Object whatIsIt = objectStack.peek();
- if (((whatIsIt instanceof PluginDescriptorModel) && (((PluginDescriptorModel) objectStack.peek()).getRuntime() != null)) || ((whatIsIt instanceof PluginFragmentModel) && (((PluginFragmentModel) objectStack.peek()).getRuntime() != null))) {
- // This is at least the 2nd Runtime element we have
- // hit. Ignore it and give an error.
- stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
- return;
- }
- stateStack.push(new Integer(PLUGIN_RUNTIME_STATE));
- // Push a new vector to hold all the library entries
- objectStack.push(new Vector());
- return;
- }
- if (elementName.equals(PLUGIN_REQUIRES)) {
- stateStack.push(new Integer(PLUGIN_REQUIRES_STATE));
- // Push a new vector to hold all the prerequisites
- objectStack.push(new Vector());
- parseRequiresAttributes(attributes);
- return;
- }
- if (elementName.equals(EXTENSION_POINT)) {
- stateStack.push(new Integer(PLUGIN_EXTENSION_POINT_STATE));
- parseExtensionPointAttributes(attributes);
- return;
- }
- if (elementName.equals(EXTENSION)) {
- stateStack.push(new Integer(PLUGIN_EXTENSION_STATE));
- parseExtensionAttributes(attributes);
- return;
- }
-
- // If we get to this point, the element name is one we don't currently accept.
- // Set the state to indicate that this element will be ignored
- stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
- internalError(NLS.bind(Messages.parse_unknownElement, PLUGIN + " / " + FRAGMENT, elementName)); //$NON-NLS-1$
- }
-
- public void handleRequiresImportState(String elementName, Attributes attributes) {
-
- // All elements ignored.
- stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
- internalError(NLS.bind(Messages.parse_unknownElement, PLUGIN_REQUIRES_IMPORT, elementName));
- }
-
- public void handleRequiresState(String elementName, Attributes attributes) {
-
- if (elementName.equals(PLUGIN_REQUIRES_IMPORT)) {
- parsePluginRequiresImport(attributes);
- return;
- }
- // If we get to this point, the element name is one we don't currently accept.
- // Set the state to indicate that this element will be ignored
- stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
- internalError(NLS.bind(Messages.parse_unknownElement, PLUGIN_REQUIRES, elementName));
- }
-
- public void handleRuntimeState(String elementName, Attributes attributes) {
-
- if (elementName.equals(LIBRARY)) {
- // Change State
- stateStack.push(new Integer(RUNTIME_LIBRARY_STATE));
- // Process library attributes
- parseLibraryAttributes(attributes);
- return;
- }
- // If we get to this point, the element name is one we don't currently accept.
- // Set the state to indicate that this element will be ignored
- stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
- internalError(NLS.bind(Messages.parse_unknownElement, RUNTIME, elementName));
- }
-
- public void ignoreableWhitespace(char[] ch, int start, int length) {
- }
-
- private void logStatus(SAXParseException ex) {
- String name = ex.getSystemId();
- if (name == null)
- name = locationName;
- if (name == null)
- name = ""; //$NON-NLS-1$
- else
- name = name.substring(1 + name.lastIndexOf("/")); //$NON-NLS-1$
-
- String msg;
- if (name.equals("")) //$NON-NLS-1$
- msg = NLS.bind(Messages.parse_error, ex.getMessage());
- else
- msg = NLS.bind(Messages.parse_errorNameLineColumn, (new String[] {name, Integer.toString(ex.getLineNumber()), Integer.toString(ex.getColumnNumber()), ex.getMessage()}));
- factory.error(new Status(IStatus.WARNING, Platform.PI_RUNTIME, Platform.PARSE_PROBLEM, msg, ex));
- }
-
- synchronized public PluginModel parsePlugin(InputSource in) throws Exception {
- SAXParserFactory factory = acquireXMLParsing();
- if (factory == null)
- return null; // TODO we log an error
-
- try {
- locationName = in.getSystemId();
- factory.setNamespaceAware(true);
- factory.setNamespaceAware(true);
- try {
- factory.setFeature("http://xml.org/sax/features/string-interning", true); //$NON-NLS-1$
- } catch (SAXException se) {
- // ignore; we can still operate without string-interning
- }
- factory.setValidating(false);
- factory.newSAXParser().parse(in, this);
- return (PluginModel) objectStack.pop();
- } finally {
- releaseXMLParsing();
- }
- }
-
- private SAXParserFactory acquireXMLParsing() {
- parserReference = InternalPlatform.getDefault().getBundleContext().getServiceReference("javax.xml.parsers.SAXParserFactory"); //$NON-NLS-1$
- if (parserReference == null)
- return null;
- return (SAXParserFactory) InternalPlatform.getDefault().getBundleContext().getService(parserReference);
- }
-
- private void releaseXMLParsing() {
- if (parserReference != null)
- InternalPlatform.getDefault().getBundleContext().ungetService(parserReference);
- }
-
- public void parseConfigurationElementAttributes(Attributes attributes) {
-
- ConfigurationElementModel parentConfigurationElement = (ConfigurationElementModel) objectStack.peek();
- parentConfigurationElement.setStartLine(locator.getLineNumber());
-
- Vector propVector = null;
-
- // process attributes
- int len = (attributes != null) ? attributes.getLength() : 0;
- if (len == 0)
- return;
- propVector = new Vector();
-
- for (int i = 0; i < len; i++) {
- String attrName = attributes.getLocalName(i);
- String attrValue = attributes.getValue(i);
-
- ConfigurationPropertyModel currentConfigurationProperty = factory.createConfigurationProperty();
- currentConfigurationProperty.setName(attrName);
- currentConfigurationProperty.setValue(attrValue);
- propVector.addElement(currentConfigurationProperty);
- }
- parentConfigurationElement.setProperties((ConfigurationPropertyModel[]) propVector.toArray(new ConfigurationPropertyModel[propVector.size()]));
- propVector = null;
- }
-
- public void parseExtensionAttributes(Attributes attributes) {
-
- PluginModel parent = (PluginModel) objectStack.peek();
- ExtensionModel currentExtension = factory.createExtension();
- currentExtension.setStartLine(locator.getLineNumber());
- objectStack.push(currentExtension);
-
- // Process Attributes
- int len = (attributes != null) ? attributes.getLength() : 0;
- for (int i = 0; i < len; i++) {
- String attrName = attributes.getLocalName(i);
- String attrValue = attributes.getValue(i).trim();
-
- if (attrName.equals(EXTENSION_NAME))
- currentExtension.setName(attrValue);
- else if (attrName.equals(EXTENSION_ID))
- currentExtension.setId(attrValue);
- else if (attrName.equals(EXTENSION_TARGET)) {
- // check if point is specified as a simple or qualified name
- String targetName;
- if (attrValue.lastIndexOf('.') == -1) {
- String baseId = parent instanceof PluginDescriptorModel ? parent.getId() : ((PluginFragmentModel) parent).getPlugin();
- targetName = baseId + "." + attrValue; //$NON-NLS-1$
- } else
- targetName = attrValue;
- currentExtension.setExtensionPoint(targetName);
- } else
- internalError(NLS.bind(Messages.parse_unknownAttribute, EXTENSION, attrName));
- }
- }
-
- public void parseExtensionPointAttributes(Attributes attributes) {
-
- ExtensionPointModel currentExtPoint = factory.createExtensionPoint();
- currentExtPoint.setStartLine(locator.getLineNumber());
-
- // Process Attributes
- int len = (attributes != null) ? attributes.getLength() : 0;
- for (int i = 0; i < len; i++) {
- String attrName = attributes.getLocalName(i);
- String attrValue = attributes.getValue(i).trim();
-
- if (attrName.equals(EXTENSION_POINT_NAME))
- currentExtPoint.setName(attrValue);
- else if (attrName.equals(EXTENSION_POINT_ID))
- currentExtPoint.setId(attrValue);
- else if (attrName.equals(EXTENSION_POINT_SCHEMA))
- currentExtPoint.setSchema(attrValue);
- else
- internalError(NLS.bind(Messages.parse_unknownAttribute, EXTENSION_POINT, attrName));
- }
- // currentExtPoint contains a pointer to the parent plugin descriptor.
- PluginModel root = (PluginModel) objectStack.peek();
- currentExtPoint.setParent(root);
-
- // Now populate the vector just below us on the objectStack with this extension point
- scratchVectors[EXTENSION_POINT_INDEX].addElement(currentExtPoint);
- }
-
- public void parseFragmentAttributes(Attributes attributes) {
- PluginFragmentModel current = factory.createPluginFragment();
- current.setStartLine(locator.getLineNumber());
- objectStack.push(current);
-
- // process attributes
- int len = attributes.getLength();
- for (int i = 0; i < len; i++) {
- String attrName = attributes.getLocalName(i);
- String attrValue = attributes.getValue(i).trim();
-
- if (attrName.equals(FRAGMENT_ID))
- current.setId(attrValue);
- else if (attrName.equals(FRAGMENT_NAME))
- current.setName(attrValue);
- else if (attrName.equals(FRAGMENT_VERSION))
- current.setVersion(attrValue);
- else if (attrName.equals(FRAGMENT_PROVIDER))
- current.setProviderName(attrValue);
- else if (attrName.equals(FRAGMENT_PLUGIN_ID))
- current.setPlugin(attrValue);
- else if (attrName.equals(FRAGMENT_PLUGIN_VERSION))
- current.setPluginVersion(attrValue);
- else if (attrName.equals(FRAGMENT_PLUGIN_MATCH)) {
- if (FRAGMENT_PLUGIN_MATCH_PERFECT.equals(attrValue))
- current.setMatch(PluginFragmentModel.FRAGMENT_MATCH_PERFECT);
- else if (FRAGMENT_PLUGIN_MATCH_EQUIVALENT.equals(attrValue))
- current.setMatch(PluginFragmentModel.FRAGMENT_MATCH_EQUIVALENT);
- else if (FRAGMENT_PLUGIN_MATCH_COMPATIBLE.equals(attrValue))
- current.setMatch(PluginFragmentModel.FRAGMENT_MATCH_COMPATIBLE);
- else if (FRAGMENT_PLUGIN_MATCH_GREATER_OR_EQUAL.equals(attrValue))
- current.setMatch(PluginFragmentModel.FRAGMENT_MATCH_GREATER_OR_EQUAL);
- else
- internalError(NLS.bind(Messages.parse_validMatch, attrValue));
- } else
- internalError(NLS.bind(Messages.parse_unknownAttribute, FRAGMENT, attrName));
- }
- }
-
- public void parseLibraryAttributes(Attributes attributes) {
- // Push a vector to hold the export mask
- objectStack.push(new Vector());
- LibraryModel current = factory.createLibrary();
- current.setStartLine(locator.getLineNumber());
- objectStack.push(current);
-
- // Now the objectStack should contain the following:
- // plugin descriptor or fragment (bottom of the stack)
- // vector to hold all the library entries
- // vector to hold the export mask for this library entry
- // this library entry (top of the stack)
-
- // process attributes
- int len = (attributes != null) ? attributes.getLength() : 0;
- for (int i = 0; i < len; i++) {
- String attrName = attributes.getLocalName(i);
- String attrValue = attributes.getValue(i).trim();
-
- if (attrName.equals(LIBRARY_NAME))
- current.setName(attrValue);
- else if (attrName.equals(LIBRARY_TYPE)) {
- attrValue = attrValue.toLowerCase();
- if (attrValue.equals(LibraryModel.CODE) || attrValue.equals(LibraryModel.RESOURCE))
- current.setType(attrValue.toLowerCase());
- else
- internalError(NLS.bind(Messages.parse_unknownLibraryType, attrValue, current.getName()));
- } else
- internalError(NLS.bind(Messages.parse_unknownAttribute, LIBRARY, attrName));
- }
- }
-
- public void parsePluginAttributes(Attributes attributes) {
-
- PluginDescriptorModel current = factory.createPluginDescriptor();
- current.setStartLine(locator.getLineNumber());
- objectStack.push(current);
-
- // process attributes
- int len = attributes.getLength();
- for (int i = 0; i < len; i++) {
- String attrName = attributes.getLocalName(i);
- String attrValue = attributes.getValue(i).trim();
-
- if (attrName.equals(PLUGIN_ID))
- current.setId(attrValue);
- else if (attrName.equals(PLUGIN_NAME))
- current.setName(attrValue);
- else if (attrName.equals(PLUGIN_VERSION))
- current.setVersion(attrValue);
- else if (attrName.equals(PLUGIN_VENDOR) || (attrName.equals(PLUGIN_PROVIDER)))
- current.setProviderName(attrValue);
- else if (attrName.equals(PLUGIN_CLASS))
- current.setPluginClass(attrValue);
- else
- internalError(NLS.bind(Messages.parse_unknownAttribute, PLUGIN, attrName));
- }
- }
-
- public void parsePluginRequiresImport(Attributes attributes) {
- PluginPrerequisiteModel current = factory.createPluginPrerequisite();
- current.setStartLine(locator.getLineNumber());
-
- // process attributes
- int len = (attributes != null) ? attributes.getLength() : 0;
- for (int i = 0; i < len; i++) {
- String attrName = attributes.getLocalName(i);
- String attrValue = attributes.getValue(i).trim();
-
- if (attrName.equals(PLUGIN_REQUIRES_PLUGIN))
- current.setPlugin(attrValue);
- else if (attrName.equals(PLUGIN_REQUIRES_PLUGIN_VERSION))
- current.setVersion(attrValue);
- else if (attrName.equals(PLUGIN_REQUIRES_OPTIONAL))
- current.setOptional(TRUE.equalsIgnoreCase(attrValue));
- else if (attrName.equals(PLUGIN_REQUIRES_MATCH)) {
- if (PLUGIN_REQUIRES_MATCH_PERFECT.equals(attrValue))
- current.setMatchByte(PluginPrerequisiteModel.PREREQ_MATCH_PERFECT);
- else if ((PLUGIN_REQUIRES_MATCH_EQUIVALENT.equals(attrValue)) || (PLUGIN_REQUIRES_MATCH_EXACT.equals(attrValue)))
- current.setMatchByte(PluginPrerequisiteModel.PREREQ_MATCH_EQUIVALENT);
- else if (PLUGIN_REQUIRES_MATCH_COMPATIBLE.equals(attrValue))
- current.setMatchByte(PluginPrerequisiteModel.PREREQ_MATCH_COMPATIBLE);
- else if (PLUGIN_REQUIRES_MATCH_GREATER_OR_EQUAL.equals(attrValue))
- current.setMatchByte(PluginPrerequisiteModel.PREREQ_MATCH_GREATER_OR_EQUAL);
- else
- internalError(NLS.bind(Messages.parse_validMatch, attrValue));
- } else if (attrName.equals(PLUGIN_REQUIRES_EXPORT)) {
- if (TRUE.equals(attrValue))
- current.setExport(true);
- else if (FALSE.equals(attrValue))
- current.setExport(false);
- else
- internalError(NLS.bind(Messages.parse_validExport, attrValue));
- } else
- internalError(NLS.bind(Messages.parse_unknownAttribute, PLUGIN_REQUIRES_IMPORT, attrName));
-
- }
- // Populate the vector of prerequisites with this new element
- ((Vector) objectStack.peek()).addElement(current);
- }
-
- public void parseRequiresAttributes(Attributes attributes) {
- }
-
- static String replace(String s, String from, String to) {
- String str = s;
- int fromLen = from.length();
- int toLen = to.length();
- int ix = str.indexOf(from);
- while (ix != -1) {
- str = str.substring(0, ix) + to + str.substring(ix + fromLen);
- ix = str.indexOf(from, ix + toLen);
- }
- return str;
- }
-
- public void startDocument() {
- stateStack.push(new Integer(INITIAL_STATE));
- for (int i = 0; i <= LAST_INDEX; i++) {
- scratchVectors[i] = new Vector();
- }
- }
-
- public void startElement(String uri, String elementName, String qName, Attributes attributes) {
- switch (((Integer) stateStack.peek()).intValue()) {
- case INITIAL_STATE :
- handleInitialState(elementName, attributes);
- break;
- case FRAGMENT_STATE :
- handlePluginState(elementName, attributes);
- break;
- case PLUGIN_STATE :
- handlePluginState(elementName, attributes);
- break;
- case PLUGIN_RUNTIME_STATE :
- handleRuntimeState(elementName, attributes);
- break;
- case PLUGIN_REQUIRES_STATE :
- handleRequiresState(elementName, attributes);
- break;
- case PLUGIN_EXTENSION_POINT_STATE :
- handleExtensionPointState(elementName, attributes);
- break;
- case PLUGIN_EXTENSION_STATE :
- case CONFIGURATION_ELEMENT_STATE :
- handleExtensionState(elementName, attributes);
- break;
- case RUNTIME_LIBRARY_STATE :
- handleLibraryState(elementName, attributes);
- break;
- case LIBRARY_EXPORT_STATE :
- handleLibraryExportState(elementName, attributes);
- break;
- case PLUGIN_REQUIRES_IMPORT_STATE :
- handleRequiresImportState(elementName, attributes);
- break;
- default :
- stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
- internalError(NLS.bind(Messages.parse_unknownTopElement, elementName));
- }
- }
-
- public void warning(SAXParseException ex) {
- logStatus(ex);
- }
-
- private void internalError(String message) {
- if (locationName != null)
- factory.error(new Status(IStatus.WARNING, Platform.PI_RUNTIME, Platform.PARSE_PROBLEM, locationName + ": " + message, null)); //$NON-NLS-1$
- else
- factory.error(new Status(IStatus.WARNING, Platform.PI_RUNTIME, Platform.PARSE_PROBLEM, message, null));
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/RegistryLoader.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/RegistryLoader.java
deleted file mode 100644
index 53bf9ef..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/RegistryLoader.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.core.internal.model;
-
-import java.io.*;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Properties;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.internal.runtime.Messages;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.model.*;
-import org.eclipse.osgi.util.NLS;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXParseException;
-
-public class RegistryLoader {
- private Factory factory;
-
- // debug support
- private boolean debug = false;
- private long lastTick = System.currentTimeMillis();//used for performance timing
-
- private RegistryLoader(Factory factory, boolean debug) {
- super();
- this.debug = debug;
- this.factory = factory;
- }
-
- private void debug(String msg) {
- long thisTick = System.currentTimeMillis();
- System.out.println("RegistryLoader: " + msg + " [+" + (thisTick - lastTick) + "ms]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- lastTick = thisTick;
- }
-
- private String[] getPathMembers(URL path) {
- String[] list = null;
- String protocol = path.getProtocol();
- if (protocol.equals("file")) { //$NON-NLS-1$
- list = (new File(path.getFile())).list();
- } else {
- // XXX: attempt to read URL and see if we got html dir page
- }
- return list == null ? new String[0] : list;
- }
-
- /**
- * Reports an error and returns true.
- */
- private boolean parseProblem(String message) {
- factory.error(new Status(IStatus.WARNING, Platform.PI_RUNTIME, Platform.PARSE_PROBLEM, message, null));
- return true;
- }
-
- private PluginRegistryModel parseRegistry(URL[] pluginPath) {
- long startTick = System.currentTimeMillis();
- PluginRegistryModel result = processManifestFiles(pluginPath);
- if (InternalPlatform.DEBUG) {
- long endTick = System.currentTimeMillis();
- debug("Parsed Registry: " + (endTick - startTick) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return result;
- }
-
- public static PluginRegistryModel parseRegistry(URL[] pluginPath, Factory factory, boolean debug) {
- return new RegistryLoader(factory, debug).parseRegistry(pluginPath);
- }
-
- private PluginModel processManifestFile(URL manifest) {
- InputStream is = null;
- try {
- is = manifest.openStream();
- } catch (IOException e) {
- if (debug)
- debug("No plugin found for: " + manifest); //$NON-NLS-1$
- return null;
- }
- PluginModel result = null;
- try {
- try {
- InputSource in = new InputSource(is);
- // Give the system id a value in case we want it for
- // error reporting within the parser.
- in.setSystemId(manifest.getFile());
- result = new PluginParser((Factory) factory).parsePlugin(in);
- } finally {
- is.close();
- }
- } catch (SAXParseException se) {
- /* exception details logged by parser */
- factory.error(new Status(IStatus.WARNING, Platform.PI_RUNTIME, Platform.PARSE_PROBLEM, NLS.bind(Messages.parse_errorProcessing, manifest), null));
- } catch (Exception e) {
- factory.error(new Status(IStatus.WARNING, Platform.PI_RUNTIME, Platform.PARSE_PROBLEM, NLS.bind(Messages.parse_errorProcessing, manifest + ": " + e.getMessage()), null)); //$NON-NLS-1$
- }
- return result;
- }
-
- private PluginRegistryModel processManifestFiles(URL[] pluginPath) {
- PluginRegistryModel result = factory.createPluginRegistry();
- for (int i = 0; i < pluginPath.length; i++)
- processPluginPathEntry(result, pluginPath[i]);
- return result;
- }
-
- private void processPluginPathEntry(PluginRegistryModel registry, URL location) {
- if (debug)
- debug("Path - " + location); //$NON-NLS-1$
- if (location.getFile().endsWith("/")) { //$NON-NLS-1$
- // directory entry - search for plugins
- String[] members = getPathMembers(location);
- for (int j = 0; j < members.length; j++) {
- boolean found = false;
- try {
- found = processPluginPathFile(registry, new URL(location, members[j] + "/plugin.xml")); //$NON-NLS-1$
- if (!found)
- found = processPluginPathFile(registry, new URL(location, members[j] + "/fragment.xml")); //$NON-NLS-1$
- } catch (MalformedURLException e) {
- // Skip bad URLs
- }
- if (debug)
- debug(found ? "Processed - " : "Processed (not found) - " + members[j]); //$NON-NLS-1$ //$NON-NLS-2$
- }
- } else {
- // specific file entry - load the given file
- boolean found = processPluginPathFile(registry, location);
- if (debug)
- debug(found ? "Processed - " : "Processed (not found) - " + location); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * @return true if a file was found at the given location, and false otherwise.
- */
- private boolean processPluginPathFile(PluginRegistryModel registry, URL location) {
- PluginModel entry = processManifestFile(location);
- if (entry == null)
- return false;
- // Make sure all the required fields are here.
- // This prevents us from things like NullPointerExceptions
- // when we are assuming a field exists.
- if (!requiredPluginModel(entry, location)) {
- entry = null;
- return false;
- }
- entry.setVersion(getQualifiedVersion(entry, location)); // check for version qualifier
- if (entry instanceof PluginDescriptorModel) {
- if (entry.getId() == null || entry.getVersion() == null) {
- return parseProblem(NLS.bind(Messages.parse_nullPluginIdentifier, location));
- }
- //skip duplicate entries
- if (registry.getPlugin(entry.getId(), entry.getVersion()) != null) {
- return parseProblem(NLS.bind(Messages.parse_duplicatePlugin, entry.getId(), location));
- }
- registry.addPlugin((PluginDescriptorModel) entry);
- } else {
- if (entry.getId() == null || entry.getVersion() == null) {
- return parseProblem(NLS.bind(Messages.parse_nullFragmentIdentifier, location));
- }
- if (entry instanceof PluginFragmentModel) {
- registry.addFragment((PluginFragmentModel) entry);
- } else {
- return parseProblem(NLS.bind(Messages.parse_unknownEntry, location));
- }
- }
- String url = location.toString();
- url = url.substring(0, 1 + url.lastIndexOf('/'));
- entry.setRegistry(registry);
- entry.setLocation(url);
- // this is for the registry cache
- // InternalPlatform.addLastModifiedTime(location.getFile(), new File(location.getFile()).lastModified());
- return true;
- }
-
- private String getQualifiedVersion(PluginModel entry, URL base) {
- if (entry == null || entry.getVersion() == null || entry.getId() == null)
- return null;
-
- InputStream is = null;
- try {
- // check to see if we have buildmanifest.properties for this plugin
- URL manifest = null;
- manifest = new URL(base, "buildmanifest.properties"); //$NON-NLS-1$
- Properties props = new Properties();
- is = manifest.openStream();
- props.load(is);
-
- // lookup qualifier for this plugin and "morph" the identifier if needed
- String key = "plugin@" + entry.getId(); //$NON-NLS-1$
- String qualifier = props.getProperty(key);
- if (qualifier == null)
- return entry.getVersion();
- PluginVersionIdentifier v = new PluginVersionIdentifier(entry.getVersion());
- if (!v.getQualifierComponent().equals("")) //$NON-NLS-1$
- return entry.getVersion();
- else
- return (new PluginVersionIdentifier(v.getMajorComponent(), v.getMinorComponent(), v.getServiceComponent(), qualifier)).toString();
- } catch (Exception e) {
- return entry.getVersion();
- } finally {
- if (is != null)
- try {
- is.close();
- } catch (IOException e) {
- // Don't throw anything back if the close fails
- }
- }
- }
-
- private boolean requiredPluginModel(PluginModel plugin, URL location) {
- String name = plugin.getName();
- String id = plugin.getId();
- String version = plugin.getVersion();
- int nameLength = name == null ? 0 : name.length();
- int idLength = id == null ? 0 : id.length();
- int versionLength = version == null ? 0 : version.length();
-
- if (nameLength <= 0) {
- parseProblem(NLS.bind(Messages.parse_missingPluginName, location));
- return false;
- }
- if (idLength <= 0) {
- parseProblem(NLS.bind(Messages.parse_missingPluginId, location));
- return false;
- }
- if (versionLength <= 0) {
- parseProblem(NLS.bind(Messages.parse_missingPluginVersion, location));
- return false;
- }
-
- if (plugin instanceof PluginFragmentModel) {
- String pluginName = ((PluginFragmentModel) plugin).getPlugin();
- String pluginVersion = ((PluginFragmentModel) plugin).getPluginVersion();
- int pNameLength = pluginName == null ? 0 : pluginName.length();
- int pNameVersion = pluginVersion == null ? 0 : pluginVersion.length();
- if (pNameLength <= 0) {
- parseProblem(NLS.bind(Messages.parse_missingFPName, location));
- return false;
- }
- if (pNameVersion <= 0) {
- parseProblem(NLS.bind(Messages.parse_missingFPVersion, location));
- return false;
- }
- }
- return true;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/RegistryResolver.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/RegistryResolver.java
deleted file mode 100644
index 97ca87d..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/internal/model/RegistryResolver.java
+++ /dev/null
@@ -1,1357 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.core.internal.model;
-
-import java.util.*;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.internal.runtime.Messages;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.model.*;
-import org.eclipse.osgi.util.NLS;
-
-public class RegistryResolver {
-
- private Map idmap;
- private PluginRegistryModel reg;
- private MultiStatus status;
- private boolean trimPlugins = true;
- private boolean crossLink = true;
-
- private boolean DEBUG_RESOLVE = false;
- private static final String OPTION_DEBUG_RESOLVE = "org.eclipse.core.runtime/registry/debug/resolve"; //$NON-NLS-1$
-
- // constraint entry
- // A constraint is made for each relationship where 'parent' requires 'prq'.
- // ver is the version number we must try to match. It can be null if we just
- // want to match the latest.
- // cEntry points to the parent ConstraintsEntry element.
- private class Constraint {
- private PluginDescriptorModel parent;
- private PluginPrerequisiteModel prq;
- private PluginVersionIdentifier ver;
- private byte type = PluginPrerequisiteModel.PREREQ_MATCH_UNSPECIFIED;
- private ConstraintsEntry cEntry = null;
-
- private Constraint(PluginDescriptorModel parent, PluginPrerequisiteModel prq) {
- this.parent = parent;
- this.prq = prq;
- if (prq != null) {
- ver = RegistryResolver.this.getVersionIdentifier(prq);
- type = prq.getMatchByte();
- if ((ver != null) && (type == PluginPrerequisiteModel.PREREQ_MATCH_UNSPECIFIED))
- type = PluginPrerequisiteModel.PREREQ_MATCH_COMPATIBLE;
- }
- }
-
- private int getMatchType() {
- return type;
- }
-
- private ConstraintsEntry getConstraintsEntry() {
- return cEntry;
- }
-
- private void setConstraintsEntry(ConstraintsEntry entry) {
- cEntry = entry;
- }
-
- private PluginDescriptorModel getParent() {
- return parent;
- }
-
- private PluginPrerequisiteModel getPrerequisite() {
- return prq;
- }
-
- private PluginVersionIdentifier getVersionIdentifier() {
- return ver;
- }
-
- public String toString() {
- if (prq == null)
- return "(null)"; //$NON-NLS-1$
- String s = parent.toString() + "->" + prq.getPlugin(); //$NON-NLS-1$
- switch (prq.getMatchByte()) {
- case PluginPrerequisiteModel.PREREQ_MATCH_UNSPECIFIED :
- s += "(any)"; //$NON-NLS-1$
- break;
- case PluginPrerequisiteModel.PREREQ_MATCH_PERFECT :
- s += IModel.PLUGIN_REQUIRES_MATCH_PERFECT;
- break;
- case PluginPrerequisiteModel.PREREQ_MATCH_EQUIVALENT :
- s += IModel.PLUGIN_REQUIRES_MATCH_EQUIVALENT;
- break;
- case PluginPrerequisiteModel.PREREQ_MATCH_COMPATIBLE :
- s += IModel.PLUGIN_REQUIRES_MATCH_COMPATIBLE;
- break;
- case PluginPrerequisiteModel.PREREQ_MATCH_GREATER_OR_EQUAL :
- s += IModel.PLUGIN_REQUIRES_MATCH_GREATER_OR_EQUAL;
- break;
- }
- return s;
- }
- }
-
- // constraint index structure
- // Each time an IndexEntry is created, a single ContraintsEntry
- // is created and put into the IndexEntry's concurrentList.
- // Note that the new ConstraintsEntry will always point
- // back to the IndexEntry it is associated with (parent).
- // A ConstraintsEntry holds a group of constraints that can be
- // resolved, without conflict for a particular plugin id. The
- // constraints are all of the form where another plugin id
- // requires some version of this plugin id as a prerequisite.
- private class ConstraintsEntry {
- private IndexEntry parent;
- private List constraintList = new LinkedList();
- // lastResolved doesn't seem to be used. Is it designed to
- // eliminate the numerous calls to find a matching plugin
- // descriptor? Calls to find a matching plugin descriptor
- // iterate through each version of this plugin and each
- // constraint in each ConstraintsEntry.
- private PluginDescriptorModel lastResolved = null;
- private boolean isResolved = false;
- private PluginDescriptorModel bestMatch = null;
- private boolean bestMatchEnabled = false;
-
- private ConstraintsEntry(IndexEntry parent) {
- // Create a new ConstraintsEntry and point 'parent'
- // back to the associated IndexEntry
- this.parent = parent;
- }
-
- private int constraintCount() {
- // Returns the number of Constraint entries in
- // constraintList. Initially this will be 0.
- return constraintList.size();
- }
-
- private PluginDescriptorModel addConstraint(Constraint c) {
- // Add this Constraint to the list of constraints
- // for this ConstraintsEntry. Note that while a
- // given ConstraintsEntry can have many Constraints,
- // any Constraint can have only one ConstraintsEntry.
- // This method will return a single plugin descriptor which
- // is the most recent descriptor which satisfies this
- // constraint.
- constraintList.add(c);
- c.setConstraintsEntry(this);
- // get all of the plugin descriptors which satisfy this
- // constraint and all other constraints in this ConstraintsEntry
- List constrained = getMatchingDescriptors();
- if (constrained.size() <= 0) {
- // looks like we have a conflict
- constraintList.remove(c);
- c.setConstraintsEntry(null);
- return null;
- } else {
- // match will be only the latest version plugin which
- // satisfies these constraints
- PluginDescriptorModel match = (PluginDescriptorModel) constrained.get(0);
- if (!match.equals(lastResolved)) {
- lastResolved = match;
- isResolved = false;
- }
- return match;
- }
- }
-
- private void removeConstraint(Constraint c) {
- if (DEBUG_RESOLVE)
- debug("removing constraint " + c.toString()); //$NON-NLS-1$
- constraintList.remove(c);
- c.setConstraintsEntry(null);
- lastResolved = null;
- isResolved = false;
- }
-
- private void removeConstraintFor(PluginPrerequisiteModel prereq) {
- List remove = new ArrayList();
- for (Iterator list = constraintList.iterator(); list.hasNext();) {
- Constraint c = (Constraint) list.next();
- if (c.getPrerequisite() == prereq)
- remove.add(c);
- }
- for (Iterator list = remove.iterator(); list.hasNext();)
- removeConstraint((Constraint) list.next());
- }
-
- private PluginDescriptorModel getMatchingDescriptor() {
- // We do this a lot. Can we use some mechanism to
- // hold the last matching descriptor and discard
- // it if the constraints change?
- List constrained = getMatchingDescriptors();
- if (constrained.size() <= 0)
- return null;
- else
- return (PluginDescriptorModel) constrained.get(0);
- }
-
- private List getMatchingDescriptors() {
- // The object of the game here is to return a list of plugin
- // descriptors that match the list of Constraint elements
- // hanging off this ConstraintsEntry.
-
- // constrained will be a list of matching plugin descriptors
- List constrained = new LinkedList();
-
- for (Iterator list = parent.versions().iterator(); list.hasNext();) {
- // parent is an IndexEntry and versions is a list of all the
- // plugin descriptors, in version order (biggest to smallest),
- // that have this plugin id.
- PluginDescriptorModel pd = (PluginDescriptorModel) list.next();
- if (pd.getEnabled())
- constrained.add(pd);
- }
- // constrained now contains all of the enabled plugin descriptors for
- // this IndexEntry. The next step is to remove any that don't fit.
-
- for (Iterator list = constraintList.iterator(); list.hasNext();) {
- // For each Constraint, go through all of the versions of this plugin
- // and remove any from 'constrained' which don't match the criteria
- // for this Constraint.
-
- // constraintList is all the Constraint entries for this ConstraintsEntry.
- Constraint c = (Constraint) list.next();
- if (c.getMatchType() == PluginPrerequisiteModel.PREREQ_MATCH_UNSPECIFIED)
- continue;
- for (Iterator list2 = parent.versions().iterator(); list2.hasNext();) {
- PluginDescriptorModel pd = (PluginDescriptorModel) list2.next();
- if (!pd.getEnabled())
- // ignore disabled plugins
- continue;
- switch (c.getMatchType()) {
- case PluginPrerequisiteModel.PREREQ_MATCH_PERFECT :
- if (!getVersionIdentifier(pd).isPerfect(c.getVersionIdentifier()))
- constrained.remove(pd);
- break;
- case PluginPrerequisiteModel.PREREQ_MATCH_EQUIVALENT :
- if (!getVersionIdentifier(pd).isEquivalentTo(c.getVersionIdentifier()))
- constrained.remove(pd);
- break;
- case PluginPrerequisiteModel.PREREQ_MATCH_COMPATIBLE :
- if (!getVersionIdentifier(pd).isCompatibleWith(c.getVersionIdentifier()))
- constrained.remove(pd);
- break;
- case PluginPrerequisiteModel.PREREQ_MATCH_GREATER_OR_EQUAL :
- if (!getVersionIdentifier(pd).isGreaterOrEqualTo(c.getVersionIdentifier()))
- constrained.remove(pd);
- break;
- }
- }
- }
-
- // At this point, constrained will contain only those plugin descriptors which
- // satisfy ALL of the Constraint entries.
-
- return constrained;
- }
-
- private void preresolve(List roots) {
- // All of the constraints that need to be added, have been. Now just
- // pick the plugin descriptor that is a best fit for all of these
- // constraints. Root nodes will not have any constraints (since nothing
- // requires this plugin as a prerequisite, by definition). For root
- // node, just pick up the latest version.
-
- if (constraintList.size() <= 0) {
- // This should be a root descriptor. So, just pick up the latest
- // version of the root.
- if (roots.contains(parent.getId())) {
- bestMatch = (PluginDescriptorModel) parent.versions().get(0);
- if (bestMatch == null) {
- if (DEBUG_RESOLVE)
- debug("*ERROR* no resolved descriptor for " + parent.getId()); //$NON-NLS-1$
- } else
- bestMatchEnabled = bestMatch.getEnabled();
- }
- } else {
- // If this isn't a root descriptor, get the latest version of the
- // plugin descriptor which matches all the constraints we have.
- // Pick the plugin that best matches all the constraints. Any
- // allowable conflicts will be in another ConstraintsEntry.
- bestMatch = getMatchingDescriptor();
- if (bestMatch == null) {
- if (DEBUG_RESOLVE)
- debug("*ERROR* no resolved descriptor for " + parent.getId()); //$NON-NLS-1$
- } else
- bestMatchEnabled = true;
- }
- }
-
- private void resolve() {
- // Assumptions: All constraints that need to be added, have been.
- // - preresolve (above) has been called and a bestMatch (if it
- // exists) has been identified
- // - all versions of this plugin have been disabled (so it is
- // up to this method to enable the plugin that is a bestMatch
- // for all of the constraints in this ConstraintsEntry).
- if (bestMatch != null) {
- // All of the versions of this plugin will have been disabled.
- // Enable only the one which is the best match.
- // bestMatchEnabled will be set to false if this particular plugin
- // caused an unresolvable conflict. Therefore, setEnabled(bestMatchEnabled)
- // will leave this delinquent plugin disabled.
- bestMatch.setEnabled(bestMatchEnabled);
- if (bestMatchEnabled) {
- if (DEBUG_RESOLVE)
- debug("configured " + bestMatch.toString()); //$NON-NLS-1$
- if (constraintList.size() > 0) {
- for (int i = 0; i < constraintList.size(); i++) {
- // Put which actual version this prerequisite resolved to in the
- // relevant prerequisite in the registry.
- PluginPrerequisiteModel prq = (PluginPrerequisiteModel) ((Constraint) constraintList.get(i)).getPrerequisite();
- prq.setResolvedVersion(getVersionIdentifier(bestMatch).toString());
- }
- }
- }
- }
- }
-
- private boolean isResolved() {
- return this.isResolved;
- }
-
- private void isResolved(boolean isResolved) {
- this.isResolved = isResolved;
- }
- }
-
- // plugin descriptor index structure
- // There is exactly one IndexEntry for each plugin id.
- // The actual plugin descriptor is an element of verList.
- // Multiple versions of this plugin id are found in verList
- // and are ordered from the highest version number (assumed
- // to be the most recent) to the lowest version number.
- // concurrentList contains a list of ConstraintsEntry's which
- // group constraints together into non-conflicting groups.
- private class IndexEntry {
- private String id;
- private List verList = new LinkedList();
- private List concurrentList = new ArrayList();
-
- private IndexEntry(String id) {
- this.id = id;
- // Create the first ConstraintsEntry with no constraints
- concurrentList.add(new ConstraintsEntry(this));
- }
-
- private String getId() {
- return id;
- }
-
- private ConstraintsEntry getConstraintsEntryFor(Constraint c) {
- // Each Constraint must have exactly one ConstraintsEntry but
- // a ConstraintsEntry may have many (non-conflicting) Constraints.
- ConstraintsEntry ce = c.getConstraintsEntry();
- if (ce != null)
- return ce;
- ce = (ConstraintsEntry) concurrentList.get(0);
- if (c.getPrerequisite() == null)
- c.setConstraintsEntry(ce);
- return ce;
- }
-
- private PluginDescriptorModel addConstraint(Constraint c) {
- int concurrentCount = concurrentList.size();
-
- // try to find constraits entry that can accommodate new constraint
- for (Iterator list = concurrentList.iterator(); list.hasNext();) {
- ConstraintsEntry cie = (ConstraintsEntry) list.next();
- PluginDescriptorModel pd = cie.addConstraint(c);
- // If pd comes back null, adding this constraint to the
- // ConstraintsEntry cie will cause a conflict (no plugin
- // descriptor can satisfy all the constraints).
- if (pd != null) {
-
- // constraint added OK and no concurrency
- if (concurrentCount <= 1)
- return pd;
-
- // constraint added OK but have concurrency
- if (allowConcurrencyFor(pd))
- return pd;
- else {
- cie.removeConstraint(c); // cannot be concurrent
- return null;
- }
- }
- }
-
- // If we get to this point, the constraint we are trying to add
- // gave us no matching plugins when used in conjunction with the
- // other constraints in a particular ConstraintsEntry. Add a
- // new ConstraintsEntry and put this constraint in it (only if
- // concurrency is allowed). Concurrency is allowed only if the
- // plugin we find which matches this constraint has no extensions
- // or extension points.
-
- // attempt to create new constraints entry
- ConstraintsEntry cie;
- PluginDescriptorModel pd;
-
- if (concurrentList.size() == 1) {
- // ensure base entry allows concurrency
- cie = (ConstraintsEntry) concurrentList.get(0);
- pd = cie.getMatchingDescriptor();
- if (!allowConcurrencyFor(pd))
- return null;
- }
-
- cie = new ConstraintsEntry(this);
- pd = cie.addConstraint(c);
- if (pd == null) {
- cie.removeConstraint(c); // no matching target
- return null;
- }
- if (!allowConcurrencyFor(pd)) {
- cie.removeConstraint(c); // cannot be concurrent
- return null;
- }
- if (DEBUG_RESOLVE)
- debug("creating new constraints list in " + id + " for " + c.toString()); //$NON-NLS-1$ //$NON-NLS-2$
- concurrentList.add(cie);
- return pd;
- }
-
- private boolean allowConcurrencyFor(PluginDescriptorModel pd) {
- if (pd == null)
- return false;
- if (pd.getDeclaredExtensions() != null && pd.getDeclaredExtensions().length > 0)
- return false;
- if (pd.getDeclaredExtensionPoints() != null && pd.getDeclaredExtensionPoints().length > 0)
- return false;
- return true;
- }
-
- private void removeConstraintFor(PluginPrerequisiteModel prereq) {
- for (Iterator list = concurrentList.iterator(); list.hasNext();)
- ((ConstraintsEntry) list.next()).removeConstraintFor(prereq);
- }
-
- private PluginDescriptorModel getMatchingDescriptorFor(Constraint c) {
- ConstraintsEntry cie = getConstraintsEntryFor(c);
- return cie.getMatchingDescriptor();
- }
-
- private void disableAllDescriptors() {
- for (Iterator list = verList.iterator(); list.hasNext();) {
- PluginDescriptorModel pd = (PluginDescriptorModel) list.next();
- pd.setEnabled(false);
- }
- }
-
- private void resolveDependencies(List roots) {
- // preresolved will pick out the plugin which has the highest version
- // number and satisfies all the constraints. This is then put in
- // bestMatch field of the ConstraintsEntry.
- for (Iterator list = concurrentList.iterator(); list.hasNext();)
- ((ConstraintsEntry) list.next()).preresolve(roots);
- // Now all versions of this plugin are disabled.
- disableAllDescriptors();
- // Now, find the best match (from preresolve above) and enable it.
- // Be sure to update any prerequisite entries with the version number
- // of the plugin we are actually using.
- for (Iterator list = concurrentList.iterator(); list.hasNext();)
- ((ConstraintsEntry) list.next()).resolve();
- }
-
- /**
- * A root plug-in does not have any constraints attached to it.
- */
- private boolean isRoot() {
- if (concurrentList.size() != 1)
- return false;
- ConstraintsEntry constraintsEntry = (ConstraintsEntry) concurrentList.get(0);
- return constraintsEntry.constraintCount() == 0;
- }
-
- private List versions() {
- return verList;
- }
-
- private boolean isResolvedFor(Constraint c) {
- ConstraintsEntry cie = getConstraintsEntryFor(c);
- return cie.isResolved();
- }
-
- private void isResolvedFor(Constraint c, boolean value) {
- ConstraintsEntry cie = getConstraintsEntryFor(c);
- cie.isResolved(value);
- }
-
- }
-
- // subtree resolution "cookie" (composite change list)
- private class Cookie {
- private boolean ok = true;
- private List changes = new ArrayList(); // a list of Constraints
-
- private Cookie() {
- }
-
- private boolean addChange(Constraint c) {
- // Keep a list of all constraints so that
- // - we can spot circular dependencies
- // - we can clean up if there is an unresolvable conflict
- PluginPrerequisiteModel prereq = c.getPrerequisite();
- for (Iterator list = changes.iterator(); list.hasNext();)
- if (prereq == ((Constraint) list.next()).getPrerequisite())
- // We have a circular dependency
- return false;
- changes.add(c);
- return true;
- }
-
- private List getChanges() {
- return changes;
- }
-
- private boolean isOk() {
- return ok;
- }
-
- private void isOk(boolean value) {
- ok = value;
- }
- }
-
- public RegistryResolver() {
- String debug = Platform.getDebugOption(OPTION_DEBUG_RESOLVE);
- DEBUG_RESOLVE = debug == null ? false : (debug.equalsIgnoreCase("true") ? true : false); //$NON-NLS-1$
- }
-
- private void add(PluginDescriptorModel pd) {
-
- String key = pd.getId();
- List verList;
- IndexEntry ix = (IndexEntry) idmap.get(key);
-
- // create new index entry if one does not exist for plugin
- if (ix == null) {
- ix = new IndexEntry(key);
- idmap.put(key, ix);
- }
-
- // insert plugin into list maintaining version order
- verList = ix.versions();
- int i = 0;
- for (i = 0; i < verList.size(); i++) {
- PluginDescriptorModel element = (PluginDescriptorModel) verList.get(i);
- if (getVersionIdentifier(pd).equals(getVersionIdentifier(element)))
- return; // ignore duplicates
- if (getVersionIdentifier(pd).isGreaterThan(getVersionIdentifier(element)))
- break;
- }
- verList.add(i, pd);
- }
-
- private void addExtensions(ExtensionModel[] extensions, PluginDescriptorModel plugin) {
- // Add all the extensions (presumably from a fragment) to plugin
- int extLength = extensions.length;
- for (int i = 0; i < extLength; i++) {
- extensions[i].setParentPluginDescriptor(plugin);
- }
- ExtensionModel[] list = plugin.getDeclaredExtensions();
- int listLength = (list == null ? 0 : list.length);
- ExtensionModel[] result = null;
- if (list == null)
- result = new ExtensionModel[extLength];
- else {
- result = new ExtensionModel[list.length + extLength];
- System.arraycopy(list, 0, result, 0, list.length);
- }
- System.arraycopy(extensions, 0, result, listLength, extLength);
- plugin.setDeclaredExtensions(result);
- }
-
- private void addExtensionPoints(ExtensionPointModel[] extensionPoints, PluginDescriptorModel plugin) {
- // Add all the extension points (presumably from a fragment) to plugin
- int extPtLength = extensionPoints.length;
- for (int i = 0; i < extPtLength; i++) {
- extensionPoints[i].setParentPluginDescriptor(plugin);
- }
- ExtensionPointModel[] list = plugin.getDeclaredExtensionPoints();
- int listLength = (list == null ? 0 : list.length);
- ExtensionPointModel[] result = null;
- if (list == null)
- result = new ExtensionPointModel[extPtLength];
- else {
- result = new ExtensionPointModel[list.length + extPtLength];
- System.arraycopy(list, 0, result, 0, list.length);
- }
- System.arraycopy(extensionPoints, 0, result, listLength, extPtLength);
- plugin.setDeclaredExtensionPoints(result);
- }
-
- private void addLibraries(LibraryModel[] libraries, PluginDescriptorModel plugin) {
- // Add all the libraries (presumably from a fragment) to plugin
- int libLength = libraries.length;
- LibraryModel[] list = plugin.getRuntime();
- LibraryModel[] result = null;
- int listLength = (list == null ? 0 : list.length);
- if (list == null)
- result = new LibraryModel[libLength];
- else {
- result = new LibraryModel[list.length + libLength];
- System.arraycopy(list, 0, result, 0, list.length);
- }
- System.arraycopy(libraries, 0, result, listLength, libLength);
- plugin.setRuntime(result);
- }
-
- private void addPrerequisites(PluginPrerequisiteModel[] prerequisites, PluginDescriptorModel plugin) {
- // Add all the prerequisites (presumably from a fragment) to plugin
- int reqLength = prerequisites.length;
- PluginPrerequisiteModel[] list = plugin.getRequires();
- PluginPrerequisiteModel[] result = null;
- int listLength = (list == null ? 0 : list.length);
- if (list == null)
- result = new PluginPrerequisiteModel[reqLength];
- else {
- result = new PluginPrerequisiteModel[list.length + reqLength];
- System.arraycopy(list, 0, result, 0, list.length);
- }
- System.arraycopy(prerequisites, 0, result, listLength, reqLength);
- plugin.setRequires(result);
- }
-
- private void debug(String s) {
- System.out.println("Registry Resolve: " + s); //$NON-NLS-1$
- }
-
- private void error(String message) {
- Status error = new Status(IStatus.WARNING, Platform.PI_RUNTIME, Platform.PARSE_PROBLEM, message, null);
- status.add(error);
- if (InternalPlatform.DEBUG && DEBUG_RESOLVE)
- System.out.println(error.toString());
- }
-
- private void information(String message) {
- if (InternalPlatform.DEBUG && DEBUG_RESOLVE)
- System.out.println(message);
- }
-
- public IExtensionPoint getExtensionPoint(PluginDescriptorModel plugin, String extensionPointId) {
- if (extensionPointId == null)
- return null;
- ExtensionPointModel[] list = plugin.getDeclaredExtensionPoints();
- if (list == null)
- return null;
- for (int i = 0; i < list.length; i++) {
- if (extensionPointId.equals(list[i].getId()))
- return (IExtensionPoint) list[i];
- }
- return null;
- }
-
- private PluginVersionIdentifier getVersionIdentifier(PluginModel model) {
- try {
- return new PluginVersionIdentifier(model.getVersion());
- } catch (RuntimeException e) {
- // if the version is invalid, an AssertionFailedException (not visible here) will be thrown
- if (this.DEBUG_RESOLVE)
- // only show if we are debugging
- e.printStackTrace(System.out);
- // Hopefully, we will never get here. The version number
- // has already been successfully converted from a string to
- // a PluginVersionIdentifier and back to a string. But keep
- // this catch around in case something does go wrong.
- return new PluginVersionIdentifier(0, 0, 0);
- }
- }
-
- private PluginVersionIdentifier getVersionIdentifier(PluginPrerequisiteModel prereq) {
- String version = prereq.getVersion();
- return version == null ? null : new PluginVersionIdentifier(version);
- }
-
- private boolean fragmentHasPrerequisites(PluginFragmentModel fragment) {
- PluginPrerequisiteModel[] requires = fragment.getRequires();
- if (requires == null || requires.length == 0)
- return true;
- for (int i = 0; i < requires.length; i++) {
- // Use the idmap to determine if a plugin exists. We know
- // that all plugins in this registry already have an entry
- // in the idmap. If the right idmap entry doesn't exist,
- // this plugin is not in the registry.
- if (idmap.get(requires[i].getPlugin()) == null) {
- // We know this plugin doesn't exist
- error(NLS.bind(Messages.parse_badPrereqOnFrag, fragment.getName(), requires[i].getPlugin()));
- return false;
- }
- }
- return true;
- }
-
- private void linkFragments() {
- /* For each fragment, find out which plugin descriptor it belongs
- * to and add it to the list of fragments in this plugin.
- */
- PluginFragmentModel[] fragments = reg.getFragments();
- for (int i = 0; i < fragments.length; i++) {
- PluginFragmentModel fragment = fragments[i];
- if (!requiredFragment(fragment)) {
- // There is a required field missing on this fragment, so
- // ignore it.
- String id, name;
- if ((id = fragment.getId()) != null)
- error(NLS.bind(Messages.parse_fragmentMissingAttr, id));
- else if ((name = fragment.getName()) != null)
- error(NLS.bind(Messages.parse_fragmentMissingAttr, name));
- else
- error(Messages.parse_fragmentMissingIdName);
- continue;
- }
- if (!fragmentHasPrerequisites(fragment)) {
- // This fragment requires a plugin that does not
- // exist. Ignore the fragment.
- continue;
- }
-
- // Now find a plugin that fits the matching criteria specified for this fragment and
- // its related plugin
- PluginDescriptorModel plugin = null;
- IndexEntry ix = (IndexEntry) idmap.get(fragment.getPluginId());
- byte matchType = fragment.getMatch();
- if (ix != null) {
- for (Iterator list = ix.versions().iterator(); list.hasNext() && plugin == null;) {
- PluginDescriptorModel pd = (PluginDescriptorModel) list.next();
- if (pd.getEnabled()) {
- // return the highest version that fits the matching criteria
- switch (matchType) {
- case PluginFragmentModel.FRAGMENT_MATCH_PERFECT :
- if (getVersionIdentifier(pd).isPerfect(new PluginVersionIdentifier(fragment.getPluginVersion())))
- plugin = pd;
- break;
- case PluginFragmentModel.FRAGMENT_MATCH_EQUIVALENT :
- if (getVersionIdentifier(pd).isEquivalentTo(new PluginVersionIdentifier(fragment.getPluginVersion())))
- plugin = pd;
- break;
- case PluginFragmentModel.FRAGMENT_MATCH_COMPATIBLE :
- case PluginFragmentModel.FRAGMENT_MATCH_UNSPECIFIED :
- if (getVersionIdentifier(pd).isCompatibleWith(new PluginVersionIdentifier(fragment.getPluginVersion())))
- plugin = pd;
- break;
- case PluginFragmentModel.FRAGMENT_MATCH_GREATER_OR_EQUAL :
- if (getVersionIdentifier(pd).isGreaterOrEqualTo(new PluginVersionIdentifier(fragment.getPluginVersion())))
- plugin = pd;
- break;
- }
- }
- }
- }
-
- if (plugin == null) {
- // We couldn't find this fragment's plugin
- error(NLS.bind(Messages.parse_missingFragmentPd, fragment.getPluginId(), fragment.getId()));
- continue;
- }
-
- // Add this fragment to the list of fragments for this plugin descriptor
- PluginFragmentModel[] list = plugin.getFragments();
- PluginFragmentModel[] newList;
- if (list == null) {
- newList = new PluginFragmentModel[1];
- newList[0] = fragment;
- } else {
- newList = new PluginFragmentModel[list.length + 1];
- System.arraycopy(list, 0, newList, 0, list.length);
- newList[list.length] = fragment;
- }
- plugin.setFragments(newList);
- }
- }
-
- private void removeConstraintFor(PluginPrerequisiteModel prereq) {
-
- String id = prereq.getPlugin();
- IndexEntry ix = (IndexEntry) idmap.get(id);
- if (ix == null) {
- if (DEBUG_RESOLVE)
- debug("unable to locate index entry for " + id); //$NON-NLS-1$
- return;
- }
- ix.removeConstraintFor(prereq);
- }
-
- private void resolve() {
-
- // Start by putting each plugin in the idmap. We are
- // going to need this for the call to linkFragments.
- PluginDescriptorModel[] pluginList = reg.getPlugins();
- idmap = new HashMap();
- for (int i = 0; i < pluginList.length; i++) {
- // Check to see if all the required fields exist now.
- // For example, if we have a null plugin version identifier,
- // the add(pluginList[i]) will give a null pointer
- // exception.
- if (!requiredPluginDescriptor(pluginList[i])) {
- pluginList[i].setEnabled(false);
- String id, name;
- if ((id = pluginList[i].getId()) != null)
- error(NLS.bind(Messages.parse_pluginMissingAttr, id));
- else if ((name = pluginList[i].getName()) != null)
- error(NLS.bind(Messages.parse_pluginMissingAttr, name));
- else
- error(Messages.parse_pluginMissingIdName);
- continue;
- }
- add(pluginList[i]);
- }
- // Add all the fragments to their associated plugin.
- // Note that this will check for all the required fields in
- // the fragment.
- linkFragments();
- // Now we have to cycle through the plugin list again
- // to assimilate all the fragment information and
- // check for 'required' fields.
- for (int i = 0; i < pluginList.length; i++) {
- if (pluginList[i].getFragments() != null) {
- // Take all the information in each fragment and
- // embed it in the plugin descriptor
- resolvePluginFragments(pluginList[i]);
- }
- }
-
- // resolve root descriptors
- List roots = resolveRootDescriptors();
-
- if (roots.size() == 0) {
- // No roots, likely due to a circular dependency
- // (or multiple circular dependencies). Disable
- // all plugins before returning. Remember to trim
- // the registry if needed.
- PluginDescriptorModel[] plugins = reg.getPlugins();
- for (int i = 0; i < plugins.length; i++) {
- plugins[i].setEnabled(false);
- }
- resolvePluginRegistry();
- idmap = null;
- reg = null;
- error(Messages.plugin_unableToResolve);
- return;
- }
-
- // roots is a list of those plugin ids that are not a
- // prerequisite for any other plugin. Note that roots
- // contains ids only.
-
- // process all root nodes (first those previously on roots list, then those on the orphans set)
- // The orphans of an iteration will become the roots of the next one.
- for (Set orphans, rootsSet = new HashSet(roots); !rootsSet.isEmpty(); rootsSet = orphans) {
- orphans = new HashSet();
- // walk the dependencies and setup constraints
- for (Iterator rootsIter = rootsSet.iterator(); rootsIter.hasNext();) {
- String rootID = (String) rootsIter.next();
- resolveNode(rootID, null, null, null, orphans);
- // At this point we have set up all the Constraint and
- // ConstraintsEntry components. But we may not have found which
- // plugin is the best match for a given set of constraints.
- }
- // build the roots set for the next iteration
- for (Iterator orphansIter = orphans.iterator(); orphansIter.hasNext();) {
- IndexEntry orphan = (IndexEntry) idmap.get(orphansIter.next());
- // only after a complete iteration over the roots set we can decide if
- // a potential orphan is a real orphan
- // Now we need to resolve for these new roots (they may
- // not have been resolved before, especially if the parent
- // was looking for an older version and not the latest
- // version which is what we pick up for the roots).
- if (orphan.isRoot()) {
- if (DEBUG_RESOLVE)
- debug("orphan " + orphan.getId()); //$NON-NLS-1$
- roots.add(orphan.getId());
- } else
- orphansIter.remove();
- }
- }
-
- // resolve dependencies
- Iterator plugins = idmap.entrySet().iterator();
- while (plugins.hasNext()) {
- IndexEntry ix = (IndexEntry) ((Map.Entry) plugins.next()).getValue();
- // Now go off and find the plugin that matches the
- // constraints. Note that root plugins will always use the
- // latest version.
- ix.resolveDependencies(roots);
- }
-
- // walk down the registry structure and resolve links
- // between extensions and extension points
- resolvePluginRegistry();
-
- // unhook registry and index
- idmap = null;
- reg = null;
- }
-
- public IStatus resolve(PluginRegistryModel registry) {
- // This is the entry point to the registry resolver.
- // Calling this method, with a valid registry will
- // cause this registry to be 'resolved'.
-
- status = new MultiStatus(Platform.PI_RUNTIME, IStatus.OK, "", null); //$NON-NLS-1$
-
- if (registry.isResolved())
- // don't bother doing anything if it's already resolved
- return status;
-
- reg = registry;
- resolve();
- registry.markResolved();
- return status;
- }
-
- private void resolveExtension(ExtensionModel ext) {
-
- String target = ext.getExtensionPoint();
- int ix = target.lastIndexOf("."); //$NON-NLS-1$
- String pluginId = target.substring(0, ix);
- String extPtId = target.substring(ix + 1);
- String message;
-
- PluginDescriptorModel plugin = (PluginDescriptorModel) reg.getPlugin(pluginId);
- if (plugin == null) {
- message = NLS.bind(Messages.parse_extPointUnknown, target, ext.getParentPluginDescriptor().getId());
- error(message);
- return;
- }
- if (!plugin.getEnabled()) {
- message = NLS.bind(Messages.parse_extPointDisabled, target, ext.getParentPluginDescriptor().getId());
- error(message);
- return;
- }
-
- ExtensionPointModel extPt = (ExtensionPointModel) getExtensionPoint(plugin, extPtId);
- if (extPt == null) {
- message = NLS.bind(Messages.parse_extPointUnknown, target, ext.getParentPluginDescriptor().getId());
- error(message);
- return;
- }
-
- ExtensionModel[] oldValues = extPt.getDeclaredExtensions();
- ExtensionModel[] newValues = null;
- if (oldValues == null)
- newValues = new ExtensionModel[1];
- else {
- newValues = new ExtensionModel[oldValues.length + 1];
- System.arraycopy(oldValues, 0, newValues, 0, oldValues.length);
- }
- newValues[newValues.length - 1] = ext;
- extPt.setDeclaredExtensions(newValues);
- }
-
- private Cookie resolveNode(String child, PluginDescriptorModel parent, PluginPrerequisiteModel prq, Cookie cookie, Set orphans) {
- // This method is called recursively to setup dependency constraints.
- // Top invocation is passed null parent and null prerequisite.
- // We are trying to resolve for the plugin descriptor with id 'child'.
-
- if (DEBUG_RESOLVE)
- debug("PUSH> " + child); //$NON-NLS-1$
-
- if (cookie == null)
- cookie = new Cookie();
-
- // lookup child entry
- IndexEntry ix = (IndexEntry) idmap.get(child);
- // We should now have the IndexEntry for the plugin we
- // wish to resolve
- if (ix == null) {
- // If this is an optional prerequisite and not a root
- // node, we can just ignore this prerequisite if there
- // is no IndexEntry (as there is no corresponding plugin)
- // and continue processing.
- if (prq.getOptional() && parent != null && child != null)
- return cookie;
- if (parent != null)
- error(NLS.bind(Messages.parse_prereqDisabled, parent.getId(), child));
- if (DEBUG_RESOLVE)
- debug("<POP " + child + " not found"); //$NON-NLS-1$ //$NON-NLS-2$
- cookie.isOk(false);
- return cookie;
- }
-
- // try to add new dependency constraint
- Constraint currentConstraint = new Constraint(parent, prq);
- // A constraint will be added for each parent which requires us.
- PluginDescriptorModel childPd = null;
- if (parent != null) {
- childPd = ix.addConstraint(currentConstraint);
- if (childPd == null) {
- if (prq.getOptional()) {
- // This is an optional prerequisite. Ignore the conflict and this
- // prerequisite.
- orphans.add(ix.getId());
- information(NLS.bind(Messages.parse_unsatisfiedOptPrereq, parent.getId(), child));
- return cookie;
- } else {
- // This prerequisite is mandatory.
- String message = NLS.bind(Messages.parse_unsatisfiedPrereq, parent.getId(), child);
- error(message);
- if (DEBUG_RESOLVE)
- debug("<POP " + child + " unable to satisfy constraint"); //$NON-NLS-1$ //$NON-NLS-2$
- cookie.isOk(false);
- return cookie;
- }
- } else if (!cookie.addChange(currentConstraint)) {
- if (prq.getOptional()) {
- // This is an optional prerequisite. Ignore the loop, and the
- // prerequisite
- information(NLS.bind(Messages.parse_prereqOptLoop, parent.getId(), child));
- return cookie;
- } else {
- String message = NLS.bind(Messages.parse_prereqLoop, parent.getId(), child);
- error(message);
- if (DEBUG_RESOLVE)
- debug("<POP " + child + " prerequisite loop"); //$NON-NLS-1$ //$NON-NLS-2$
- cookie.isOk(false);
- return cookie;
- }
- }
- } else {
- // This is a root node. There is no prerequisite so this IndexEntry must
- // exist
- childPd = ix.getMatchingDescriptorFor(currentConstraint);
- if (childPd == null) {
- if (DEBUG_RESOLVE)
- debug("<POP " + child + " not found (missing descriptor entry)"); //$NON-NLS-1$ //$NON-NLS-2$
- cookie.isOk(false);
- return cookie;
- }
- }
-
- // check to see if subtree is already resolved
- if (ix.isResolvedFor(currentConstraint)) {
- if (DEBUG_RESOLVE)
- debug("<POP " + child + " already resolved"); //$NON-NLS-1$ //$NON-NLS-2$
- return cookie;
- }
-
- // select the subtree to resolve
- PluginPrerequisiteModel[] prereqs = childPd.getRequires();
- PluginPrerequisiteModel prereq;
- prereqs = prereqs == null ? new PluginPrerequisiteModel[0] : prereqs;
- for (int i = 0; cookie.isOk() && i < prereqs.length; i++) {
- prereq = (PluginPrerequisiteModel) prereqs[i];
- cookie = resolveNode(prereq.getPlugin(), childPd, prereq, cookie, orphans);
- }
-
- // if we failed, remove any constraints we added
- if (!cookie.isOk()) {
- Constraint cookieConstraint;
- for (Iterator change = cookie.getChanges().iterator(); change.hasNext();) {
- cookieConstraint = (Constraint) change.next();
- prereq = cookieConstraint.getPrerequisite();
- if (childPd == cookieConstraint.getParent()) {
- // keep track of orphaned subtrees
- if (!orphans.contains(prereq.getPlugin()) && (idmap.get(prereq.getPlugin()) != null))
- orphans.add(prereq.getPlugin());
- }
- removeConstraintFor(prereq);
- }
- // Make sure you picked up all the orphaned subtrees
- // for this childPd
- for (int i = 0; i < prereqs.length; i++) {
- if (!orphans.contains(prereqs[i].getPlugin()) && (idmap.get(prereqs[i].getPlugin()) != null))
- orphans.add(prereqs[i].getPlugin());
- }
- if (parent != null)
- error(NLS.bind(Messages.parse_prereqDisabled, parent.getId(), child));
- childPd.setEnabled(false);
- if (DEBUG_RESOLVE)
- debug("<POP " + child + " failed to resolve subtree"); //$NON-NLS-1$ //$NON-NLS-2$
- return cookie;
- } else {
- // we're done
- ix.isResolvedFor(currentConstraint, true);
- if (DEBUG_RESOLVE)
- debug("<POP " + child + " " + getVersionIdentifier(childPd)); //$NON-NLS-1$ //$NON-NLS-2$
- return cookie;
- }
- }
-
- private void resolvePluginDescriptor(PluginDescriptorModel pd) {
- ExtensionModel[] list = pd.getDeclaredExtensions();
- if (list == null || list.length == 0 || !pd.getEnabled())
- // Can be disabled if all required attributes not present
- return;
- for (int i = 0; i < list.length; i++)
- resolveExtension((ExtensionModel) list[i]);
- }
-
- private void resolvePluginFragment(PluginFragmentModel fragment, PluginDescriptorModel plugin) {
- ExtensionModel[] extensions = fragment.getDeclaredExtensions();
- if (extensions != null)
- // Add all the fragment extensions to the plugin
- addExtensions(extensions, plugin);
-
- ExtensionPointModel[] points = fragment.getDeclaredExtensionPoints();
- if (points != null)
- // Add all the fragment extension points to the plugin
- addExtensionPoints(points, plugin);
-
- LibraryModel[] libraries = fragment.getRuntime();
- if (libraries != null)
- // Add all the fragment library entries to the plugin
- addLibraries(libraries, plugin);
-
- PluginPrerequisiteModel[] prerequisites = fragment.getRequires();
- if (prerequisites != null)
- // Add all the fragment prerequisites to the plugin
- addPrerequisites(prerequisites, plugin);
- }
-
- private void resolvePluginFragments(PluginDescriptorModel plugin) {
- /* For each fragment contained in the fragment list of this plugin,
- * apply all the fragment bits to the plugin (e.g. all of the fragment's
- * extensions are added to the list of extensions in the plugin). Be
- * sure to use only the latest version of any given fragment (in case
- * there are multiple versions of a given fragment id). So note that,
- * if there are multiple versions of a given fragment id, all but the
- * latest version will be discarded.
- */
-
- // The boolean 'dirty' will remain false if there is only one
- // version of every fragment id associated with this plugin
- boolean dirty = false;
-
- PluginFragmentModel[] fragmentList = plugin.getFragments();
- HashMap latestFragments = new HashMap(30);
- for (int i = 0; i < fragmentList.length; i++) {
- String fragmentId = fragmentList[i].getId();
- PluginFragmentModel latestVersion = (PluginFragmentModel) latestFragments.get(fragmentId);
- if (latestVersion == null) {
- // We don't have any fragments with this id yet
- latestFragments.put(fragmentId, fragmentList[i]);
- } else {
- dirty = true;
- if (getVersionIdentifier(fragmentList[i]).equals(getVersionIdentifier(latestVersion)))
- // ignore duplicates
- error(NLS.bind(Messages.parse_duplicateFragment, fragmentId, fragmentList[i].getVersion()));
- if (getVersionIdentifier(fragmentList[i]).isGreaterThan(getVersionIdentifier(latestVersion))) {
- latestFragments.put(fragmentId, fragmentList[i]);
- }
- }
- }
-
- // latestFragments now contains the latest version of each fragment
- // id for this plugin
-
- // Now add the latest version of each fragment to the plugin
- Set latestOnly = new HashSet();
- for (Iterator list = latestFragments.values().iterator(); list.hasNext();) {
- PluginFragmentModel latestFragment = (PluginFragmentModel) list.next();
- if (dirty)
- latestOnly.add(latestFragment);
- int numLibraries = latestFragment.getRuntime() == null ? 0 : latestFragment.getRuntime().length;
- resolvePluginFragment(latestFragment, plugin);
- // If this fragment added library entries, check to see if it
- // added a duplicate library entry.
- if (numLibraries != 0) {
- // Something got added
- LibraryModel[] libraries = plugin.getRuntime();
- // Put all the library names into a set as we know the set will not
- // have any duplicates.
- Set libNames = new HashSet();
- int setSize = libNames.size();
- for (int i = 0; i < libraries.length; i++) {
- libNames.add(libraries[i].getName());
- if (libNames.size() == setSize) {
- // We know this library name didn't get added to the set.
- // Ignore the duplicate but indicate an error
- String[] bindings = {latestFragment.getId(), plugin.getId(), libraries[i].getName()};
- error(NLS.bind(Messages.parse_duplicateLib, bindings));
- } else {
- setSize = libNames.size();
- }
- }
- }
- }
- // Currently the fragments on the plugin include all fragment
- // versions. Now strip off all but the latest version of each
- // fragment id (only if necessary).
- if (dirty)
- plugin.setFragments((PluginFragmentModel[]) latestOnly.toArray(new PluginFragmentModel[latestOnly.size()]));
-
- }
-
- private void resolvePluginRegistry() {
- // filter out disabled plugins from "live" registry
- if (trimPlugins)
- trimRegistry();
-
- // resolve relationships
- if (crossLink) {
- // cross link all of the extensions and extension points.
- PluginDescriptorModel[] plugins = reg.getPlugins();
- for (int i = 0; i < plugins.length; i++)
- resolvePluginDescriptor(plugins[i]);
- }
- }
-
- private boolean requiredPluginDescriptor(PluginDescriptorModel plugin) {
- boolean retValue = true;
- retValue = plugin.getName() != null && plugin.getId() != null && plugin.getVersion() != null;
- if (!retValue)
- return retValue;
-
- PluginPrerequisiteModel[] requiresList = plugin.getRequires();
- ExtensionModel[] extensions = plugin.getDeclaredExtensions();
- ExtensionPointModel[] extensionPoints = plugin.getDeclaredExtensionPoints();
- LibraryModel[] libraryList = plugin.getRuntime();
- PluginFragmentModel[] fragments = plugin.getFragments();
-
- if (requiresList != null) {
- for (int i = 0; i < requiresList.length && retValue; i++) {
- retValue = retValue && requiredPrerequisite(requiresList[i]);
- }
- }
- if (extensions != null) {
- for (int i = 0; i < extensions.length && retValue; i++) {
- retValue = retValue && requiredExtension(extensions[i]);
- }
- }
- if (extensionPoints != null) {
- for (int i = 0; i < extensionPoints.length && retValue; i++) {
- retValue = retValue && requiredExtensionPoint(extensionPoints[i]);
- }
- }
- if (libraryList != null) {
- for (int i = 0; i < libraryList.length && retValue; i++) {
- retValue = retValue && requiredLibrary(libraryList[i]);
- }
- }
- if (fragments != null) {
- for (int i = 0; i < fragments.length && retValue; i++) {
- retValue = retValue && requiredFragment(fragments[i]);
- }
- }
-
- return retValue;
- }
-
- private boolean requiredPrerequisite(PluginPrerequisiteModel prerequisite) {
- return ((prerequisite.getPlugin() != null));
- }
-
- private boolean requiredExtension(ExtensionModel extension) {
- return (extension.getExtensionPoint() != null);
- }
-
- private boolean requiredExtensionPoint(ExtensionPointModel extensionPoint) {
- return ((extensionPoint.getName() != null) && (extensionPoint.getId() != null));
- }
-
- private boolean requiredLibrary(LibraryModel library) {
- return (library.getName() != null);
- }
-
- private boolean requiredFragment(PluginFragmentModel fragment) {
- return ((fragment.getName() != null) && (fragment.getId() != null) && (fragment.getPlugin() != null) && (fragment.getPluginVersion() != null) && (fragment.getVersion() != null));
- }
-
- private List resolveRootDescriptors() {
-
- // Determine the roots of the dependency tree. Disable all
- // but one versions of the root descriptors.
-
- // get list of all plugin identifiers in the registry
- List ids = new ArrayList();
- ids.addAll(idmap.keySet());
-
- // ids is just a list of all the plugin id's
- // The following while loop will remove all id's that
- // appear in any prerequisite list.
-
- // iterate over the list eliminating targets of <requires> entries
- Iterator p = idmap.entrySet().iterator();
- while (p.hasNext()) {
- IndexEntry ix = (IndexEntry) ((Map.Entry) p.next()).getValue();
- if (ix != null) {
- List list = ix.versions();
- int ixSize = list.size();
- if (ixSize > 0) {
- // Remove any prerequisite mentioned in any version of this plugin
- for (int i = 0; i < ixSize; i++) {
- PluginDescriptorModel pd = (PluginDescriptorModel) list.get(i);
- PluginPrerequisiteModel[] prereqs = pd.getRequires();
- for (int j = 0; prereqs != null && j < prereqs.length; j++) {
- ids.remove(prereqs[j].getPlugin());
- }
- }
- }
- }
- }
-
- if (ids.size() > 0) {
- // disable all but the most recent version of root descriptors
- String id;
- p = ids.iterator();
- while (p.hasNext()) {
- id = (String) p.next();
- IndexEntry ix = (IndexEntry) idmap.get(id);
- if (ix != null) {
- List list = ix.versions();
- for (int i = 0; i < list.size(); i++) {
- PluginDescriptorModel pd = (PluginDescriptorModel) list.get(i);
- if (i == 0) {
- // Don't disable this one. It is the
- // one with the highest version number.
- if (DEBUG_RESOLVE)
- debug("root " + pd); //$NON-NLS-1$
- } else {
- // Disable all versions except the one with the
- // highest version number.
- if (DEBUG_RESOLVE)
- debug(" " + pd + " disabled"); //$NON-NLS-1$ //$NON-NLS-2$
- pd.setEnabled(false);
- }
- }
- }
- }
- } else {
- if (DEBUG_RESOLVE)
- debug("NO ROOTS"); //$NON-NLS-1$
- }
-
- return ids;
- }
-
- /**
- * Specifies whether extensions and extension points should be cross
- * linked during the resolve process.
- */
- public void setCrossLink(boolean value) {
- crossLink = value;
- }
-
- /**
- * Specified whether disabled plugins should to be removed when the resolve
- * is completed.
- */
- public void setTrimPlugins(boolean value) {
- trimPlugins = value;
- }
-
- private void trimRegistry() {
- PluginDescriptorModel[] list = reg.getPlugins();
- for (int i = 0; i < list.length; i++) {
- PluginDescriptorModel pd = (PluginDescriptorModel) list[i];
- if (!pd.getEnabled()) {
- if (DEBUG_RESOLVE)
- debug("removing " + pd.toString()); //$NON-NLS-1$
- reg.removePlugin(pd.getId(), pd.getVersion());
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ConfigurationElementModel.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ConfigurationElementModel.java
deleted file mode 100644
index 7fabe19..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ConfigurationElementModel.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.model;
-
-/**
- * An object which represents the user-defined contents of an extension in a
- * plug-in manifest.
- * <p>
- * This class may be instantiated, or further subclassed.
- * </p>
- * @deprecated In Eclipse 3.0 the runtime was refactored and all
- * non-essential elements removed. This class provides facilities primarily intended
- * for tooling. As such it has been removed and no directly substitutable API provided.
- */
-public class ConfigurationElementModel extends PluginModelObject {
-
- // DTD properties (included in plug-in manifest)
- private String value = null;
- private ConfigurationPropertyModel[] properties = null;
- private ConfigurationElementModel[] children = null;
-
- // transient properties (not included in plug-in manifest)
- private Object parent = null; // parent element or declaring extension
-
- /**
- * Creates a new configuration element model in which all fields are <code>null</code>.
- */
- public ConfigurationElementModel() {
- super();
- }
-
- /**
- * Returns the element which contains this element. If this element is an
- * immediate child of an extension, the returned value can be downcast to
- * <code>ExtensionModel</code>. Otherwise the returned value can be
- * downcast to <code>ConfigurationElementModel</code>.
- *
- * @return the parent of this configuration element or <code>null</code>
- */
- public Object getParent() {
- return parent;
- }
-
- /**
- * Returns the extension in which this configuration element is declared.
- * If this element is a top-level child of an extension, the returned value
- * is equivalent to <code>getParent</code>.
- *
- * @return the extension in which this configuration element is declared or
- * <code>null</code>
- */
- public ExtensionModel getParentExtension() {
- Object p = getParent();
- while (p != null && p instanceof ConfigurationElementModel)
- p = ((ConfigurationElementModel) p).getParent();
- return (ExtensionModel) p;
- }
-
- /**
- * Returns the properties associated with this element.
- *
- * @return the properties associated with this element or <code>null</code>
- */
- public ConfigurationPropertyModel[] getProperties() {
- return properties;
- }
-
- /**
- * Returns this element's sub-elements.
- *
- * @return the sub-elements of this element or <code>null</code>
- */
- public ConfigurationElementModel[] getSubElements() {
- return children;
- }
-
- /**
- * Returns the value of this element.
- *
- * @return the value of this element or <code>null</code>
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Returns the value of this element.
- *
- * @return the value of this element or <code>null</code>
- * @since 2.0
- */
- public String getValueAsIs() {
- return value;
- }
-
- /**
- * Sets this model object and all of its descendents to be read-only.
- * Subclasses may extend this implementation.
- *
- * @see #isReadOnly()
- */
- public void markReadOnly() {
- super.markReadOnly();
- if (children != null)
- for (int i = 0; i < children.length; i++)
- children[i].markReadOnly();
- if (properties != null)
- for (int i = 0; i < properties.length; i++)
- properties[i].markReadOnly();
- }
-
- /**
- * Optimization to replace a non-localized key with its localized value.
- * Avoids having to access resource bundles for further lookups.
- *
- * @param value the localized value of this model object
- */
- public void setLocalizedValue(String value) {
- this.value = value;
- }
-
- /**
- * Sets the parent of this element. The supplied parent is either an <code>ExtensionModel</code>,
- * if this element is to be a direct child of an extension, or another
- * <code>ConfigurationElement</code>. This object must not be read-only.
- *
- * @param value
- * the new parent of this element. May be <code>null</code>.
- */
- public void setParent(Object value) {
- assertIsWriteable();
- parent = value;
- }
-
- /**
- * Sets the properties associated with this element. This object must not
- * be read-only.
- *
- * @param value
- * the properties to associate with this element. May be <code>null</code>.
- */
- public void setProperties(ConfigurationPropertyModel[] value) {
- assertIsWriteable();
- properties = value;
- }
-
- /**
- * Sets configuration elements contained by this element This object must
- * not be read-only.
- *
- * @param value
- * the configuration elements to be associated with this
- * element. May be <code>null</code>.
- */
- public void setSubElements(ConfigurationElementModel[] value) {
- assertIsWriteable();
- children = value;
- }
-
- /**
- * Sets the value of this element. This object must not be read-only.
- *
- * @param value
- * the new value of this element. May be <code>null</code>.
- */
- public void setValue(String value) {
- assertIsWriteable();
- this.value = value;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ConfigurationPropertyModel.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ConfigurationPropertyModel.java
deleted file mode 100644
index 0864d47..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ConfigurationPropertyModel.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.model;
-
-/**
- * An object which represents the user-defined properties in a configuration
- * element of a plug-in manifest. Properties are <code>String</code> -based
- * key/value pairs.
- * <p>
- * This class may be instantiated, or further subclassed.
- * </p>
- * @deprecated In Eclipse 3.0 the runtime was refactored and all
- * non-essential elements removed. This class provides facilities primarily intended
- * for tooling. As such it has been removed and no directly substitutable API provided.
- */
-public class ConfigurationPropertyModel extends PluginModelObject {
-
- // DTD properties (included in plug-in manifest)
- private String value = null;
-
- /**
- * Creates a new configuration property model in which all fields are
- * <code>null</code>.
- */
- public ConfigurationPropertyModel() {
- super();
- }
-
- /**
- * Returns the value of this property.
- *
- * @return the value of this property or <code>null</code>
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Optimization to replace a non-localized key with its localized value.
- * Avoids having to access resource bundles for further lookups.
- *
- * @param value the localized value of this model object
- */
- public void setLocalizedValue(String value) {
- this.value = value;
- }
-
- /**
- * Sets the value of this property. This object must not be read-only.
- *
- * @param value the new value of this property. May be <code>null</code>.
- */
- public void setValue(String value) {
- assertIsWriteable();
- this.value = value;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ExtensionModel.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ExtensionModel.java
deleted file mode 100644
index 6e6286b..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ExtensionModel.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.model;
-
-/**
- * An object which represents the user-defined extension in a plug-in manifest.
- * <p>
- * This class may be instantiated, or further subclassed.
- * </p>
- * @deprecated In Eclipse 3.0 the runtime was refactored and all
- * non-essential elements removed. This class provides facilities primarily intended
- * for tooling. As such it has been removed and no directly substitutable API provided.
- */
-public class ExtensionModel extends PluginModelObject {
-
- // DTD properties (included in plug-in manifest)
- private String extensionPoint = null;
- private String id = null;
- private ConfigurationElementModel[] elements = null;
-
- // transient properties (not included in plug-in manifest)
- private PluginModel plugin = null; // declaring plugin
-
- /**
- * Creates a new extension model in which all fields are <code>null</code>.
- */
- public ExtensionModel() {
- super();
- }
-
- /**
- * Returns the extension point with which this extension is associated.
- *
- * @return the extension point with which this extension is associated or
- * <code>null</code>
- */
- public String getExtensionPoint() {
- return extensionPoint;
- }
-
- /**
- * Returns the simple identifier of this extension, or <code>null</code>
- * if this extension does not have an identifier. This identifier is
- * specified in the plug-in manifest as a non-empty string containing no
- * period characters (<code>'.'</code>) and must be unique within the
- * defining plug-in.
- *
- * @return the simple identifier of the extension (e.g. <code>"main"</code>)
- * or <code>null</code>
- */
- public String getId() {
- return id;
- }
-
- /**
- * Returns the plug-in model (descriptor or fragment) in which this
- * extension is declared.
- *
- * @return the plug-in model in which this extension is declared or <code>null</code>
- */
- public PluginModel getParent() {
- return plugin;
- }
-
- /**
- * Returns the plug-in descriptor in which this extension is declared.
- *
- * @return the plug-in descriptor in which this extension is declared or
- * <code>null</code>
- */
- public PluginDescriptorModel getParentPluginDescriptor() {
- return (PluginDescriptorModel) plugin;
- }
-
- /**
- * Returns the configuration element children of this extension.
- *
- * @return the configuration elements in this extension or <code>null</code>
- */
- public ConfigurationElementModel[] getSubElements() {
- return elements;
- }
-
- /**
- * Sets this model object and all of its descendents to be read-only.
- * Subclasses may extend this implementation.
- *
- * @see #isReadOnly()
- */
- public void markReadOnly() {
- super.markReadOnly();
- if (elements != null)
- for (int i = 0; i < elements.length; i++)
- elements[i].markReadOnly();
- }
-
- /**
- * Set the extension point with which this extension is associated. This
- * object must not be read-only.
- *
- * @param value the extension point with which this extension is associated. May
- * be <code>null</code>.
- */
- public void setExtensionPoint(String value) {
- assertIsWriteable();
- extensionPoint = value;
- }
-
- /**
- * Sets the simple identifier of this extension, or <code>null</code> if
- * this extension does not have an identifier. This identifier is specified
- * in the plug-in manifest as a non-empty string containing no period
- * characters (<code>'.'</code>) and must be unique within the defining
- * plug-in. This object must not be read-only.
- *
- * @param value
- * the simple identifier of the extension (e.g. <code>"main"</code>).
- * May be <code>null</code>.
- */
- public void setId(String value) {
- assertIsWriteable();
- id = value;
- }
-
- /**
- * Sets the plug-in model in which this extension is declared. This object
- * must not be read-only.
- *
- * @param value
- * the plug-in model in which this extension is declared. May be
- * <code>null</code>.
- */
- public void setParent(PluginModel value) {
- assertIsWriteable();
- plugin = value;
- }
-
- /**
- * Sets the plug-in descriptor in which this extension is declared. This
- * object must not be read-only.
- *
- * @param value
- * the plug-in descriptor in which this extension is declared.
- * May be <code>null</code>.
- */
- public void setParentPluginDescriptor(PluginDescriptorModel value) {
- assertIsWriteable();
- plugin = value;
- }
-
- /**
- * Sets the configuration element children of this extension. This object
- * must not be read-only.
- *
- * @param value
- * the configuration elements in this extension. May be <code>null</code>.
- */
- public void setSubElements(ConfigurationElementModel[] value) {
- assertIsWriteable();
- elements = value;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ExtensionPointModel.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ExtensionPointModel.java
deleted file mode 100644
index a9638ed..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/ExtensionPointModel.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.model;
-
-/**
- * An object which represents the user-defined extension point in a plug-in
- * manifest.
- * <p>
- * This class may be instantiated, or further subclassed.
- * </p>
- * @deprecated In Eclipse 3.0 the runtime was refactored and all
- * non-essential elements removed. This class provides facilities primarily intended
- * for tooling. As such it has been removed and no directly substitutable API provided.
- */
-public class ExtensionPointModel extends PluginModelObject {
-
- // DTD properties (included in plug-in manifest)
- private String id = null;
- private String schema = null;
-
- // transient properties (not included in plug-in manifest)
- private PluginModel plugin = null; // declaring plugin
- private ExtensionModel[] extensions = null; // configured extensions
-
- /**
- * Creates a new extension point model in which all fields are <code>null</code>.
- */
- public ExtensionPointModel() {
- super();
- }
-
- /**
- * Returns this extensions added to this extension point.
- *
- * @return the extensions in this extension point or <code>null</code>
- */
- public ExtensionModel[] getDeclaredExtensions() {
- return extensions;
- }
-
- /**
- * Returns the simple identifier of this extension point, or <code>null</code>
- * if this extension point does not have an identifier. This identifier is
- * specified in the plug-in manifest as a non-empty string containing no
- * period characters (<code>'.'</code>) and must be unique within the
- * defining plug-in.
- *
- * @return the simple identifier of the extension point (e.g. <code>"main"</code>)
- * or <code>null</code>
- */
- public String getId() {
- return id;
- }
-
- /**
- * Returns the plug-in model (descriptor or fragment) in which this
- * extension is declared.
- *
- * @return the plug-in model in which this extension is declared or <code>null</code>
- */
- public PluginModel getParent() {
- return plugin;
- }
-
- /**
- * Returns the plug-in descriptor in which this extension point is
- * declared.
- *
- * @return the plug-in descriptor in which this extension point is declared
- * or <code>null</code>
- */
- public PluginDescriptorModel getParentPluginDescriptor() {
- return (PluginDescriptorModel) plugin;
- }
-
- /**
- * Returns the schema specification for this extension point.
- *
- * @return the schema specification for this extension point or <code>null</code>
- */
- public String getSchema() {
- return schema;
- }
-
- /**
- * Sets this extensions added to this extension point. This object must not
- * be read-only.
- *
- * @param value the extensions in this extension point. May be <code>null</code>.
- */
- public void setDeclaredExtensions(ExtensionModel[] value) {
- assertIsWriteable();
- extensions = value;
- }
-
- /**
- * Sets the simple identifier of this extension point, or <code>null</code>
- * if this extension point does not have an identifier. This identifier is
- * specified in the plug-in manifest as a non-empty string containing no
- * period characters (<code>'.'</code>) and must be unique within the
- * defining plug-in. This object must not be read-only.
- *
- * @param value the simple identifier of the extension point (e.g. <code>"main"</code>).
- * May be <code>null</code>.
- */
- public void setId(String value) {
- assertIsWriteable();
- id = value;
- }
-
- /**
- * Sets the plug-in model in which this extension is declared. This object
- * must not be read-only.
- *
- * @param value the plug-in model in which this extension is declared. May be <code>null</code>.
- */
- public void setParent(PluginModel value) {
- assertIsWriteable();
- plugin = value;
- }
-
- /**
- * Sets the plug-in descriptor in which this extension point is declared.
- * This object must not be read-only.
- *
- * @param value the plug-in descriptor in which this extension point is declared.
- * May be <code>null</code>.
- */
- public void setParentPluginDescriptor(PluginDescriptorModel value) {
- assertIsWriteable();
- plugin = value;
- }
-
- /**
- * Sets the schema specification for this extension point. This object must
- * not be read-only.
- *
- * @param value the schema specification for this extension point. May be
- * <code>null</code>.
- */
- public void setSchema(String value) {
- assertIsWriteable();
- schema = value;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/Factory.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/Factory.java
deleted file mode 100644
index 8864c88..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/Factory.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.model;
-
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-
-/**
- * An object which can create plug-in related model objects (typically when
- * parsing plug-in manifest files).
- * <p>
- * This class may be instantiated, or further subclassed.
- * </p>
- * @deprecated In Eclipse 3.0 the runtime was refactored and all
- * non-essential elements removed. This class provides facilities primarily intended
- * for tooling. As such it has been removed and no directly substitutable API provided.
- */
-
-public class Factory {
- private MultiStatus status;
-
- /**
- * Creates a factory which can be used to create plug-in model objects.
- * Errors and warnings during parsing etc. can be logged to the given
- * status via the <code>error</code> method.
- *
- * @param status the status to which errors should be logged
- */
- public Factory(MultiStatus status) {
- super();
- this.status = status;
- }
-
- /**
- * Returns a new configuration element model which is not initialized.
- *
- * @return a new configuration element model
- */
- public ConfigurationElementModel createConfigurationElement() {
- return new ConfigurationElementModel();
- }
-
- /**
- * Returns a new configuration property model which is not initialized.
- *
- * @return a new configuration property model
- */
- public ConfigurationPropertyModel createConfigurationProperty() {
- return new ConfigurationPropertyModel();
- }
-
- /**
- * Returns a new extension model which is not initialized.
- *
- * @return a new extension model
- */
- public ExtensionModel createExtension() {
- return new ExtensionModel();
- }
-
- /**
- * Returns a new extension point model which is not initialized.
- *
- * @return a new extension point model
- */
- public ExtensionPointModel createExtensionPoint() {
- return new ExtensionPointModel();
- }
-
- /**
- * Returns a new library model which is initialized to not export any
- * of its code.
- *
- * @return a new library model
- */
- public LibraryModel createLibrary() {
- return new LibraryModel();
- }
-
- /**
- * Returns a new plug-in descriptor model which is not initialized.
- *
- * @return a new plug-in descriptor model
- */
- public PluginDescriptorModel createPluginDescriptor() {
- return new PluginDescriptorModel();
- }
-
- /**
- * Returns a new plug-in fragment model which is not initialized.
- *
- * @return a new plug-in fragment model
- */
- public PluginFragmentModel createPluginFragment() {
- return new PluginFragmentModel();
- }
-
- /**
- * Returns a new plug-in prerequisite model which is initialized to
- * not export its code and to not require an exact match.
- *
- * @return a new plug-in prerequisite model
- */
- public PluginPrerequisiteModel createPluginPrerequisite() {
- return new PluginPrerequisiteModel();
- }
-
- /**
- * Returns a new plug-in registry model with an empty plug-in table.
- *
- * @return a new plug-in registry model
- */
- public PluginRegistryModel createPluginRegistry() {
- return new PluginRegistryModel();
- }
-
- /**
- * Returns a new URL model which is not initialized.
- *
- * @return a new URL model
- */
- public URLModel createURL() {
- return new URLModel();
- }
-
- /**
- * Handles an error state specified by the status. The collection of all logged status
- * objects can be accessed using <code>getStatus()</code>.
- *
- * @param error a status detailing the error condition
- */
- public void error(IStatus error) {
- status.add(error);
- if (InternalPlatform.DEBUG)
- System.out.println(error.toString());
- }
-
- /**
- * Returns all of the status objects logged thus far by this factory.
- *
- * @return a multi-status containing all of the logged status objects
- */
- public MultiStatus getStatus() {
- return status;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/LibraryModel.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/LibraryModel.java
deleted file mode 100644
index 66d1def..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/LibraryModel.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.model;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.ILibrary;
-
-/**
- * A runtime library declared in a plug-in. Libraries contribute elements to the search path.
- * These contributions are specified as a path to a directory or Jar file. This path is always
- * considered to be relative to the containing plug-in.
- * <p>
- * Libraries are typed. The type is used to determine to which search path the library's
- * contribution should be added. The valid types are: <code>CODE</code> and
- * <code>RESOURCE</code>.
- * </p>
- * <p>
- * This class may be instantiated, or further subclassed.
- * </p>
- * @deprecated In Eclipse 3.0 the runtime was refactored and all
- * non-essential elements removed. This class provides facilities primarily intended
- * for tooling. As such it has been removed and no directly substitutable API provided.
- */
-public class LibraryModel extends PluginModelObject {
-
- // DTD properties (included in plug-in manifest)
- private String[] exports = null;
- private String type = CODE;
- private String[] packagePrefixes = null;
-
- // transient properties (not included in plug-in manifest)
- private boolean isExported = false;
- private boolean isFullyExported = false;
-
- /**
- * Constant string (value "code") indicating the code library type.
- */
- public static final String CODE = "code"; //$NON-NLS-1$
-
- /**
- * Constant string (value "resource") indicating the resource library type.
- */
- public static final String RESOURCE = "resource"; //$NON-NLS-1$
-
- /**
- * Creates a new library model in which all fields
- * are <code>null</code>.
- */
- public LibraryModel() {
- super();
- }
-
- /**
- * Returns this library's export mask.
- *
- * @return this library's export mask or <code>null</code>
- */
- public String[] getExports() {
- return exports;
- }
-
- /**
- * Returns this library's type.
- *
- * @return the type of this library. The valid types are: <code>CODE</code> and <code>RESOURCE</code>.
- * @see #CODE
- * @see #RESOURCE
- */
- public String getType() {
- return type;
- }
-
- /**
- * Returns whether or not any of the code in this library is exported.
- *
- * @return whether or not any of the code in this library represents is exported
- */
- public boolean isExported() {
- return isExported;
- }
-
- /**
- * Returns whether or not all of the code in this library is exported.
- *
- * @return whether or not all of the code in this library is exported
- */
- public boolean isFullyExported() {
- return isFullyExported;
- }
-
- /**
- * Sets this library's export mask.
- * This object must not be read-only.
- *
- * @param value this library's export mask. May be <code>null</code>.
- */
- public void setExports(String[] value) {
- assertIsWriteable();
- exports = value;
- if (value == null) {
- isExported = false;
- isFullyExported = false;
- } else {
- for (int i = 0; i < value.length; i++) {
- if (!value[i].equals("")) //$NON-NLS-1$
- isExported = true;
- if (value[i].equals("*")) //$NON-NLS-1$
- isFullyExported = true;
- }
- }
- }
-
- /**
- * Sets this library's type. The valid types are: <code>CODE</code> and <code>RESOURCE</code>.
- * The given type value is canonicalized before being set.
- * This object must not be read-only.
- *
- * @param value the type of this library.
- * @see #CODE
- * @see #RESOURCE
- */
- public void setType(String value) {
- assertIsWriteable();
- String lcValue = value.toLowerCase();
- Assert.isTrue(lcValue.equals(CODE) || lcValue.equals(RESOURCE));
- type = lcValue;
- }
-
- /**
- * @see ILibrary#getPackagePrefixes()
- */
- public String[] getPackagePrefixes() {
- return packagePrefixes;
- }
-
- /**
- * Sets this library's package prefixes to be the specified array or <code>null</code>.
- *
- * @param value the list of package prefixes for this library
- */
- public void setPackagePrefixes(String[] value) {
- packagePrefixes = value;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginDescriptorModel.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginDescriptorModel.java
deleted file mode 100644
index 5968a8b..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginDescriptorModel.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.model;
-
-/**
- * An object which represents the user-defined contents of a plug-in
- * in a plug-in manifest.
- * <p>
- * This class may be instantiated, or further subclassed.
- * </p>
- * @deprecated In Eclipse 3.0 the runtime was refactored and all
- * non-essential elements removed. This class provides facilities primarily intended
- * for tooling. As such it has been removed and no directly substitutable API provided.
- */
-public class PluginDescriptorModel extends PluginModel {
-
- // DTD properties (included in plug-in manifest)
- private String pluginClass = null;
-
- // transient properties (not included in plug-in manifest)
- private boolean enabled = true; // whether or not the plugin definition loaded ok
- private PluginFragmentModel[] fragments;
-
- /**
- * Creates a new plug-in descriptor model in which all fields
- * are <code>null</code>.
- */
- public PluginDescriptorModel() {
- super();
- }
-
- /**
- * Returns true if this plugin has all of it's prerequisites and is,
- * therefore enabled.
- *
- * @return whether or not this plug-in is fully resolved
- */
- public boolean getEnabled() {
- return enabled;
- }
-
- /**
- * Returns the fragments installed for this plug-in.
- *
- * @return this plug-in's fragments or <code>null</code>
- */
- public PluginFragmentModel[] getFragments() {
- return fragments;
- }
-
- /**
- * Returns the fully qualified name of the Java class which implements
- * the runtime support for this plug-in.
- *
- * @return the name of this plug-in's runtime class or <code>null</code>.
- */
- public String getPluginClass() {
- return pluginClass;
- }
-
- /**
- * Returns the unique identifier of the plug-in related to this model
- * or <code>null</code>.
- * This identifier is a non-empty string and is unique
- * within the plug-in registry.
- *
- * @return the unique identifier of the plug-in related to this model
- * (e.g. <code>"com.example"</code>) or <code>null</code>.
- */
- public String getPluginId() {
- return getId();
- }
-
- /**
- * Sets the value of the field 'enabled' to the parameter 'value'.
- * If this plugin is enabled (default) it is assumed to have all
- * of it's prerequisites.
- *
- * @param value set to false if this plugin should be disabled and
- * true otherwise.
- */
- public void setEnabled(boolean value) {
- enabled = value;
- }
-
- /**
- * Sets the list of fragments for this plug-in.
- * This object must not be read-only.
- *
- * @param value the fragments for this plug-in. May be <code>null</code>.
- */
- public void setFragments(PluginFragmentModel[] value) {
- assertIsWriteable();
- fragments = value;
- }
-
- /**
- * Sets the fully qualified name of the Java class which implements
- * the runtime support for this plug-in.
- * This object must not be read-only.
- *
- * @param value the name of this plug-in's runtime class.
- * May be <code>null</code>.
- */
- public void setPluginClass(String value) {
- assertIsWriteable();
- pluginClass = value;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginFragmentModel.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginFragmentModel.java
deleted file mode 100644
index 5415f45..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginFragmentModel.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.model;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.PluginVersionIdentifier;
-
-/**
- * An object which represents the user-defined contents of a plug-in fragment
- * in a plug-in manifest.
- * <p>
- * This class may be instantiated, or further subclassed.
- * </p>
- * @deprecated In Eclipse 3.0 the runtime was refactored and all
- * non-essential elements removed. This class provides facilities primarily intended
- * for tooling. As such it has been removed and no directly substitutable API provided.
- */
-public class PluginFragmentModel extends PluginModel {
-
- public static final byte FRAGMENT_MATCH_UNSPECIFIED = 0;
- public static final byte FRAGMENT_MATCH_PERFECT = 1;
- public static final byte FRAGMENT_MATCH_EQUIVALENT = 2;
- public static final byte FRAGMENT_MATCH_COMPATIBLE = 3;
- public static final byte FRAGMENT_MATCH_GREATER_OR_EQUAL = 4;
-
- // DTD properties (included in plug-in manifest)
- private String plugin = null;
- private String pluginVersion = null;
- private byte pluginMatch = FRAGMENT_MATCH_UNSPECIFIED;
-
- /**
- * Creates a new plug-in descriptor model in which all fields
- * are <code>null</code>.
- */
- public PluginFragmentModel() {
- super();
- }
-
- /**
- * Returns a byte code indicating the type of match this fragment requires
- * when trying to find its associated plugin.
- * The byte code can be any one of the following:
- * FRAGMENT_MATCH_UNSPECIFIED initial value
- * FRAGMENT_MATCH_PERFECT perfectly equal match
- * FRAGMENT_MATCH_EQUIVALENT equivalent match
- * FRAGMENT_MATCH_COMPATIBLE compatible match
- * FRAGMENT_MATCH_GREATER_OR_EQUAL greater than or equal to match
- *
- * @return a byte code indicating the type of match this fragment requires
- * @since 2.0
- */
- public byte getMatch() {
- return pluginMatch;
- }
-
- /**
- * Returns the fully qualified name of the plug-in for which this is a fragment
- *
- * @return the name of this fragment's plug-in or <code>null</code>.
- */
- public String getPlugin() {
- return plugin;
- }
-
- /**
- * Returns the unique identifier of the plug-in related to this model
- * or <code>null</code>.
- * This identifier is a non-empty string and is unique
- * within the plug-in registry.
- *
- * @return the unique identifier of the plug-in related to this model
- * (e.g. <code>"com.example"</code>) or <code>null</code>.
- */
- public String getPluginId() {
- return getPlugin();
- }
-
- /**
- * Returns the version name of the plug-in for which this is a fragment.
- *
- * @return the version name of this fragment's plug-in or <code>null</code>
- */
- public String getPluginVersion() {
- return pluginVersion;
- }
-
- /**
- * Sets the type of match this fragment requires when trying to
- * find its associated plugin. The value parameter may be any
- * one of the following:
- * FRAGMENT_MATCH_UNSPECIFIED initial value
- * FRAGMENT_MATCH_PERFECT perfectly equal match
- * FRAGMENT_MATCH_EQUIVALENT equivalent match
- * FRAGMENT_MATCH_COMPATIBLE compatible match
- * FRAGMENT_MATCH_GREATER_OR_EQUAL greater than or equal to match
- * This object must not be read-only.
- *
- * @param value the type of match required with the associated plugin
- * @since 2.0
- */
- public void setMatch(byte value) {
- assertIsWriteable();
- Assert.isTrue((value == FRAGMENT_MATCH_PERFECT) || (value == FRAGMENT_MATCH_EQUIVALENT) || (value == FRAGMENT_MATCH_COMPATIBLE) || (value == FRAGMENT_MATCH_GREATER_OR_EQUAL));
- pluginMatch = value;
- }
-
- /**
- * Sets the fully qualified name of the plug-in for which this is a fragment
- * This object must not be read-only.
- *
- * @param value the name of this fragment's plug-in.
- * May be <code>null</code>.
- */
- public void setPlugin(String value) {
- assertIsWriteable();
- plugin = value;
- }
-
- /**
- * Sets the version name of the plug-in for which this is a fragment.
- * The given version number is canonicalized.
- * This object must not be read-only.
- *
- * @param value the version name of this fragment's plug-in.
- * May be <code>null</code>.
- */
- public void setPluginVersion(String value) {
- assertIsWriteable();
- pluginVersion = new PluginVersionIdentifier(value).toString();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginModel.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginModel.java
deleted file mode 100644
index 8a9c357..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginModel.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.model;
-
-import org.eclipse.core.runtime.PluginVersionIdentifier;
-
-/**
- * An object which represents the user-defined contents of a plug-in model
- * (either a descriptor or a fragment) in a plug-in manifest.
- * <p>
- * This class may not be instantiated, but may be further subclassed.
- * </p>
- * @deprecated In Eclipse 3.0 the runtime was refactored and all
- * non-essential elements removed. This class provides facilities primarily intended
- * for tooling. As such it has been removed and no directly substitutable API provided.
- */
-public abstract class PluginModel extends PluginModelObject {
-
- /**
- * Manifest schema version. The version number is canonicalized.
- * May be <code>null</code>.
- *
- * @since 3.0
- */
- private String schemaVersion = null;
-
- // DTD properties (included in plug-in manifest)
- private String id = null;
- private String providerName = null;
- private String version = null;
- private LibraryModel[] runtime = null;
- private ExtensionPointModel[] extensionPoints = null;
- private ExtensionModel[] extensions = null;
- private PluginPrerequisiteModel[] requires = null;
-
- // transient properties (not included in plug-in manifest)
- private PluginRegistryModel registry = null;
- private String location = null;
-
- /**
- * Creates a new plug-in descriptor model in which all fields
- * are <code>null</code>.
- */
- public PluginModel() {
- super();
- }
-
- /**
- * Returns the extension points in this plug-in descriptor.
- *
- * @return the extension points in this plug-in descriptor or <code>null</code>
- */
- public ExtensionPointModel[] getDeclaredExtensionPoints() {
- return extensionPoints;
- }
-
- /**
- * Returns the extensions in this plug-in descriptor.
- *
- * @return the extensions in this plug-in descriptor or <code>null</code>
- */
- public ExtensionModel[] getDeclaredExtensions() {
- return extensions;
- }
-
- /**
- * Returns the unique identifier of this plug-in model
- * or <code>null</code>.
- * This identifier is a non-empty string and is unique
- * within the plug-in registry.
- *
- * @return the unique identifier of this plugin model
- * (e.g. <code>"com.example"</code>) or <code>null</code>.
- */
- public String getId() {
- return id;
- }
-
- /**
- * Returns the location of the plug-in corresponding to this plug-in
- * descriptor. The location is in the form of a URL.
- *
- * @return the location of this plug-in descriptor or <code>null</code>.
- */
- public String getLocation() {
- return location;
- }
-
- /**
- * Returns the unique identifier of the plug-in related to this model
- * or <code>null</code>.
- * This identifier is a non-empty string and is unique
- * within the plug-in registry.
- *
- * @return the unique identifier of the plug-in related to this model
- * (e.g. <code>"com.example"</code>) or <code>null</code>.
- */
- public abstract String getPluginId();
-
- /**
- * Returns the name of the provider who authored this plug-in.
- *
- * @return name of the provider who authored this plug-in or <code>null</code>
- */
- public String getProviderName() {
- return providerName;
- }
-
- /**
- * Returns the plug-in registry of which this plug-in descriptor is a member.
- *
- * @return the registry in which this descriptor has been installed or
- * <code>null</code> if none.
- */
- public PluginRegistryModel getRegistry() {
- return registry;
- }
-
- /**
- * Returns the prerequisites of this plug-in.
- *
- * @return the prerequisites of this plug-in or <code>null</code>
- */
- public PluginPrerequisiteModel[] getRequires() {
- return requires;
- }
-
- /**
- * Returns the libraries configured for this plug-in.
- *
- * @return the libraries configured for this plug-in or <code>null</code>
- */
- public LibraryModel[] getRuntime() {
- return runtime;
- }
-
- /**
- * Returns the version name of this plug-in.
- *
- * @return the version name of this plug-in or <code>null</code>
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * Sets this model object and all of its descendents to be read-only.
- * Subclasses may extend this implementation.
- *
- * @see #isReadOnly()
- */
- public void markReadOnly() {
- super.markReadOnly();
- if (runtime != null)
- for (int i = 0; i < runtime.length; i++)
- runtime[i].markReadOnly();
- if (extensionPoints != null)
- for (int i = 0; i < extensionPoints.length; i++)
- extensionPoints[i].markReadOnly();
- if (extensions != null)
- for (int i = 0; i < extensions.length; i++)
- extensions[i].markReadOnly();
- if (requires != null)
- for (int i = 0; i < requires.length; i++)
- requires[i].markReadOnly();
- }
-
- /**
- * Sets the extension points in this plug-in descriptor.
- * This object must not be read-only.
- *
- * @param value the extension points in this plug-in descriptor.
- * May be <code>null</code>.
- */
- public void setDeclaredExtensionPoints(ExtensionPointModel[] value) {
- assertIsWriteable();
- extensionPoints = value;
- }
-
- /**
- * Sets the extensions in this plug-in descriptor.
- * This object must not be read-only.
- *
- * @param value the extensions in this plug-in descriptor.
- * May be <code>null</code>.
- */
- public void setDeclaredExtensions(ExtensionModel[] value) {
- assertIsWriteable();
- extensions = value;
- }
-
- /**
- * Sets the unique identifier of this plug-in model.
- * The identifier is a non-empty string and is unique
- * within the plug-in registry.
- * This object must not be read-only.
- *
- * @param value the unique identifier of the plug-in model (e.g. <code>"com.example"</code>).
- * May be <code>null</code>.
- */
- public void setId(String value) {
- assertIsWriteable();
- id = value;
- }
-
- /**
- * Optimization to replace a non-localized key with its localized value. Avoids having
- * to access resource bundles for further lookups.
- *
- * @param value the localized provider name for this model object
- */
- public void setLocalizedProviderName(String value) {
- providerName = value;
- }
-
- /**
- * Sets the location of the plug-in manifest file (e.g., <code>plugin.xml</code>)
- * which corresponds to this plug-in descriptor. The location is in the
- * form of a URL.
- * This object must not be read-only.
- *
- * @param value the location of this plug-in descriptor. May be <code>null</code>.
- */
- public void setLocation(String value) {
- assertIsWriteable();
- location = value;
- }
-
- /**
- * Sets the name of the provider who authored this plug-in.
- * This object must not be read-only.
- *
- * @param value name of the provider who authored this plug-in.
- * May be <code>null</code>.
- */
- public void setProviderName(String value) {
- assertIsWriteable();
- providerName = value;
- }
-
- /**
- * Sets the registry with which this plug-in descriptor is associated.
- * This object must not be read-only.
- *
- * @param value the registry with which this plug-in is associated.
- * May be <code>null</code>.
- */
- public void setRegistry(PluginRegistryModel value) {
- assertIsWriteable();
- registry = value;
- }
-
- /**
- * Sets the prerequisites of this plug-in.
- * This object must not be read-only.
- *
- * @param value the prerequisites of this plug-in. May be <code>null</code>.
- */
- public void setRequires(PluginPrerequisiteModel[] value) {
- assertIsWriteable();
- requires = value;
- }
-
- /**
- * Sets the libraries configured for this plug-in.
- * This object must not be read-only.
- *
- * @param value the libraries configured for this plug-in. May be <code>null</code>.
- */
- public void setRuntime(LibraryModel[] value) {
- assertIsWriteable();
- runtime = value;
- }
-
- /**
- * Sets the version name of this plug-in. The version number
- * is canonicalized.
- * This object must not be read-only.
- *
- * @param value the version name of this plug-in.
- * May be <code>null</code>.
- */
- public void setVersion(String value) {
- assertIsWriteable();
- version = new PluginVersionIdentifier(value).toString();
- }
-
- /**
- * Returns the manifest schema version of this plug-in. The version number is
- * canonicalized.
- * <p>
- * The manifest schema version indicates which shape of plug-in manifest this is.
- * This was introduced in 3.0; plug-ins created prior to then did not explicitly
- * declare a manifest schema version.
- * </p>
- *
- * @return the manifest schema version of this plug-in.
- * May be <code>null</code>.
- * @since 3.0
- */
- public String getSchemaVersion() {
- return schemaVersion;
- }
-
- /**
- * Sets the manifest schema version of this plug-in. The version number is
- * canonicalized. This object must not be read-only.
- * <p>
- * The manifest schema version indicates which shape of plug-in manifest this is.
- * This was introduced in 3.0; plug-ins created prior to then did not explicitly
- * declare a manifest schema version.
- * </p>
- *
- * @param value the manifest schema version of this plug-in.
- * May be <code>null</code>.
- * @since 3.0
- */
- public void setSchemaVersion(String value) {
- assertIsWriteable();
- if (value == null)
- schemaVersion = null;
- else
- schemaVersion = new PluginVersionIdentifier(value).toString();
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginModelObject.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginModelObject.java
deleted file mode 100644
index ce77a90..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginModelObject.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.model;
-
-import org.eclipse.core.runtime.Assert;
-
-/**
- * An object which has the general characteristics of all elements
- * in a plug-in manifest.
- * <p>
- * This class may be subclassed.
- * </p>
- * @deprecated In Eclipse 3.0 the runtime was refactored and all
- * non-essential elements removed. This class provides facilities primarily intended
- * for tooling. As such it has been removed and no directly substitutable API provided.
- */
-
-public abstract class PluginModelObject {
-
- // DTD properties (included in plug-in manifest)
- private String name = null;
-
- // transient properties (not included in plug-in manifest)
- private int flags = 0;
- // the last bit is a read-only flag
- // IMPORTANT: One bit in the "flags" integer is used to store the
- // read-only flag and the other bits are used to store an integer value
- // which can be from -1 to (2**31) - 1. To help with the bit masking, the integer
- // value stored in "flags" is (value + 1). This means that a "flags" value
- // of 0 will NOT be marked as read-only and will return -1 for the start line value.
- static final int M_READ_ONLY = 0x80000000;
-
- /**
- * Checks that this model object is writeable. A runtime exception
- * is thrown if it is not.
- */
- protected void assertIsWriteable() {
- Assert.isTrue(!isReadOnly(), "Model is read-only"); //$NON-NLS-1$
- }
-
- /**
- * Returns the name of this element.
- *
- * @return the name of this element or <code>null</code>
- */
- public String getName() {
- return name;
- }
-
- /**
- * Return the line number for the start tag for this plug-in object. This
- * is the line number of the element declaration from the plug-in manifest file.
- *
- * @return the line number of the start tag for this object
- */
- public int getStartLine() {
- return (flags & ~M_READ_ONLY) - 1;
- }
-
- /**
- * Returns whether or not this model object is read-only.
- *
- * @return <code>true</code> if this model object is read-only,
- * <code>false</code> otherwise
- * @see #markReadOnly()
- */
- public boolean isReadOnly() {
- return (flags & M_READ_ONLY) == M_READ_ONLY;
- }
-
- /**
- * Sets this model object and all of its descendents to be read-only.
- * Subclasses may extend this implementation.
- *
- * @see #isReadOnly()
- */
- public void markReadOnly() {
- flags |= M_READ_ONLY;
- }
-
- /**
- * Optimization to replace a non-localized key with its localized value. Avoids having
- * to access resource bundles for further lookups.
- *
- * @param value the localized name of this model object
- */
- public void setLocalizedName(String value) {
- name = value;
- }
-
- /**
- * Sets the name of this element.
- *
- * @param value the new name of this element. May be <code>null</code>.
- */
- public void setName(String value) {
- assertIsWriteable();
- name = value;
- }
-
- /**
- * Set the line number for the start tag for this plug-in object. This is the
- * line number for the element declaration from the plug-in manifest file.
- * This value can only be set once, subsequent calls to this method will be
- * ignored.
- *
- * @param lineNumber the line number of this object's declaration in the file
- */
- public void setStartLine(int lineNumber) {
- if (getStartLine() == -1)
- flags = (lineNumber + 1) | (flags & M_READ_ONLY);
- }
-
- /**
- * Return a string representation of this object. This value is not to be relied
- * on and can change at any time. To be used for debugging purposes only.
- *
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return this.getClass() + "(" + getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginPrerequisiteModel.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginPrerequisiteModel.java
deleted file mode 100644
index 3d27b91..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginPrerequisiteModel.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.model;
-
-import org.eclipse.core.runtime.Assert;
-
-/**
- * An object which represents the relationship between a plug-in and a
- * prerequisite plug-in in the dependent's plug-in manifest.
- * <p>
- * This class may be instantiated, or further subclassed.
- * </p>
- * @deprecated In Eclipse 3.0 the runtime was refactored and all
- * non-essential elements removed. This class provides facilities primarily intended
- * for tooling. As such it has been removed and no directly substitutable API provided.
- */
-public class PluginPrerequisiteModel extends PluginModelObject {
-
- public static final byte PREREQ_MATCH_UNSPECIFIED = 0;
- public static final byte PREREQ_MATCH_PERFECT = 1;
- public static final byte PREREQ_MATCH_EQUIVALENT = 2;
- public static final byte PREREQ_MATCH_COMPATIBLE = 3;
- public static final byte PREREQ_MATCH_GREATER_OR_EQUAL = 4;
-
- // DTD properties (included in plug-in manifest)
- private String plugin = null;
- private String version = null;
- private byte match = PREREQ_MATCH_UNSPECIFIED;
- private boolean export = false;
- private String resolvedVersion = null;
- private boolean optional = false;
-
- /**
- * Creates a new plug-in prerequisite model in which all fields
- * are <code>null</code>.
- */
- public PluginPrerequisiteModel() {
- super();
- }
-
- /**
- * Returns whether or not the code in this pre-requisite is exported.
- *
- * @return whether or not the code in this pre-requisite is exported
- */
- public boolean getExport() {
- return export;
- }
-
- /**
- * Returns whether or not this pre-requisite requires an exact match.
- *
- * @return whether or not this pre-requisite requires an exact match
- * @deprecated - use getMatchByte
- */
- public boolean getMatch() {
- return (match == PREREQ_MATCH_EQUIVALENT);
- }
-
- /**
- * Returns a byte code indicating the type of match this pre-requisite requires.
- * The byte code can be any one of the following:
- * PREREQ_MATCH_UNSPECIFIED initial value
- * PREREQ_MATCH_PERFECT perfectly equal match
- * PREREQ_MATCH_EQUIVALENT equivalent match
- * PREREQ_MATCH_COMPATIBLE compatible match
- * PREREQ_MATCH_GREATER_OR_EQUAL greater than or equal to match
- *
- * @return a byte code indicating the type of match this pre-requisite requires
- * @since 2.0
- */
- public byte getMatchByte() {
- return match;
- }
-
- /**
- * Returns whether this pre-requisite is optional.
- *
- * @return whether this pre-requisite is optional
- */
- public boolean getOptional() {
- return optional;
- }
-
- /**
- * Returns the plug-in identifier of the prerequisite plug-in.
- *
- * @return the plug-in identifier or <code>null</code>
- */
- public String getPlugin() {
- return plugin;
- }
-
- /**
- * Returns the resolved version of the prerequisite plug-in. The
- * returned value is in the format specified by <code>PluginVersionIdentifier</code>.
- *
- * @return the version of the prerequisite plug-in
- * @see org.eclipse.core.runtime.PluginVersionIdentifier
- */
- public String getResolvedVersion() {
- return resolvedVersion;
- }
-
- /**
- * Returns the version name of this plug-in.
- *
- * @return the version name of this plug-in or <code>null</code>
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * Sets whether or not the code in this pre-requisite is exported.
- * This object must not be read-only.
- *
- * @param value whether or not the code in this pre-requisite is exported
- */
- public void setExport(boolean value) {
- assertIsWriteable();
- export = value;
- }
-
- /**
- * Sets whether or not this pre-requisite requires an exact match.
- * This object must not be read-only.
- *
- * @param value whether or not this pre-requisite requires an exact match
- * @deprecated use setMatchByte
- */
- public void setMatch(boolean value) {
- assertIsWriteable();
- if (value) {
- setMatchByte(PREREQ_MATCH_EQUIVALENT);
- } else {
- setMatchByte(PREREQ_MATCH_COMPATIBLE);
- }
- }
-
- /**
- * Sets whether or not this pre-requisite requires an exact match.
- * This object must not be read-only.
- *
- * @param value whether or not this pre-requisite requires an exact match
- * @since 2.0
- */
- public void setMatchByte(byte value) {
- assertIsWriteable();
- Assert.isTrue((value == PREREQ_MATCH_PERFECT) || (value == PREREQ_MATCH_EQUIVALENT) || (value == PREREQ_MATCH_COMPATIBLE) || (value == PREREQ_MATCH_GREATER_OR_EQUAL));
- match = value;
- }
-
- /**
- * Sets whether this pre-requisite is optional.
- * This object must not be read-only.
- *
- * @param value whether this pre-requisite is optional
- */
- public void setOptional(boolean value) {
- assertIsWriteable();
- optional = value;
- }
-
- /**
- * Sets the plug-in identifier of this prerequisite plug-in.
- * This object must not be read-only.
- *
- * @param value the prerequisite plug-in identifier. May be <code>null</code>.
- */
- public void setPlugin(String value) {
- assertIsWriteable();
- plugin = value;
- }
-
- /**
- * Sets the resolved version of the prerequisite plug-in. The
- * given value is in the format specified by <code>PluginVersionIdentifier</code>.
- *
- * @param value the version of the prerequisite plug-in
- * @see org.eclipse.core.runtime.PluginVersionIdentifier
- */
- public void setResolvedVersion(String value) {
- assertIsWriteable();
- resolvedVersion = value;
- }
-
- /**
- * Sets the version name of this plug-in prerequisite.
- * This object must not be read-only.
- *
- * @param value the version name of this plug-in prerequisite.
- * May be <code>null</code>.
- */
- public void setVersion(String value) {
- assertIsWriteable();
- version = value;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginRegistryModel.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginRegistryModel.java
deleted file mode 100644
index ece0de9..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/PluginRegistryModel.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.model;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.List;
-import org.eclipse.core.internal.model.PluginMap;
-import org.eclipse.core.internal.model.RegistryResolver;
-import org.eclipse.core.internal.plugins.InternalPlatform;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * A container for a collection of plug-in descriptors.
- * <p>
- * This class may be instantiated, or further subclassed.
- * </p>
- * @deprecated In Eclipse 3.0 the runtime was refactored and all
- * non-essential elements removed. This class provides facilities primarily intended
- * for tooling. As such it has been removed and no directly substitutable API provided.
- */
-public class PluginRegistryModel {
-
- // transient properties (not included in plug-in manifest)
- protected PluginMap plugins = new PluginMap(new HashMap(30), false, true);
- protected PluginMap fragments = new PluginMap(new HashMap(30), false, true);
- private boolean readOnly = false;
- private boolean resolved = false;
-
- /**
- * Creates a new plug-in registry model which contains no plug-ins.
- */
- public PluginRegistryModel() {
- super();
- }
-
- /**
- * Adds the specified plug-in fragment to this registry. An existing fragment
- * with the same unique id and version is replaced by the new
- * value.
- *
- * @param fragment the plug-in fragment to add
- */
- public void addFragment(PluginFragmentModel fragment) {
- assertIsWriteable();
- fragments.add(fragment);
- }
-
- /**
- * Adds the specified plug-in to this registry. An existing plug-in
- * with the same unique id and version is replaced by the new
- * value.
- *
- * @param plugin the plug-in descriptor to add
- */
- public void addPlugin(PluginDescriptorModel plugin) {
- assertIsWriteable();
- plugins.add(plugin);
- }
-
- /**
- * Checks that this model object is writeable. A runtime exception
- * is thrown if it is not.
- */
- protected void assertIsWriteable() {
- Assert.isTrue(!isReadOnly(), "Model is read-only"); //$NON-NLS-1$
- }
-
- /**
- * Returns the plug-in fragment with the given identifier
- * in this plug-in registry, or <code>null</code> if there is no such
- * fragment. If there are multiple versions of the identified fragment,
- * one will be non-deterministically chosen and returned.
- *
- * @param id the unique identifier of the plug-in fragment
- * (e.g. <code>"com.example.acme"</code>).
- * @return the plug-in fragment, or <code>null</code>
- */
- public PluginFragmentModel getFragment(String id) {
- return (PluginFragmentModel) fragments.getAny(id);
- }
-
- /**
- * Returns the identified plug-in fragment or <code>null</code> if
- * the fragment does not exist.
- *
- * @param id the unique identifier of the plug-in fragment
- * @param version fragment version identifier. If <code>null</code> is
- * specified, a non-deterministically chosen version of the identified fragment
- * (if any) will be returned
- * @return the matching fragment in this registry, or <code>null</code>
- */
- public PluginFragmentModel getFragment(String id, String version) {
- return (PluginFragmentModel) fragments.get(id, version);
- }
-
- /**
- * Returns the list of plug-in fragments managed by this registry.
- *
- * @return the fragments in this registry
- */
- public PluginFragmentModel[] getFragments() {
- PluginFragmentModel[] result = new PluginFragmentModel[fragments.size()];
- fragments.copyToArray(result);
- return result;
- }
-
- /**
- * Returns all versions of the identified plug-in fragment
- * known to this plug-in registry.
- * Returns an empty array if there are no fragments
- * with the specified identifier.
- *
- * @param id the unique identifier of the plug-in fragment
- * (e.g. <code>"org.eclipse.core.resources"</code>).
- * @return the fragments known to this plug-in registry with the given id
- */
- public PluginFragmentModel[] getFragments(String id) {
- List versions = fragments.getVersions(id);
- if (versions == null || versions.isEmpty())
- return new PluginFragmentModel[0];
- return (PluginFragmentModel[]) versions.toArray(new PluginFragmentModel[versions.size()]);
- }
-
- /**
- * Returns the plug-in descriptor with the given plug-in identifier
- * in this plug-in registry, or <code>null</code> if there is no such
- * plug-in. If there are multiple versions of the identified plug-in,
- * one will be non-deterministically chosen and returned.
- *
- * @param pluginId the unique identifier of the plug-in
- * (e.g. <code>"com.example.acme"</code>).
- * @return the plug-in descriptor, or <code>null</code>
- */
- public PluginDescriptorModel getPlugin(String pluginId) {
- return (PluginDescriptorModel) plugins.getAny(pluginId);
- }
-
- /**
- * Returns the identified plug-in or <code>null</code> if
- * the plug-in does not exist.
- *
- * @param pluginId the unique identifier of the plug-in
- * (e.g. <code>"org.eclipse.core.resources"</code>)
- * @param version plug-in version identifier. If <code>null</code> is specified,
- * a non-deterministically chosen version of the identified plug-in (if any)
- * will be returned
- * @return the matching plug-in in this registry or <code>null</code>
- */
- public PluginDescriptorModel getPlugin(String pluginId, String version) {
- PluginDescriptorModel[] list = getPlugins(pluginId);
- if (list == null || list.length == 0)
- return null;
- if (version == null)
- // Just return the first one in the list (random)
- return list[0];
-
- for (int i = 0; i < list.length; i++) {
- PluginDescriptorModel element = list[i];
- if (element.getVersion().equals(version))
- return element;
- }
- return null;
- }
-
- /**
- * Returns the list of plug-ins managed by this registry.
- *
- * @return the plug-ins in this registry
- */
- public PluginDescriptorModel[] getPlugins() {
- PluginDescriptorModel[] result = new PluginDescriptorModel[plugins.size()];
- plugins.copyToArray(result);
- return result;
- }
-
- /**
- * Returns all versions of the identified plug-in descriptor
- * known to this plug-in registry.
- * Returns an empty array if there are no plug-ins
- * with the specified identifier.
- *
- * @param pluginId the unique identifier of the plug-in
- * (e.g. <code>"org.eclipse.core.resources"</code>).
- * @return the plug-in descriptors known to this plug-in registry
- */
- public PluginDescriptorModel[] getPlugins(String pluginId) {
- List versions = plugins.getVersions(pluginId);
- if (versions == null || versions.isEmpty())
- return new PluginDescriptorModel[0];
- return (PluginDescriptorModel[]) versions.toArray(new PluginDescriptorModel[versions.size()]);
-
- }
-
- /**
- * Returns whether or not this model object is read-only.
- *
- * @return <code>true</code> if this model object is read-only,
- * <code>false</code> otherwise
- * @see #markReadOnly()
- */
- public boolean isReadOnly() {
- return readOnly;
- }
-
- /**
- * Returns whether or not this model object has been resolved.
- *
- * @return <code>true</code> if this model object has been resolved,
- * <code>false</code> otherwise
- */
- public boolean isResolved() {
- return resolved;
- }
-
- /**
- * Sets this model object and all of its descendents to be read-only.
- * Subclasses may extend this implementation.
- *
- * @see #isReadOnly()
- */
- public void markReadOnly() {
- readOnly = true;
- plugins.markReadOnly();
- fragments.markReadOnly();
- }
-
- /**
- * Sets this model object to be resolved.
- */
- public void markResolved() {
- resolved = true;
- }
-
- /**
- * Removes the fragment with id and version if it exists in this registry.
- * This method has no effect if a fragment with the given id and version
- * cannot be found.
- *
- * @param id the unique identifier of the fragment to remove
- * @param version the version of the fragment to remove
- */
- public void removeFragment(String id, String version) {
- assertIsWriteable();
- fragments.remove(id, version);
- }
-
- /**
- * Removes all versions of the identified plug-in fragment from this registry.
- * This method has no effect if such a fragment cannot be found.
- *
- * @param id the unique identifier of the fragments to remove
- */
- public void removeFragments(String id) {
- assertIsWriteable();
- fragments.removeVersions(id);
- }
-
- /**
- * Removes the plug-in with id and version if it exists in this registry.
- * This method has no effect if a plug-in with the given id and version
- * cannot be found.
- *
- * @param pluginId the unique identifier of the plug-in to remove
- * @param version the version of the plug-in to remove
- */
- public void removePlugin(String pluginId, String version) {
- assertIsWriteable();
- plugins.remove(pluginId, version);
- }
-
- /**
- * Removes all versions of the given plug-in from this registry.
- * This method has no effect if such a plug-in cannot be found.
- *
- * @param pluginId the unique identifier of the plug-ins to remove
- */
- public void removePlugins(String pluginId) {
- assertIsWriteable();
- plugins.removeVersions(pluginId);
- }
-
- /**
- * Runs a resolve through the entire registry. This resolve will
- * mark any PluginDescriptorModels which do not have access to all
- * of their prerequisites as disabled. Prerequisites which cause
- * cyclical dependencies will be marked as disabled.
- * <p>
- * If the parameter trimDisabledPlugins is set to true, all PluginDescriptorModels
- * which are labelled as disabled will be removed from the registry.
- * </p><p>
- * If the paramter doCrossLinking is set to true, links will be
- * created between ExtensionPointModels and their corresponding
- * ExtensionModels. Not that these links will include disabled
- * plugins if trimDisabledPlugins was set to false.
- * </p>
- * @param trimDisabledPlugins if true, remove all disabled plugins
- * from the registry (recommended value = true)
- * @param doCrossLinking if true, link all ExtensionModels in the registry
- * to their corresponding ExtensionPointModel (recommended value = true).
- * @return a status object describing the result of resolving.
- */
- public IStatus resolve(boolean trimDisabledPlugins, boolean doCrossLinking) {
- RegistryResolver resolver = new RegistryResolver();
- resolver.setTrimPlugins(trimDisabledPlugins);
- resolver.setCrossLink(doCrossLinking);
- return resolver.resolve(this);
- }
-
- /**
- * Returns a plug-in registry containing all of the plug-ins discovered
- * on the given plug-in path. Any problems encountered are added to
- * the status managed by the supplied factory.
- * <p>
- * The given plug-in path is the list of locations in which to look for plug-ins.
- * If an entry identifies a directory (i.e., ends in a '/'), this method
- * attempts to scan all sub-directories for plug-ins. Alternatively, an
- * entry may identify a particular plug-in manifest (<code>plugin.xml</code>) file.
- * </p>
- * <p>
- * <b>Note:</b> this method does not affect the running platform. It is intended
- * for introspecting installed plug-ins on this and other platforms. The returned
- * registry is <b>not</b> the same as the platform's registry.
- * </p>
- * @param pluginPath the list of locations in which to look for plug-ins
- * @param factory the factory to use to create runtime model objects
- * @return the registry of parsed plug-ins
- */
- public static PluginRegistryModel parsePlugins(URL[] pluginPath, Factory factory) {
- return InternalPlatform.parsePlugins(pluginPath, factory, false);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/URLModel.java b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/URLModel.java
deleted file mode 100644
index 724c758..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/URLModel.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.model;
-
-/**
- * An object which represents a named URL in a component or configuration
- * manifest.
- * <p>
- * This class may be instantiated and further subclassed.
- * </p>
- * @deprecated In Eclipse 3.0 the runtime was refactored and all
- * non-essential elements removed. This class provides facilities primarily intended
- * for tooling. As such it has been removed and no directly substitutable API provided.
- */
-
-public class URLModel extends PluginModelObject {
- // DTD properties (included in install manifest)
- private String url = null;
-
- /**
- * Returns the URL specification.
- *
- * @return the URL specification or <code>null</code>.
- */
- public String getURL() {
- return url;
- }
-
- /**
- * Sets the URL specification.
- * This object must not be read-only.
- *
- * @param value the URL specification.
- * May be <code>null</code>.
- */
- public void setURL(String value) {
- assertIsWriteable();
- url = value;
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/package.html b/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/package.html
deleted file mode 100644
index a1289bb..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-model/org/eclipse/core/runtime/model/package.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides core support for the modeling plug-ins and the plug-in registry.
-<h2>Package Specification</h2>
-This package specifies the runtime API related to modeling plug-ins and the plug-in
-registry. The types provided here are typically data containers and have very little
-behaviour other than setters and getters. They are primarily intended for clients writing
-tools which manipulate/change registry entries as part of their normal work.
-
-</body>
-</html>
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/compatibility/PluginActivator.java b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/compatibility/PluginActivator.java
deleted file mode 100644
index 0d81def..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/compatibility/PluginActivator.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.compatibility;
-
-import org.eclipse.core.internal.plugins.PluginDescriptor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class PluginActivator implements BundleActivator {
- private Plugin plugin;
-
- public PluginActivator() {
- super();
- }
-
- public void start(BundleContext context) throws Exception {
- PluginDescriptor pd = (PluginDescriptor) Platform.getPluginRegistry().getPluginDescriptor(context.getBundle().getSymbolicName());
- plugin = pd.getPlugin();
- try {
- plugin.start(context);
- plugin.startup();
- } catch(Exception e) {
- try {
- plugin.shutdown();
- plugin.stop(context);
- pd.markAsDeactivated();
- } catch(Exception e1) {
- // We are mostly interested in the original exception
- e1.printStackTrace();
- }
- throw e;
- }
- }
-
- public void stop(BundleContext context) throws Exception {
- plugin.shutdown();
- plugin.stop(context);
- ((PluginDescriptor) plugin.getDescriptor()).doPluginDeactivation();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/CompatibilityActivator.java b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/CompatibilityActivator.java
deleted file mode 100644
index e574445..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/CompatibilityActivator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.plugins;
-
-import org.eclipse.core.internal.runtime.CompatibilityHelper;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.Platform;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class CompatibilityActivator implements BundleActivator {
- public void start(BundleContext context) throws Exception {
- IPluginDescriptor descriptor = CompatibilityHelper.getPluginDescriptor(Platform.PI_RUNTIME);
- CompatibilityHelper.setPlugin(descriptor, InternalPlatform.getDefault().getRuntimeInstance());
- CompatibilityHelper.setActive(descriptor);
- }
-
- public void stop(BundleContext context) throws Exception {
- IPluginDescriptor descriptor = CompatibilityHelper.getPluginDescriptor(Platform.PI_RUNTIME);
- CompatibilityHelper.setPlugin(descriptor, null);
- ((PluginRegistry) org.eclipse.core.internal.plugins.InternalPlatform.getPluginRegistry()).close();
- CompatibilityHelper.nullCompatibility();
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/DefaultPlugin.java b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/DefaultPlugin.java
deleted file mode 100644
index 8bc759a..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/DefaultPlugin.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.plugins;
-
-/**
- * Dummy plugin runtime class implementation
- */
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.Plugin;
-
-public class DefaultPlugin extends Plugin {
- public DefaultPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/DevClassPathHelper.java b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/DevClassPathHelper.java
deleted file mode 100644
index 803da55..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/DevClassPathHelper.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.plugins;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.*;
-
-public class DevClassPathHelper {
- static protected boolean inDevelopmentMode = false;
- static protected String[] devDefaultClasspath;
- static protected Properties devProperties = null;
-
- static {
- // Check the osgi.dev property to see if dev classpath entries have been defined.
- String osgiDev = System.getProperty("osgi.dev"); //$NON-NLS-1$
- if (osgiDev != null) {
- try {
- inDevelopmentMode = true;
- URL location = new URL(osgiDev);
- devProperties = load(location);
- devDefaultClasspath = getArrayFromList(devProperties.getProperty("*")); //$NON-NLS-1$
- } catch (MalformedURLException e) {
- devDefaultClasspath = getArrayFromList(osgiDev);
- }
- }
- }
-
- public static String[] getDevClassPath(String id) {
- String[] result = null;
- if (id != null && devProperties != null) {
- String entry = devProperties.getProperty(id);
- if (entry != null)
- result = getArrayFromList(entry);
- }
- if (result == null)
- result = devDefaultClasspath;
- return result;
- }
-
- /**
- * Returns the result of converting a list of comma-separated tokens into an array
- *
- * @return the array of string tokens
- * @param prop the initial comma-separated string
- */
- public static String[] getArrayFromList(String prop) {
- if (prop == null || prop.trim().equals("")) //$NON-NLS-1$
- return new String[0];
- Vector list = new Vector();
- StringTokenizer tokens = new StringTokenizer(prop, ","); //$NON-NLS-1$
- while (tokens.hasMoreTokens()) {
- String token = tokens.nextToken().trim();
- if (!token.equals("")) //$NON-NLS-1$
- list.addElement(token);
- }
- return list.isEmpty() ? new String[0] : (String[]) list.toArray(new String[list.size()]);
- }
-
- public static boolean inDevelopmentMode() {
- return inDevelopmentMode;
- }
-
- /*
- * Load the given properties file
- */
- private static Properties load(URL url) {
- Properties props = new Properties();
- try {
- InputStream is = null;
- try {
- is = url.openStream();
- props.load(is);
- } finally {
- if (is != null)
- is.close();
- }
- } catch (IOException e) {
- // TODO consider logging here
- }
- return props;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/InternalPlatform.java b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/InternalPlatform.java
deleted file mode 100644
index 1e80e18..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/InternalPlatform.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.plugins;
-
-import java.net.URL;
-import org.eclipse.core.internal.model.RegistryLoader;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.model.Factory;
-import org.eclipse.core.runtime.model.PluginRegistryModel;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-
-/**
- * @deprecated Marking as deprecated to remove the warnings
- */
-public class InternalPlatform {
- private static IPluginRegistry registry = null;
-
- public static IPluginRegistry getPluginRegistry() {
- if (registry == null) {
- registry = new PluginRegistry();
- }
- return registry;
- }
-
- public static IPluginDescriptor getPluginDescriptor(String pluginId) {
- return getPluginRegistry().getPluginDescriptor(pluginId);
- }
-
- public static void installPlugins(URL[] installURLs) throws CoreException {
- String message = Policy.bind("platform.errorInstalling"); //$NON-NLS-1$
- MultiStatus result = new MultiStatus(Platform.PI_RUNTIME, 0, message, null);
- BundleContext context = org.eclipse.core.internal.runtime.InternalPlatform.getDefault().getBundleContext();
- for (int i = 0; i < installURLs.length; i++) {
- try {
- context.installBundle(installURLs[i].toExternalForm());
- } catch (BundleException e) {
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, 0, org.eclipse.core.internal.plugins.Policy.bind("platform.cannotInstallPlugin", installURLs[i].toExternalForm()), e); //$NON-NLS-1$
- result.merge(status);
- }
- }
- if (!result.isOK())
- throw new CoreException(result);
- }
-
-
- /**
- * Convenience method equivalent to parsePlugins(URL[], Factory, boolean) where debug is set to false.
- * @see #parsePlugins(URL[], Factory, boolean)
- */
- public static PluginRegistryModel parsePlugins(URL[] pluginPath, Factory factory) {
- return parsePlugins(pluginPath, factory, false);
- }
-
- /**
- * Returns a plug-in registry containing all of the plug-ins discovered
- * on the given plug-in path. Any problems encountered are added to
- * the status managed by the supplied factory.
- * <p>
- * The given plug-in path is the list of locations in which to look for plug-ins.
- * If an entry identifies a directory (i.e., ends in a '/'), this method
- * attempts to scan all sub-directories for plug-ins. Alternatively, an
- * entry may identify a particular plug-in manifest (<code>plugin.xml</code>) file.
- * </p>
- * <p>
- * <b>Note:</b> this method does not affect the running platform. It is intended
- * for introspecting installed plug-ins on this and other platforms. The returned
- * registry is <b>not</b> the same as the platform's registry.
- * </p>
- *
- * @param pluginPath the list of locations in which to look for plug-ins
- * @param factory the factory to use to create runtime model objects
- * @param debug turn the debug information on or off
- * @return the registry of parsed plug-ins
- */
- public synchronized static PluginRegistryModel parsePlugins(URL[] pluginPath, Factory factory, boolean debug) {
- return RegistryLoader.parseRegistry(pluginPath, factory, debug);
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/Library.java b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/Library.java
deleted file mode 100644
index e68de2b..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/Library.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.plugins;
-
-import org.eclipse.core.runtime.*;
-
-public class Library implements ILibrary {
- public String path;
-
- public Library(String path) {
- this.path = path;
- }
-
- public String[] getContentFilters() {
- return null;
- }
-
- public IPath getPath() {
- return new Path(path);
- }
-
- public String getType() {
- return ILibrary.CODE;
- }
-
- public boolean isExported() {
- return true;
- }
-
- public boolean isFullyExported() {
- return true;
- }
-
- public String[] getPackagePrefixes() {
- return null;
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginClassLoader.java b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginClassLoader.java
deleted file mode 100644
index cfc863a..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginClassLoader.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.plugins;
-
-import java.io.IOException;
-import java.net.*;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.ILibrary;
-import org.eclipse.core.runtime.Platform;
-import org.osgi.framework.Bundle;
-
-public class PluginClassLoader extends URLClassLoader {
- private Bundle bundle; //We should be able to get rid of this field, since the info is in the descriptor
- private PluginDescriptor descriptor;
-
- PluginClassLoader(PluginDescriptor descriptor) {
- super(computeURLs(descriptor));
- this.descriptor = descriptor;
- this.bundle = InternalPlatform.getDefault().getBundle(descriptor.getUniqueIdentifier());
- if (bundle == null)
- throw new IllegalArgumentException();
- }
-
- private static URL[] computeURLs(PluginDescriptor descriptor) {
- Bundle bundle = InternalPlatform.getDefault().getBundle(descriptor.getUniqueIdentifier());
- if (bundle == null)
- throw new IllegalArgumentException();
-
- ILibrary[] libs = descriptor.getRuntimeLibraries();
- String[] devPath = computeDevPath(bundle);
- URL pluginBase = descriptor.getInstallURL();
- try {
- pluginBase = Platform.resolve(descriptor.getInstallURL());
- } catch (IOException e1) {
- //Ignore
- }
-
- URL[] urls = new URL[devPath.length + libs.length];
- int j = 0;
- for (int i = 0; i < devPath.length; i++) {
- try {
- urls[j++] = new URL(pluginBase, devPath[i]);
- } catch (MalformedURLException e) {
- //Ignore the exception
- }
- }
- for (int i = 0; i < libs.length; i++) {
- try {
- urls[j++] = new URL(pluginBase, libs[i].getPath().toOSString());
- } catch (MalformedURLException e) {
- //Ignore the exception
- }
- }
- return urls;
- }
-
- private static String[] computeDevPath(Bundle bundle) {
- if (!DevClassPathHelper.inDevelopmentMode())
- return new String[0];
-
- String pluginId = bundle.getSymbolicName();
- if (pluginId == null)
- return new String[0];
- return DevClassPathHelper.getDevClassPath(pluginId);
- }
-
- protected Class findClass(String name) throws ClassNotFoundException {
- return bundle.loadClass(name); // if no CNFE is thrown, activate the bundle (if needed)
- }
-
- public URL findResource(String name) {
- return bundle.getResource(name);
- }
-
- public PluginDescriptor getPluginDescriptor() {
- return descriptor;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginDescriptor.java b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginDescriptor.java
deleted file mode 100644
index b87fef2..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginDescriptor.java
+++ /dev/null
@@ -1,457 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.core.internal.plugins;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.net.URL;
-import java.util.*;
-import org.eclipse.core.internal.boot.PlatformURLHandler;
-import org.eclipse.core.internal.runtime.*;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.osgi.service.resolver.BundleSpecification;
-import org.eclipse.osgi.util.ManifestElement;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.*;
-
-
-/**
- * @deprecated Marking as deprecated to remove the warnings
- */
-public class PluginDescriptor implements IPluginDescriptor {
-
- private static final String PLUGIN_CLASS = "Plugin-Class"; //$NON-NLS-1$
- protected Plugin pluginObject = null; // plugin object
- private Bundle bundleOsgi;
-
- //The three following fields can't be replaced by a test to the bundle state.
- private boolean active = false; // plugin is active
- private volatile boolean activePending = false; // being activated
- private boolean deactivated = false; // plugin deactivated due to startup errors
- private ResourceBundle resources = null;
- private PluginClassLoader classLoader;
-
- // constants
- static final String PLUGIN_URL = PlatformURLHandler.PROTOCOL + PlatformURLHandler.PROTOCOL_SEPARATOR + "/" + PlatformURLPluginConnection.PLUGIN + "/"; //$NON-NLS-1$ //$NON-NLS-2$
- static final String VERSION_SEPARATOR = "_"; //$NON-NLS-1$
-
- synchronized public void doPluginDeactivation() {
- pluginObject = null;
- active = false;
- activePending = false;
- deactivated = false;
- }
-
- /**
- * @see IPluginDescriptor
- */
- public IExtension getExtension(String id) {
- IExtension[] exts = getExtensions();
- for (int i = 0; i < exts.length; i++) {
- if (exts[i].getSimpleIdentifier().equals(id))
- return exts[i];
- }
- return null;
- }
-
- /**
- * @see IPluginDescriptor
- */
- public IExtensionPoint getExtensionPoint(String extensionPointId) {
- return InternalPlatform.getDefault().getRegistry().getExtensionPoint(getId(), extensionPointId);
- }
-
- /**
- * @see IPluginDescriptor
- */
- public IExtensionPoint[] getExtensionPoints() {
- return InternalPlatform.getDefault().getRegistry().getExtensionPoints(getId());
- }
-
- /**
- * @see IPluginDescriptor
- */
- public IExtension[] getExtensions() {
- return org.eclipse.core.internal.runtime.InternalPlatform.getDefault().getRegistry().getExtensions(getId());
- }
-
- /**
- * @see IPluginDescriptor
- */
- public URL getInstallURL() {
- try {
- return new URL(PLUGIN_URL + toString() + '/');
- } catch (IOException e) {
- throw new IllegalStateException(); // unchecked
- }
- }
-
- /**
- * @see IPluginDescriptor
- */
- public String getLabel() {
- return (String) bundleOsgi.getHeaders().get(Constants.BUNDLE_NAME);
- }
-
- /**
- * @see IPluginDescriptor
- */
- public ClassLoader getPluginClassLoader() {
- synchronized (this) {
- if (classLoader == null)
- classLoader = new PluginClassLoader(this);
- }
- return classLoader;
- }
-
- public PluginRegistry getPluginRegistry() {
- return (PluginRegistry) org.eclipse.core.internal.plugins.InternalPlatform.getPluginRegistry();
- }
-
- /**
- * @see IPluginDescriptor
- */
- public String getProviderName() {
- return (String) bundleOsgi.getHeaders().get(Constants.BUNDLE_VENDOR);
- }
-
- /**
- * @see IPluginDescriptor
- */
- public ResourceBundle getResourceBundle() throws MissingResourceException {
- if (resources==null)
- resources = ResourceTranslator.getResourceBundle(bundleOsgi);
- return resources;
- }
-
- /**
- * @see IPluginDescriptor
- */
- public String getResourceString(String value) {
- return ResourceTranslator.getResourceString(bundleOsgi, value);
- }
-
- /**
- * @see IPluginDescriptor
- */
- public String getResourceString(String value, ResourceBundle b) {
- return ResourceTranslator.getResourceString(bundleOsgi, value, b);
- }
-
- /**
- * @see IPluginDescriptor
- */
- public ILibrary[] getRuntimeLibraries() {
- Bundle[] allBundles;
- Bundle[] fragments = InternalPlatform.getDefault().getFragments(bundleOsgi);
- if (fragments != null) {
- allBundles = new Bundle[fragments.length + 1];
- allBundles[0] = bundleOsgi;
- System.arraycopy(fragments, 0, allBundles, 1, fragments.length);
- } else
- allBundles = new Bundle[] {bundleOsgi};
- ArrayList allLibraries = new ArrayList();
- // keep track of whether or not we have already added a "." to this classpath
- boolean addedDot = false;
- for (int i = 0; i < allBundles.length; i++)
- try {
- ManifestElement[] classpathElements = ManifestElement.parseHeader(Constants.BUNDLE_CLASSPATH, (String) allBundles[i].getHeaders("").get(Constants.BUNDLE_CLASSPATH)); //$NON-NLS-1$
- // if there is no bundle classpath header, then we have to
- // add "." to the classpath
- if (classpathElements == null) {
- if (addedDot)
- continue;
- allLibraries.add(new Library(".")); //$NON-NLS-1$
- addedDot = true;
- } else
- for (int j = 0; j < classpathElements.length; j++)
- allLibraries.add(new Library(classpathElements[j].getValue()));
- } catch (BundleException e) {
- //Ignore because by the time we get here the errors will have already been logged.
- }
- return (ILibrary[]) allLibraries.toArray(new ILibrary[allLibraries.size()]);
- }
-
- /**
- * @see IPluginDescriptor
- */
- public String getUniqueIdentifier() {
- return getId();
- }
-
- /**
- * @see #toString()
- */
- public static String getUniqueIdentifierFromString(String pluginString) {
- int ix = pluginString.indexOf(VERSION_SEPARATOR);
- return ix == -1 ? pluginString : pluginString.substring(0, ix);
- }
-
- /**
- * @see IPluginDescriptor
- */
- public PluginVersionIdentifier getVersionIdentifier() {
- String version = (String) bundleOsgi.getHeaders("").get(Constants.BUNDLE_VERSION); //$NON-NLS-1$
- try {
- return new PluginVersionIdentifier(version);
- } catch (Exception e) {
- return new PluginVersionIdentifier("1.0.0"); //$NON-NLS-1$
- }
- }
-
- /**
- * @see #toString()
- */
- public static PluginVersionIdentifier getVersionIdentifierFromString(String pluginString) {
- return new PluginVersionIdentifier(pluginString);
- }
-
- public IPluginPrerequisite[] getPluginPrerequisites() {
- BundleDescription description = Platform.getPlatformAdmin().getState(false).getBundle(bundleOsgi.getBundleId());
- BundleSpecification[] specs = description.getRequiredBundles();
-
- IPluginPrerequisite[] resolvedPrerequisites = new IPluginPrerequisite[specs.length];
- for (int j = 0; j < specs.length; j++)
- resolvedPrerequisites[j] = new PluginPrerequisite(specs[j]);
- return resolvedPrerequisites;
- }
-
- /**
- * Returns true if the plugin is active or is currently in the process of being
- * activated, and false otherwse.
- * NOTE: This method is not synchronized because it is called from within a
- * sync block in PluginClassLoader.
- */
- boolean hasActivationStarted() {
- return activePending || active;
- }
-
- /**
- * @see IPluginDescriptor
- */
- public synchronized boolean isPluginActivated() {
- //note that this method is synchronized for good reason.
- //During plugin activation, neither true nor false would be valid
- //return values for this method, so it must block until activation
- //completes. For example, returning false during activation
- //would break the registry shutdown procedure, because a
- //plugin being activated during shutdown would never be shut down.
- return bundleOsgi.getState() == Bundle.ACTIVE;
- }
-
- /*
- * NOTE: This method is not synchronized because it is called from within a
- * sync block in PluginClassLoader.
- */
- public boolean isPluginDeactivated() {
- return deactivated;
- }
-
- private void logError(IStatus status) {
- InternalPlatform.getDefault().getLog(org.eclipse.core.internal.runtime.InternalPlatform.getDefault().getBundleContext().getBundle()).log(status);
- }
-
- /**
- * Returns <code>true</code> if we should continue with the plugin activation.
- */
- private boolean pluginActivationEnter() throws CoreException {
- if (deactivated) {
- // had permanent error on startup
- String errorMsg = NLS.bind(Messages.plugin_pluginDisabled, getId());
- throwException(errorMsg, null);
- }
- if (active || activePending) {
- // already up and running
- return false;
- }
- activePending = true;
- // go ahead and try to activate
- return true;
- }
-
- private void pluginActivationExit(boolean errorExit) {
- if (errorExit) {
- active = false;
- deactivated = true;
- } else
- active = true;
- // we are done with the activation
- activePending = false;
- }
-
- private void throwException(String message, Throwable exception) throws CoreException {
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, Platform.PLUGIN_ERROR, message, exception);
- logError(status);
- throw new CoreException(status);
- }
-
- /**
- * @see #getUniqueIdentifierFromString(String)
- * @see #getVersionIdentifierFromString(String)
- */
- public String toString() {
- return getUniqueIdentifier() + VERSION_SEPARATOR + getVersionIdentifier().toString();
- }
-
- /**
- * @see IPluginDescriptor
- */
- public final URL find(IPath path) {
- URL result = FindSupport.find(bundleOsgi, path);
- if (result != null)
- try {
- result = Platform.resolve(result);
- } catch (IOException e) {
- // if the URL cannot be resolved for some reason, return the original result.
- }
- return result;
- }
-
- /**
- * @see IPluginDescriptor
- */
- public final URL find(IPath path, Map override) {
- URL result = FindSupport.find(bundleOsgi, path, override);
- if (result != null)
- try {
- result = Platform.resolve(result);
- } catch (IOException e) {
- // if the URL cannot be resolved for some reason, return the original result.
- }
- return result;
- }
-
- /**
- * @see IPluginDescriptor
- */
- public Plugin getPlugin() throws CoreException {
- if (pluginObject == null)
- doPluginActivation();
- return pluginObject;
- }
-
- synchronized void doPluginActivation() throws CoreException {
- //This class is only called when getPlugin() is invoked.
- // It needs to handle the case where it is called multiple times during the activation
- // processing itself (as a result of other classes from this
- // plugin being directly referenced by the plugin class)
-
- // NOTE: there is a remote scenario where the plugin class can
- // deadlock, if it starts separate thread(s) within its
- // constructor or startup() method, and waits on those
- // threads before returning (ie. calls join()).
-
- // sanity checking
- if ((bundleOsgi.getState() & (Bundle.RESOLVED | Bundle.STARTING | Bundle.ACTIVE)) == 0)
- throw new IllegalArgumentException();
- try {
- // ensure the bundle has been activated
- InternalPlatform.start(bundleOsgi);
- } catch (BundleException e) {
- throwException(NLS.bind(Messages.plugin_startupProblems, e), e);
- }
- if (pluginObject != null)
- return;
- boolean errorExit = true;
- // check if already activated or pending
- if (pluginActivationEnter()) {
- try {
- internalDoPluginActivation();
- errorExit = false;
- } finally {
- pluginActivationExit(errorExit);
- }
- } else {
- //Create a fake plugin object for all new bundles that do not use the Plugin class in their activator hierarchy
- if (active && pluginObject == null) {
- active = false;
- pluginObject = new DefaultPlugin(this);
- active = true;
- }
- }
-
- }
-
- private String getPluginClass() {
- return (String) bundleOsgi.getHeaders("").get(PLUGIN_CLASS); //$NON-NLS-1$
- }
-
- private String getId() {
- return bundleOsgi.getSymbolicName();
- }
-
- private void internalDoPluginActivation() throws CoreException {
- String errorMsg;
- // load the runtime class
- String pluginClassName = getPluginClass();
- Class runtimeClass = null;
- try {
- if (pluginClassName == null || pluginClassName.equals("")) {//$NON-NLS-1$
- runtimeClass = DefaultPlugin.class;
- pluginClassName = DefaultPlugin.class.getName();
- }
- else
- runtimeClass = bundleOsgi.loadClass(pluginClassName);
- } catch (ClassNotFoundException e) {
- errorMsg = NLS.bind(Messages.plugin_loadClassError, getId(), pluginClassName);
- throwException(errorMsg, e);
- }
-
- // find the correct constructor
- Constructor construct = null;
- try {
- construct = runtimeClass.getConstructor(new Class[] {IPluginDescriptor.class});
- } catch (NoSuchMethodException eNoConstructor) {
- errorMsg = NLS.bind(Messages.plugin_instantiateClassError, getId(), pluginClassName);
- throwException(errorMsg, eNoConstructor);
- }
-
- // create a new instance
- try {
- pluginObject = (Plugin) construct.newInstance(new Object[] {this});
- } catch (ClassCastException e) {
- errorMsg = NLS.bind(Messages.plugin_notPluginClass, pluginClassName);
- throwException(errorMsg, e);
- } catch (Exception e) {
- errorMsg = NLS.bind(Messages.plugin_instantiateClassError, getId(), pluginClassName);
- throwException(errorMsg, e);
- }
- }
-
- public PluginDescriptor(org.osgi.framework.Bundle b) {
- bundleOsgi = b;
- if ((b.getState() & Bundle.ACTIVE) != 0)
- active = true;
- }
-
- public Bundle getBundle() {
- return bundleOsgi;
- }
-
- public void setPlugin(Plugin object) {
- pluginObject = object;
- }
-
- public synchronized void setActive() {
- this.active = true;
- }
-
- public boolean hasPluginObject() {
- return pluginObject!=null;
- }
-
- public void markAsDeactivated() {
- deactivated = true;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginPrerequisite.java b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginPrerequisite.java
deleted file mode 100644
index 3008d8d..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginPrerequisite.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.plugins;
-
-import org.eclipse.core.runtime.IPluginPrerequisite;
-import org.eclipse.core.runtime.PluginVersionIdentifier;
-import org.eclipse.osgi.service.resolver.BundleSpecification;
-import org.eclipse.osgi.service.resolver.VersionRange;
-import org.osgi.framework.Version;
-
-
-/**
- * @deprecated Marking as deprecated to remove the warnings
- */
-public class PluginPrerequisite implements IPluginPrerequisite {
- private static final Version maxVersion = new Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
- private BundleSpecification prereq = null;
-
- public PluginPrerequisite(BundleSpecification b) {
- prereq = b;
- }
-
- public PluginVersionIdentifier getResolvedVersionIdentifier() {
- Version actualVersion = prereq.getSupplier().getVersion();
- if (actualVersion == null)
- return null;
- return new PluginVersionIdentifier(actualVersion.toString());
- }
-
- public String getUniqueIdentifier() {
- return prereq.getName();
- }
-
- public PluginVersionIdentifier getVersionIdentifier() {
- Version specifiedVersion = prereq.getVersionRange() == null ? null : prereq.getVersionRange().getMinimum();
- if (specifiedVersion == null)
- return null;
- return new PluginVersionIdentifier(specifiedVersion.toString());
- }
-
- public boolean isExported() {
- return prereq.isExported();
- }
-
- public boolean isMatchedAsGreaterOrEqual() {
- return isMatchedAsGreaterOrEqual(prereq.getVersionRange());
- }
-
- public boolean isMatchedAsCompatible() {
- return isMatchedAsCompatible(prereq.getVersionRange());
- }
-
- public boolean isMatchedAsEquivalent() {
- return isMatchedAsEquivalent(prereq.getVersionRange());
- }
-
- public boolean isMatchedAsPerfect() {
- return isMatchedAsPerfect(prereq.getVersionRange());
- }
-
- public boolean isMatchedAsExact() {
- return isMatchedAsEquivalent();
- }
-
- public boolean isOptional() {
- return prereq.isOptional();
- }
-
- private static boolean isMatchedAsGreaterOrEqual(VersionRange versionRange) {
- if (versionRange == null || versionRange.getMinimum() == null)
- return false;
- Version maximum = versionRange.getMaximum();
- if (maximum == null || maximum.compareTo(maxVersion) >= 0)
- return true;
- return false;
- }
-
- private static boolean isMatchedAsPerfect(VersionRange versionRange) {
- if (versionRange == null || versionRange.getMinimum() == null)
- return false;
- Version minimum = versionRange.getMinimum();
- Version maximum = versionRange.getMaximum() == null ? maxVersion : versionRange.getMaximum();
- if (minimum.equals(maximum))
- return true;
- return false;
- }
-
- private static boolean isMatchedAsEquivalent(VersionRange versionRange) {
- if (versionRange == null || versionRange.getMinimum() == null)
- return false;
- Version minimum = versionRange.getMinimum();
- Version maximum = versionRange.getMaximum() == null ? maxVersion : versionRange.getMaximum();
- if (!versionRange.getIncludeMinimum() || versionRange.getIncludeMaximum())
- return false;
- else if (minimum.getMajor() == maximum.getMajor() - 1)
- return false;
- else if (minimum.getMajor() != maximum.getMajor())
- return false;
- else if (minimum.getMinor() == maximum.getMinor() - 1)
- return true;
- return false;
- }
-
- private static boolean isMatchedAsCompatible(VersionRange versionRange) {
- if (versionRange == null || versionRange.getMinimum() == null)
- return false;
- Version minimum = versionRange.getMinimum();
- Version maximum = versionRange.getMaximum() == null ? maxVersion : versionRange.getMaximum();
- if (!versionRange.getIncludeMinimum() || versionRange.getIncludeMaximum())
- return false;
- else if (minimum.getMajor() == maximum.getMajor() - 1)
- return true;
- return false;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginRegistry.java b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginRegistry.java
deleted file mode 100644
index f0d4de2..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/PluginRegistry.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.core.internal.plugins;
-
-import java.util.*;
-import java.util.ArrayList;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.*;
-import org.osgi.framework.*;
-
-/**
- * @deprecated Marking as deprecated to remove the warnings
- */
-public class PluginRegistry implements IPluginRegistry {
- private IExtensionRegistry extRegistry;
- private RegistryListener listener;
-
- protected WeakHashMap descriptors = new WeakHashMap(); //key is a bundle object, value is a pluginDescriptor. The synchornization is required
-
- public PluginRegistry() {
- extRegistry = InternalPlatform.getDefault().getRegistry();
- listener = new RegistryListener();
- InternalPlatform.getDefault().getBundleContext().addBundleListener(listener);
- }
-
- public void close() {
- InternalPlatform.getDefault().getBundleContext().removeBundleListener(listener);
- listener = null;
- descriptors = null;
- }
-
- /**
- * @deprecated Marking as deprecated to remove the warnings
- */
- public IConfigurationElement[] getConfigurationElementsFor(String uniqueId) {
- return extRegistry.getConfigurationElementsFor(uniqueId);
- }
-
- /**
- * @deprecated Marking as deprecated to remove the warnings
- */
- public IConfigurationElement[] getConfigurationElementsFor(String pluginId, String pointId) {
- return extRegistry.getConfigurationElementsFor(pluginId, pointId);
- }
-
- /**
- * @deprecated Marking as deprecated to remove the warnings
- */
- public IConfigurationElement[] getConfigurationElementsFor(String pluginId, String pointId, String extensionId) {
- return extRegistry.getConfigurationElementsFor(pluginId, pointId, extensionId);
- }
-
- /**
- * @deprecated Marking as deprecated to remove the warnings
- */
- public IExtension getExtension(String xptUniqueId, String extUniqueId) {
- return extRegistry.getExtension(xptUniqueId, extUniqueId);
- }
-
- /**
- * @deprecated Marking as deprecated to remove the warnings
- */
- public IExtension getExtension(String pluginId, String xptSimpleId, String extId) {
- return extRegistry.getExtension(pluginId, xptSimpleId, extId);
- }
-
- /**
- * @deprecated Marking as deprecated to remove the warnings
- */
- public IExtensionPoint getExtensionPoint(String xptUniqueId) {
- return extRegistry.getExtensionPoint(xptUniqueId);
- }
-
- /**
- * @deprecated Marking as deprecated to remove the warnings
- */
- public IExtensionPoint getExtensionPoint(String plugin, String xpt) {
- return extRegistry.getExtensionPoint(plugin, xpt);
- }
-
- /**
- * @deprecated Marking as deprecated to remove the warnings
- */
- public IExtensionPoint[] getExtensionPoints() {
- return extRegistry.getExtensionPoints();
- }
-
- /**
- * @deprecated Marking as deprecated to remove the warnings
- */
- public IPluginDescriptor getPluginDescriptor(String plugin) {
- Bundle correspondingBundle = InternalPlatform.getDefault().getBundle(plugin);
- if (correspondingBundle == null)
- return null;
- return getPluginDescriptor(correspondingBundle);
- }
-
- private PluginDescriptor getPluginDescriptor(Bundle bundle) {
- if (InternalPlatform.getDefault().isFragment(bundle) || descriptors == null) {
- return null;
- }
- synchronized(descriptors) {
- PluginDescriptor correspondingDescriptor = (PluginDescriptor) descriptors.get(bundle);
- if (bundle != null) {
- // we haven't created a plugin descriptor yet or it was for a different bundle
- if (correspondingDescriptor == null || correspondingDescriptor.getBundle() != bundle) {
- // create a new plugin descriptor and save it for the next time
- correspondingDescriptor = new PluginDescriptor(bundle);
- descriptors.put(bundle, correspondingDescriptor);
- }
- return correspondingDescriptor;
- }
- // if a bundle does not exist, ensure we don't keep a plugin descriptor for it
- if (correspondingDescriptor != null)
- descriptors.remove(bundle);
- }
- return null;
- }
-
- /**
- * @deprecated Marking as deprecated to remove the warnings
- */
- public IPluginDescriptor[] getPluginDescriptors(String plugin) {
- Bundle[] bundles = InternalPlatform.getDefault().getBundles(plugin, null);
- if (bundles == null)
- return new IPluginDescriptor[0];
- IPluginDescriptor[] results = new IPluginDescriptor[bundles.length];
- int added = 0;
- for (int i = 0; i < bundles.length; i++) {
- PluginDescriptor desc = getPluginDescriptor(bundles[i]);
- if (desc != null)
- results[added++] = desc;
- }
- if (added == bundles.length)
- return results;
-
- if (added == 0)
- return new IPluginDescriptor[0];
-
- IPluginDescriptor[] toReturn = new IPluginDescriptor[added];
- System.arraycopy(results, 0, toReturn, 0, added);
- return toReturn;
- }
-
- /**
- * @deprecated Marking as deprecated to remove the warnings
- */
- public IPluginDescriptor getPluginDescriptor(String pluginId, PluginVersionIdentifier version) {
- Bundle[] bundles = InternalPlatform.getDefault().getBundles(pluginId, version.toString());
- if (bundles == null)
- return null;
-
- return getPluginDescriptor(bundles[0]);
- }
-
- /**
- * @deprecated Marking as deprecated to remove the warnings
- */
- public IPluginDescriptor[] getPluginDescriptors() {
- Bundle[] bundles = InternalPlatform.getDefault().getBundleContext().getBundles();
- ArrayList pds = new ArrayList(bundles.length);
- for (int i = 0; i < bundles.length; i++) {
- boolean isFragment = InternalPlatform.getDefault().isFragment(bundles[i]);
- if (!isFragment && bundles[i].getSymbolicName() != null && (bundles[i].getState() == Bundle.RESOLVED || bundles[i].getState() == Bundle.STARTING || bundles[i].getState() == Bundle.ACTIVE))
- pds.add(getPluginDescriptor(bundles[i]));
- }
- IPluginDescriptor[] result = new IPluginDescriptor[pds.size()];
- return (IPluginDescriptor[]) pds.toArray(result);
- }
-
- void logError(IStatus status) {
- InternalPlatform.getDefault().log(status);
- if (InternalPlatform.DEBUG)
- System.out.println(status.getMessage());
- }
-
- public class RegistryListener implements BundleListener {
- public void bundleChanged(BundleEvent event) {
- if (descriptors == null)
- return;
-
- synchronized(descriptors) {
- if (event.getType() == BundleEvent.UNINSTALLED || event.getType() == BundleEvent.UNRESOLVED) {
- descriptors.remove(event.getBundle());
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/Policy.java b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/Policy.java
deleted file mode 100644
index 4760b71..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/Policy.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.plugins;
-
-import java.util.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-
-public class Policy {
- private static String bundleName = "org.eclipse.core.internal.plugins.messages"; //$NON-NLS-1$
- private static ResourceBundle bundle;
-
- /*
- * Returns a resource bundle, creating one if it none is available.
- */
- private static ResourceBundle getResourceBundle() {
- // thread safety
- ResourceBundle tmpBundle = bundle;
- if (tmpBundle != null)
- return tmpBundle;
- // always create a new classloader to be passed in
- // in order to prevent ResourceBundle caching
- return bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault());
- }
-
- /**
- * Lookup the message with the given ID in this catalog
- */
- public static String bind(String id) {
- return bind(id, (String[]) null);
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given string.
- */
- public static String bind(String id, String binding) {
- return bind(id, new String[] {binding});
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given strings.
- */
- public static String bind(String id, String binding1, String binding2) {
- return bind(id, new String[] {binding1, binding2});
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given string values.
- */
- public static String bind(String id, String[] bindings) {
- if (id == null)
- return "No message available"; //$NON-NLS-1$
- String message = null;
- try {
- message = getResourceBundle().getString(id);
- } catch (MissingResourceException e) {
- // If we got an exception looking for the message, fail gracefully by just returning
- // the id we were looking for. In most cases this is semi-informative so is not too bad.
- return "Missing message: " + id + " in: " + bundleName; //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (bindings == null)
- return message;
- return NLS.bind(message, bindings);
- }
-
- public static IProgressMonitor monitorFor(IProgressMonitor monitor) {
- if (monitor == null)
- return new NullProgressMonitor();
- return monitor;
- }
-
- public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new SubProgressMonitor(monitor, ticks);
- }
-
- public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks, int style) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new SubProgressMonitor(monitor, ticks, style);
- }
-
- /**
- * Print a debug message to the console. If the given boolean is <code>true</code> then
- * pre-pend the message with the current date.
- */
- public static void debug(boolean includeDate, String message) {
- if (includeDate)
- message = new Date(System.currentTimeMillis()) + " - " + message; //$NON-NLS-1$
- System.out.println(message);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/messages.properties b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/messages.properties
deleted file mode 100644
index e85af3f..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/messages.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-### Runtime backward compatibility message catalog
-
-
-# Plugin activation/deactivation messages
-activator.applicationNotStarted=Legacy plug-in \"{0}\" must not be automatically activated on startup. This is probably caused by a previous crash in Eclipse.
-
-#Platform messages
-platform.errorInstalling=Error installing plug-in(s).
-platform.cannotInstallPlugin=Could not install plugin from \"{0}\".
diff --git a/bundles/org.eclipse.core.runtime/.classpath b/bundles/org.eclipse.core.runtime/.classpath
deleted file mode 100644
index ce0c7a5..0000000
--- a/bundles/org.eclipse.core.runtime/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.0%Foundation-1.0"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.core.runtime/.cvsignore b/bundles/org.eclipse.core.runtime/.cvsignore
deleted file mode 100644
index c5e82d7..0000000
--- a/bundles/org.eclipse.core.runtime/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime/.options b/bundles/org.eclipse.core.runtime/.options
deleted file mode 100644
index 57f99a0..0000000
--- a/bundles/org.eclipse.core.runtime/.options
+++ /dev/null
@@ -1,26 +0,0 @@
-# Debugging options for the org.eclipse.core.runtime plugin
-
-# Turn on general debugging for the org.eclipse.core.runtime plugin.
-# Also displays overall startup time.
-org.eclipse.core.runtime/debug=false
-
-# Prints out values of OS, WS, NL, and ARCH
-org.eclipse.core.runtime/debug/context=false
-
-# Captures performance event information (See org.eclipse.core.runtime.PerformanceStats)
-org.eclipse.core.runtime/perf=false
-
-# Tracks performance events that run within an acceptable duration
-org.eclipse.core.runtime/perf/success=false
-
-# Turn on debugging for the compatibility layer
-org.eclipse.core.runtime/compatibility/debug=false
-
-# Turn on debugging for plugin preferences
-org.eclipse.core.runtime/preferences/plugin=false
-
-# Turn on debugging in the support for non-local plugins.
-org.eclipse.core.runtime/url/debug=false
-org.eclipse.core.runtime/url/debug/connect=false
-org.eclipse.core.runtime/url/debug/cachelookup=false
-org.eclipse.core.runtime/url/debug/cachecopy=false
diff --git a/bundles/org.eclipse.core.runtime/.project b/bundles/org.eclipse.core.runtime/.project
deleted file mode 100644
index 3643f04..0000000
--- a/bundles/org.eclipse.core.runtime/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.runtime</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 1993c40..0000000
--- a/bundles/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue May 25 14:58:43 EDT 2004
-encoding/<project>=ISO-8859-1
-eclipse.preferences.version=1
diff --git a/bundles/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 12a3b16..0000000
--- a/bundles/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,330 +0,0 @@
-#Thu Aug 16 13:07:34 EDT 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.builder.cleanOutputFolder=clean
-org.eclipse.jdt.core.builder.duplicateResourceTask=warning
-org.eclipse.jdt.core.builder.invalidClasspath=abort
-org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
-org.eclipse.jdt.core.circularClasspath=error
-org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
-org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.3
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=error
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=false
-org.eclipse.jdt.core.formatter.comment.format_comments=false
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=80
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=800
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.incompatibleJDKLevel=ignore
-org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 78c4da7..0000000
--- a/bundles/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,9 +0,0 @@
-#Fri Feb 23 16:59:24 EST 2007
-eclipse.preferences.version=1
-formatter_profile=_core
-formatter_settings_version=11
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=;
-org.eclipse.jdt.ui.ondemandthreshold=3
-org.eclipse.jdt.ui.staticondemandthreshold=99
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return Returns the ${bare_field_name}.\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} The ${bare_field_name} to set.\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Copyright (c) ${year} IBM Corporation and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n ******************************************************************************/\r\n</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @since 3.2\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="New classes and interfaces" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) 2006 IBM Corporation and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n *******************************************************************************/\r\n${package_declaration}\r\n\r\n/**\r\n * \r\n */\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block&\#13;\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/bundles/org.eclipse.core.runtime/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.runtime/META-INF/MANIFEST.MF
deleted file mode 100644
index f828012..0000000
--- a/bundles/org.eclipse.core.runtime/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,23 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Version: 3.4.0.qualifier
-Bundle-SymbolicName: org.eclipse.core.runtime; singleton:=true
-Bundle-Vendor: %providerName
-Bundle-Activator: org.eclipse.core.internal.runtime.PlatformActivator
-Bundle-Localization: plugin
-Export-Package: org.eclipse.core.internal.preferences.legacy;x-internal:=true,
- org.eclipse.core.internal.runtime;x-friends:="org.eclipse.core.runtime.compatibility",
- org.eclipse.core.runtime
-Require-Bundle: org.eclipse.osgi;bundle-version="[3.2.0,4.0.0)";visibility:=reexport,
- org.eclipse.equinox.common;bundle-version="[3.2.0,4.0.0)";visibility:=reexport,
- org.eclipse.core.jobs;bundle-version="[3.2.0,4.0.0)";visibility:=reexport,
- org.eclipse.equinox.registry;bundle-version="[3.4.0,4.0.0)";visibility:=reexport,
- org.eclipse.equinox.preferences;bundle-version="[3.2.0,4.0.0)";visibility:=reexport,
- org.eclipse.core.contenttype;bundle-version="[3.3.0,4.0.0)";visibility:=reexport,
- org.eclipse.core.runtime.compatibility.auth;bundle-version="[3.2.0,4.0.0)";resolution:=optional,
- org.eclipse.equinox.app;bundle-version="[1.0.0,2.0.0)";visibility:=reexport
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,
- J2SE-1.3
-DynamicImport-Package: org.eclipse.core.internal.runtime.auth
diff --git a/bundles/org.eclipse.core.runtime/about.html b/bundles/org.eclipse.core.runtime/about.html
deleted file mode 100644
index 4602330..0000000
--- a/bundles/org.eclipse.core.runtime/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime/build.properties b/bundles/org.eclipse.core.runtime/build.properties
deleted file mode 100644
index 8521e17..0000000
--- a/bundles/org.eclipse.core.runtime/build.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-###############################################################################
-# Copyright (c) 2003, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = .options,\
- about.html,\
- plugin.properties,\
- plugin.xml,\
- .,\
- META-INF/
-source.. = src/
-src.includes = about.html,\
- schema/
-
diff --git a/bundles/org.eclipse.core.runtime/component.xml b/bundles/org.eclipse.core.runtime/component.xml
deleted file mode 100644
index c1feece..0000000
--- a/bundles/org.eclipse.core.runtime/component.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<component xmlns="http://eclipse.org/component"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://eclipse.org/component ../component.xsd "
- name="Eclipse Platform Runtime">
- <component-depends unrestricted="true"/>
-
- <plugin id="org.eclipse.core.runtime" />
- <plugin id="org.eclipse.core.runtime.compatibility" />
-
- <package name="org.eclipse.core.boot"/>
-
- <package name="org.eclipse.core.runtime">
- <type name="EventStats" instantiate="false" subclass="false" />
- <type name="IAdapterManager" implement="false" />
- <type name="IConfigurationElement" implement="false" />
- <type name="IExtension" implement="false" />
- <type name="IExtensionDelta" implement="false" />
- <type name="IExtensionPoint" implement="false" />
- <type name="IExtensionRegistry" implement="false" />
- <type name="ILibrary" implement="false" />
- <type name="ILog" implement="false" />
- <type name="InvalidRegistryObjectException" subclass="false" instantiate="false"/>
- <type name="IPath" implement="false" />
- <type name="IPluginDescriptor" implement="false" />
- <type name="IPluginPrerequisite" implement="false" />
- <type name="IPluginRegistry" implement="false" />
- <type name="IRegistryChangeEvent" implement="false" />
- <type name="Path" subclass="false" />
- <type name="PluginVersionIdentifier" subclass="false" />
- <type name="Preferences" subclass="false" />
- <type name="QualifiedName" subclass="false" />
- </package>
-
- <package name="org.eclipse.core.runtime.content">
- <type name="BinarySignatureDescriber" instantiate="false" />
- <type name="IContentDescription" implement="false" />
- <type name="IContentType" implement="false" />
- <type name="IContentTypeManager" implement="false" />
- <type name="XMLRootElementContentDescriber2" instantiate="false" />
- </package>
-
- <package name="org.eclipse.core.runtime.dynamicHelpers"/>
-
- <package name="org.eclipse.core.runtime.jobs">
- <type name="IJobChangeEvent" implement="false" />
- <type name="IJobManager" implement="false" />
- <type name="IJobStatus" implement="false" />
- <type name="ILock" implement="false" />
- <type name="MultiRule" subclass="false" />
- </package>
-
- <package name="org.eclipse.core.runtime.preferences">
- <type name="IExportedPreferences" implement="false" />
- <type name="IPreferencesService" implement="false" />
- </package>
-
- <package name="org.osgi.service.prefs"/>
-
- <package name="org.eclipse.core.runtime.model"/>
-
-</component>
diff --git a/bundles/org.eclipse.core.runtime/plugin.properties b/bundles/org.eclipse.core.runtime/plugin.properties
deleted file mode 100644
index 9cb532f..0000000
--- a/bundles/org.eclipse.core.runtime/plugin.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-###############################################################################
-# Copyright (c) 2003, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-pluginName = Core Runtime
-providerName = Eclipse.org
-shutdownHook = Shutdown Hook
-contentTypesName = Content Types
-preferencesName=Preferences
diff --git a/bundles/org.eclipse.core.runtime/plugin.xml b/bundles/org.eclipse.core.runtime/plugin.xml
deleted file mode 100644
index 01496e6..0000000
--- a/bundles/org.eclipse.core.runtime/plugin.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <extension-point id="preferences" name="%preferencesName" schema="schema/preferences.exsd"/>
- <extension-point id="contentTypes" name="%contentTypesName" schema="schema/contentTypes.exsd"/>
-</plugin>
diff --git a/bundles/org.eclipse.core.runtime/schema/contentTypes.exsd b/bundles/org.eclipse.core.runtime/schema/contentTypes.exsd
deleted file mode 100644
index 5c01ad4..0000000
--- a/bundles/org.eclipse.core.runtime/schema/contentTypes.exsd
+++ /dev/null
@@ -1,361 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.core.runtime" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.eclipse.core.runtime" id="contentTypes" name="Content Types"/>
- </appinfo>
- <documentation>
- The content types extension point allows plug-ins to contribute to the platform content type catalog. There are two forms of contributions: <cite>content types</cite> and <cite>file associations</cite>.
-<ul>
-<li>
-a content type represents a file format and its naming conventions. Content types can be defined from scratch, or can inherit from existing ones, specializing them. Also, a content type can be made into an alias for another content type (see the <code>alias-for</code> attribute). When this feature is used:
- <ul><li>if the target is absent, the alias content type is processed
- as a normal content type;</li>
- <li>if the target is present, all references to the alias type are automatically
- transformed into references to the target type, and the alias type cannot be
- accessed nor is exposed through the API.</li></ul>
-</li>
-<li>
-a file association extends an existing content type by associating new file names and/or extensions to it</li>
-</ul>
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="content-type" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="file-association" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="content-type">
- <complexType>
- <sequence>
- <element ref="describer" minOccurs="0" maxOccurs="1"/>
- <element ref="property" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- the identifier for this content type (either a simple id unique for content types within the extension namespace, or a fully qualified id). The token cannot contain whitespace
- </documentation>
- </annotation>
- </attribute>
- <attribute name="base-type" type="string">
- <annotation>
- <documentation>
- the fully qualified identifier of this content type's base type. This content type will inherit its base type's file associations, content describer and default charset, unless they are redefined
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- the human-readable name of this content type
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="file-extensions" type="string">
- <annotation>
- <documentation>
- a comma-separated list of file extensions to be associated with this content type
- </documentation>
- </annotation>
- </attribute>
- <attribute name="file-names" type="string">
- <annotation>
- <documentation>
- a comma-separated list of file names to be associated with this content type
- </documentation>
- </annotation>
- </attribute>
- <attribute name="priority" use="default" value="normal">
- <annotation>
- <documentation>
- the priority for this content type. Priorities are used to solve conflicts (when two content types are associated to the same file name/extension)
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="low">
- </enumeration>
- <enumeration value="normal">
- </enumeration>
- <enumeration value="high">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- <attribute name="default-charset" type="string">
- <annotation>
- <documentation>
- the default charset for this content type, or an empty string, if this content type should not have a default charset even if the parent has one. This is a convenience attribute, equivalent to specifying:
-<pre>
- <content-type>
- <property name="org.eclipse.core.runtime.charset" default="charset-name"/>
- </content-type>
-</pre>
- </documentation>
- </annotation>
- </attribute>
- <attribute name="describer" type="string">
- <annotation>
- <documentation>
- the fully qualified name of a class that implements <samp>org.eclipse.core.runtime.content.IContentDescriber</samp> or <samp>org.eclipse.core.runtime.content.ITextContentDescriber</samp>, or an empty string, if this content type should not have a describer even if the parent has one
- </documentation>
- <appinfo>
- <meta.attribute kind="java"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="alias-for" type="string">
- <annotation>
- <documentation>
- the fully qualified identifier of the content type this content type is an alias for
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="describer">
- <annotation>
- <documentation>
- If the describer attribute is used in the content-type element, this element is ignored.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- the fully qualified name of a class that implements <samp>org.eclipse.core.runtime.content.IContentDescriber</samp> or <samp>org.eclipse.core.runtime.content.ITextContentDescriber</samp>, or an empty string, if this content type should not have a describer even if the parent has one
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn="org.eclipse.core.runtime.content.IContentDescriber"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="plugin" type="string">
- <annotation>
- <documentation>
- the id for the plug-in providing the describer class
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="file-association">
- <complexType>
- <attribute name="content-type" type="string" use="required">
- <annotation>
- <documentation>
- the fully qualified identifier for the content type this file association contributes to
- </documentation>
- </annotation>
- </attribute>
- <attribute name="file-names" type="string">
- <annotation>
- <documentation>
- a comma-separated list of file names to be associated with the target content type
- </documentation>
- </annotation>
- </attribute>
- <attribute name="file-extensions" type="string">
- <annotation>
- <documentation>
- a comma-separated list of file extensions to be associated with the target content type
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="parameter">
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- the name of this parameter made available to instances of the specified content describer class
- </documentation>
- </annotation>
- </attribute>
- <attribute name="value" type="string" use="required">
- <annotation>
- <documentation>
- an arbitrary value associated with the given name and made available to instances of the specified content describer class
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="property">
- <annotation>
- <documentation>
- Declares a property related to this content type, optionally assigning a default value. See <samp>org.eclipse.core.runtime.content.IContentDescription</samp> for more information on properties.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- the name of the property. If the property is being overriden and has been originally defined in a different namespace, a fully qualified property name must be used
- </documentation>
- </annotation>
- </attribute>
- <attribute name="default" type="string">
- <annotation>
- <documentation>
- the default value of the property, or an empty string, if this content type should not have a default value for this property even if a parent has one
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="examples"/>
- </appinfo>
- <documentation>
- Following is an example of a XML-based content type declaration using <code>org.eclipse.core.runtime.content.XMLRootElementContentDescriber2</code>,
-a built-in describer:
-<p>
-<pre>
- <extension point="org.eclipse.core.runtime.contentTypes">
- <content-type id="ABC"
- base-type="org.eclipse.core.runtime.xml"
- file-extensions="a,b,c">
- <describer class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber2">
- <parameter name="element" value="abc"/>
- </describer>
- </content-type>
- </extension>
-</pre>
-</p>
-Here is an example of a simple text-based content type that has a specific file extension:
-<p>
-<pre>
- <extension point="org.eclipse.core.runtime.contentTypes">
- <content-type id="MyText"
- base-type="org.eclipse.core.runtime.text"
- file-extensions="mytxt"/>
- </extension>
-</pre>
-</p>
-When there is need to associate new file names/extensions to an existing content type (as opposed to defining a new content type), a plug-in can contribute a file association as seen below. This has the effect of enhancing the definition of the text content type to include files with names following the "*.mytxt" pattern.
-<p>
-<pre>
- <extension point="org.eclipse.core.runtime.contentTypes">
- <file-association
- content-type="org.eclipse.core.runtime.text"
- file-extensions="mytxt"/>
- </extension>
-</pre>
-</p>
-Here is an example of a content type that defines properties:
-<pre>
- <extension point="org.eclipse.core.runtime.contentTypes">
- <content-type id="MyContentType"
- file-extensions="dat">
- <property name="file-format" value="1"/>
- </content-type>
- </extension>
-</pre>
-</p>
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="apiInfo"/>
- </appinfo>
- <documentation>
- The value of the class attribute in the describer element must represent an
-implementor of
-<samp>org.eclipse.core.runtime.content.IContentDescriber</samp> or <samp>org.eclipse.core.runtime.content.ITextContentDescriber</samp>.
-
-<samp>org.eclipse.core.runtime.content.IContentDescription</samp> objects returned by the <samp>org.eclipse.core.runtime.content</samp> API
- </documentation>
- </annotation>
-
-
- <annotation>
- <appinfo>
- <meta.section type="implementation"/>
- </appinfo>
- <documentation>
- <p>The org.eclipse.core.runtime plug-in provides the following content types:<ul>
-<li>org.eclipse.core.runtime.text</li>
-<li>org.eclipse.core.runtime.xml</li>
-</ul>
-Other plug-ins in the platform contribute other content types.
-</p>
-<p>
-Also, the org.eclipse.core.runtime plug-in provides ready-to-use implementations of content describers:<ul>
-<li>org.eclipse.core.runtime.content.XMLRootElementContentDescriber2</li>
-<li>org.eclipse.core.runtime.content.BinarySignatureDescriber</li>
-</ul>
-</p>
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="copyright"/>
- </appinfo>
- <documentation>
- Copyright (c) 2004, 2005 IBM Corporation and others.<br>
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which
-accompanies
-this distribution, and is available at
-<a
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.core.runtime/schema/preferences.exsd b/bundles/org.eclipse.core.runtime/schema/preferences.exsd
deleted file mode 100644
index 41d0a83..0000000
--- a/bundles/org.eclipse.core.runtime/schema/preferences.exsd
+++ /dev/null
@@ -1,174 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.core.runtime">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.core.runtime" id="preferences" name="Preferences"/>
- </appInfo>
- <documentation>
- The preferences extension point allows plug-ins to add new preference scopes to the Eclipse preference mechanism as well as specify the class to run to initialize default preference values at runtime.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="scope" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="initializer" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="modifier" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="scope">
- <annotation>
- <documentation>
- Element describing a client's definiton of a new preference scope.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- The name of the scope.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- The name of the class.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="IScope"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="initializer">
- <annotation>
- <documentation>
- Element which defines the class to use for runtime preference initialization.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- The name of the class.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="modifier">
- <annotation>
- <documentation>
- Element which defines the class to use for preference modification listening.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- The name of the class.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.core.runtime.preferences.PreferenceModifyListener"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- Following is an example of a preference scope declaration. This example declares that this plug-in will provide a preference implementation for the scope "foo". It also declares that when the default values are loaded for this plug-in, the class "MyPreferenceInitializer" contains code to be run to initialize preference default values at runtime.
-<p>
- <pre>
- <extension point="org.eclipse.core.runtime.preferences">
- <scope name="foo" class="com.example.FooPrefs"/>
- <initializer class="com.example.MyPreferenceInitializer"/>
- <modifier class="com.example.MyModifyListener"/>
- </extension>
- </pre>
-</p>
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Supplied preference initializers must subclass <code>org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer</code>. Preference modify listeners must subclass <code>org.eclipse.core.runtime.preferences.PreferenceModifyListener</code>. The preference service (obtained by calling <code>org.eclipse.core.runtime.Platform.getPreferencesService()</code>) is the hook into the Eclipse preference mechanism.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The org.eclipse.core.runtime plug-in provides preference implementations for the "configuration", "instance", and "default" scopes. The org.eclipse.core.resources plug-in provides an implementation for "project" preferences.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2004, 2005 IBM Corporation and others.<br>
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which
-accompanies
-this distribution, and is available at
-<a
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.core.runtime/scripts/src-runtime.jardesc b/bundles/org.eclipse.core.runtime/scripts/src-runtime.jardesc
deleted file mode 100644
index 865c948..0000000
--- a/bundles/org.eclipse.core.runtime/scripts/src-runtime.jardesc
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jardesc>
- <jar path="C:/IBM/Equinox/workspaces/Equinox/org.eclipse.core.runtime/runtime.jar"/>
- <options compress="true"
- descriptionLocation="/org.eclipse.core.runtime/scripts/src-runtime.jardesc"
- exportErrors="true" exportWarnings="true" logErrors="true"
- logWarnings="true" overwrite="false" saveDescription="true" useSourceFolders="false"/>
- <manifest generateManifest="false"
- manifestLocation="/org.eclipse.core.runtime/src-runtime/META-INF/MANIFEST.MF"
- manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="false">
- <sealing sealJar="false"><packagesToSeal/><packagesToUnSeal/></sealing>
- </manifest>
- <selectedElements exportClassFiles="true" exportJavaFiles="false">
- <javaElement handleIdentifier="=org.eclipse.core.runtime/src-runtime"/>
- </selectedElements>
-</jardesc>
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/legacy/InitLegacyPreferences.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/legacy/InitLegacyPreferences.java
deleted file mode 100644
index c726892..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/legacy/InitLegacyPreferences.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.preferences.legacy;
-
-import org.eclipse.core.internal.preferences.exchange.ILegacyPreferences;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-
-/**
- * Provides initialization of the legacy preferences as described in
- * the Plugin class.
- */
-public class InitLegacyPreferences implements ILegacyPreferences {
- /**
- * The method tries to initialize the preferences using the legacy Plugin method.
- *
- * @param object - plugin to initialize
- * @param name - ID of the plugin to be initialized
- *
- * @see Plugin#initializeDefaultPluginPreferences
- *
- * @since org.eclipse.core.runtime 3.2
- *
- * @deprecated Marked deprecated to supress warnings. This class is added to support
- * backward compatibility only and should not be used in any new code.
- */
- public Object init(Object object, String name) {
- Plugin plugin = null;
- if (object instanceof Plugin)
- plugin = (Plugin) object;
- // No extension exists. Get the plug-in object and call #initializeDefaultPluginPreferences().
- // We can only call this if the runtime compatibility layer is installed.
- if (plugin == null && InternalPlatform.getDefault().getBundle(org.eclipse.core.internal.runtime.CompatibilityHelper.PI_RUNTIME_COMPATIBILITY) != null)
- plugin = Platform.getPlugin(name);
- if (plugin == null) {
- if (InternalPlatform.DEBUG_PLUGIN_PREFERENCES)
- InternalPlatform.message("No plug-in object available to set plug-in default preference overrides for:" + name); //$NON-NLS-1$
- return null;
- }
- if (InternalPlatform.DEBUG_PLUGIN_PREFERENCES)
- InternalPlatform.message("Applying plug-in default preference overrides for plug-in: " + plugin.getDescriptor().getUniqueIdentifier()); //$NON-NLS-1$
-
- plugin.internalInitializeDefaultPluginPreferences();
- return plugin;
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/legacy/PreferenceForwarder.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/legacy/PreferenceForwarder.java
deleted file mode 100644
index c065942..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/legacy/PreferenceForwarder.java
+++ /dev/null
@@ -1,870 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.preferences.legacy;
-
-import java.io.*;
-import java.util.Iterator;
-import java.util.Properties;
-import org.eclipse.core.internal.preferences.*;
-import org.eclipse.core.internal.runtime.RuntimeLog;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.preferences.DefaultScope;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * This class represents a convenience layer between the Eclipse 3.0
- * preferences and pre-3.0 preferences. It acts as a bridge between the
- * org.eclipse.core.runtime.Preferences object associated with a particular plug-in
- * object, and its corresponding preference node in the 3.0 preference node
- * hierarchy.
- *
- * @since 3.0
- */
-public class PreferenceForwarder extends Preferences implements IEclipsePreferences.IPreferenceChangeListener, IEclipsePreferences.INodeChangeListener {
-
- private static final byte[] BYTE_ARRAY_DEFAULT_DEFAULT = new byte[0];
-
- private IEclipsePreferences pluginRoot = (IEclipsePreferences) PreferencesService.getDefault().getRootNode().node(InstanceScope.SCOPE);
- private DefaultPreferences defaultsRoot = (DefaultPreferences) PreferencesService.getDefault().getRootNode().node(DefaultScope.SCOPE);
- private String pluginID;
- private Object plugin;
- // boolean to check to see if we should re-wrap and forward change
- // events coming from the new runtime APIs.
- private boolean notify = true;
-
- /*
- * Used for test suites only.
- */
- public PreferenceForwarder(String pluginID) {
- this(null, pluginID);
- }
-
- public PreferenceForwarder(Object plugin, String pluginID) {
- super();
- this.plugin = plugin;
- this.pluginID = pluginID;
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#added(org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent)
- */
- public synchronized void added(IEclipsePreferences.NodeChangeEvent event) {
- if (listeners.size() > 0 && pluginID.equals(event.getChild().name())) {
- try {
- EclipsePreferences prefs = (EclipsePreferences) event.getChild();
- prefs.addPreferenceChangeListener(this);
- } catch (ClassCastException e) {
- throw new RuntimeException("Plug-in preferences must be instances of EclipsePreferences: " + e.getMessage()); //$NON-NLS-1$
- }
- }
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#removed(org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent)
- */
- public synchronized void removed(IEclipsePreferences.NodeChangeEvent event) {
- // Do nothing. We can't remove ourselves from the node's list of preference change
- // listeners because the node has already been removed.
- }
-
- /**
- * Adds a property change listener to this preference object.
- * Has no affect if the identical listener is already registered.
- *
- * @param listener a property change listener
- */
- public synchronized void addPropertyChangeListener(IPropertyChangeListener listener) {
- if (listeners.size() == 0) {
- EclipsePreferences prefs = getPluginPreferences(false);
- if (prefs != null) {
- prefs.addPreferenceChangeListener(this);
- }
- pluginRoot.addNodeChangeListener(this);
- }
- listeners.add(listener);
- }
-
-
- /*
- * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent)
- */
- public void preferenceChange(IEclipsePreferences.PreferenceChangeEvent event) {
- // if we are the ones making this change, then don't broadcast
- if (!notify)
- return;
- Object oldValue = event.getOldValue();
- Object newValue = event.getNewValue();
- String key = event.getKey();
- if (newValue == null)
- newValue = getDefault(key, oldValue);
- else if (oldValue == null)
- oldValue = getDefault(key, newValue);
- firePropertyChangeEvent(key, oldValue, newValue);
- }
-
- private EclipsePreferences getPluginPreferences(boolean create) {
- try {
- if (!create && !pluginRoot.nodeExists(pluginID))
- return null;
- } catch (BackingStoreException e) {
- return null;
- }
- try {
- return (EclipsePreferences) pluginRoot.node(pluginID);
- } catch (ClassCastException e) {
- throw new RuntimeException("Plug-in preferences must be instances of EclipsePreferences: " + e.getMessage()); //$NON-NLS-1$
- }
- }
-
- private IEclipsePreferences getDefaultPreferences() {
- return defaultsRoot.node(pluginID, plugin);
- }
-
- /**
- * Removes the given listener from this preference object.
- * Has no affect if the listener is not registered.
- *
- * @param listener a property change listener
- */
- public synchronized void removePropertyChangeListener(IPropertyChangeListener listener) {
- listeners.remove(listener);
- if (listeners.size() == 0) {
- EclipsePreferences prefs = getPluginPreferences(false);
- if (prefs != null) {
- prefs.removePreferenceChangeListener(this);
- }
- pluginRoot.removeNodeChangeListener(this);
- }
- }
-
-
- /**
- * Does its best at determining the default value for the given key. Checks the
- * given object's type and then looks in the list of defaults to see if a value
- * exists. If not or if there is a problem converting the value, the default default
- * value for that type is returned.
- */
- private Object getDefault(String key, Object obj) {
- IEclipsePreferences defaults = getDefaultPreferences();
- if (obj instanceof String)
- return defaults.get(key, STRING_DEFAULT_DEFAULT);
- else if (obj instanceof Integer)
- return new Integer(defaults.getInt(key, INT_DEFAULT_DEFAULT));
- else if (obj instanceof Double)
- return new Double(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT));
- else if (obj instanceof Float)
- return new Float(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT));
- else if (obj instanceof Long)
- return new Long(defaults.getLong(key, LONG_DEFAULT_DEFAULT));
- else if (obj instanceof byte[])
- return defaults.getByteArray(key, BYTE_ARRAY_DEFAULT_DEFAULT);
- else if (obj instanceof Boolean)
- return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE;
- else
- return null;
- }
-
- /**
- * Returns whether the given property is known to this preference object,
- * either by having an explicit setting or by having a default
- * setting.
- *
- * @param name the name of the property
- * @return <code>true</code> if either a current value or a default
- * value is known for the named property, and <code>false</code>otherwise
- */
- public boolean contains(String name) {
- if (name == null)
- return false;
- String value = getPluginPreferences(true).get(name, null);
- if (value != null)
- return true;
- return getDefaultPreferences().get(name, null) != null;
- }
-
- /**
- * Returns the current value of the boolean-valued property with the
- * given name.
- * Returns the default-default value (<code>false</code>) if there
- * is no property with the given name, or if the current value
- * cannot be treated as a boolean.
- *
- * @param name the name of the property
- * @return the boolean-valued property
- */
- public boolean getBoolean(String name) {
- return getPluginPreferences(true).getBoolean(name, getDefaultPreferences().getBoolean(name, BOOLEAN_DEFAULT_DEFAULT));
- }
-
- /**
- * Sets the current value of the boolean-valued property with the
- * given name.
- * <p>
- * A property change event is reported if the current value of the
- * property actually changes from its previous value. In the event
- * object, the property name is the name of the property, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * If the given value is the same as the corresponding default value
- * for the given property, the explicit setting is deleted.
- * Note that the recommended way of re-initializing a property to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the property
- * @param value the new current value of the property
- */
- public void setValue(String name, boolean value) {
- Boolean oldValue = getBoolean(name) ? Boolean.TRUE : Boolean.FALSE;
- Boolean newValue = value ? Boolean.TRUE : Boolean.FALSE;
- if (newValue == oldValue)
- return;
- try {
- notify = false;
- if (getDefaultBoolean(name) == value)
- getPluginPreferences(true).remove(name);
- else
- getPluginPreferences(true).putBoolean(name, value);
- firePropertyChangeEvent(name, oldValue, newValue);
- } finally {
- notify = true;
- }
- }
-
- /**
- * Returns the default value for the boolean-valued property
- * with the given name.
- * Returns the default-default value (<code>false</code>) if there
- * is no default property with the given name, or if the default
- * value cannot be treated as a boolean.
- *
- * @param name the name of the property
- * @return the default value of the named property
- */
- public boolean getDefaultBoolean(String name) {
- return getDefaultPreferences().getBoolean(name, BOOLEAN_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the default value for the boolean-valued property with the
- * given name.
- * <p>
- * Note that the current value of the property is affected if
- * the property's current value was its old default value, in which
- * case it changes to the new default value. If the property's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the property
- * @param value the new default value for the property
- */
- public void setDefault(String name, boolean value) {
- getDefaultPreferences().putBoolean(name, value);
- }
-
- /**
- * Returns the current value of the double-valued property with the
- * given name.
- * Returns the default-default value (<code>0.0</code>) if there
- * is no property with the given name, or if the current value
- * cannot be treated as a double.
- *
- * @param name the name of the property
- * @return the double-valued property
- */
- public double getDouble(String name) {
- return getPluginPreferences(true).getDouble(name, getDefaultPreferences().getDouble(name, DOUBLE_DEFAULT_DEFAULT));
- }
-
- /**
- * Sets the current value of the double-valued property with the
- * given name.
- * <p>
- * A property change event is reported if the current value of the
- * property actually changes from its previous value. In the event
- * object, the property name is the name of the property, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * If the given value is the same as the corresponding default value
- * for the given property, the explicit setting is deleted.
- * Note that the recommended way of re-initializing a property to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the property
- * @param value the new current value of the property; must be
- * a number (not a NaN)
- */
- public void setValue(String name, double value) {
- if (Double.isNaN(value))
- throw new IllegalArgumentException();
- final double doubleValue = getDouble(name);
- if (value == doubleValue)
- return;
- Double oldValue = new Double(doubleValue);
- Double newValue = new Double(value);
- try {
- notify = false;
- if (getDefaultDouble(name) == value)
- getPluginPreferences(true).remove(name);
- else
- getPluginPreferences(true).putDouble(name, value);
- firePropertyChangeEvent(name, oldValue, newValue);
- } finally {
- notify = true;
- }
- }
-
- /**
- * Returns the default value for the double-valued property
- * with the given name.
- * Returns the default-default value (<code>0.0</code>) if there
- * is no default property with the given name, or if the default
- * value cannot be treated as a double.
- *
- * @param name the name of the property
- * @return the default value of the named property
- */
- public double getDefaultDouble(String name) {
- return getDefaultPreferences().getDouble(name, DOUBLE_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the default value for the double-valued property with the
- * given name.
- * <p>
- * Note that the current value of the property is affected if
- * the property's current value was its old default value, in which
- * case it changes to the new default value. If the property's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the property
- * @param value the new default value for the property; must be
- * a number (not a NaN)
- */
- public void setDefault(String name, double value) {
- if (Double.isNaN(value))
- throw new IllegalArgumentException();
- getDefaultPreferences().putDouble(name, value);
- }
-
- /**
- * Returns the current value of the float-valued property with the
- * given name.
- * Returns the default-default value (<code>0.0f</code>) if there
- * is no property with the given name, or if the current value
- * cannot be treated as a float.
- *
- * @param name the name of the property
- * @return the float-valued property
- */
- public float getFloat(String name) {
- return getPluginPreferences(true).getFloat(name, getDefaultPreferences().getFloat(name, FLOAT_DEFAULT_DEFAULT));
- }
-
- /**
- * Sets the current value of the float-valued property with the
- * given name.
- * <p>
- * A property change event is reported if the current value of the
- * property actually changes from its previous value. In the event
- * object, the property name is the name of the property, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * If the given value is the same as the corresponding default value
- * for the given property, the explicit setting is deleted.
- * Note that the recommended way of re-initializing a property to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the property
- * @param value the new current value of the property; must be
- * a number (not a NaN)
- */
- public void setValue(String name, float value) {
- if (Float.isNaN(value))
- throw new IllegalArgumentException();
- final float floatValue = getFloat(name);
- if (value == floatValue)
- return;
- Float oldValue = new Float(floatValue);
- Float newValue = new Float(value);
- try {
- notify = false;
- if (getDefaultFloat(name) == value)
- getPluginPreferences(true).remove(name);
- else
- getPluginPreferences(true).putFloat(name, value);
- firePropertyChangeEvent(name, oldValue, newValue);
- } finally {
- notify = true;
- }
- }
-
- /**
- * Returns the default value for the float-valued property
- * with the given name.
- * Returns the default-default value (<code>0.0f</code>) if there
- * is no default property with the given name, or if the default
- * value cannot be treated as a float.
- *
- * @param name the name of the property
- * @return the default value of the named property
- */
- public float getDefaultFloat(String name) {
- return getDefaultPreferences().getFloat(name, FLOAT_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the default value for the float-valued property with the
- * given name.
- * <p>
- * Note that the current value of the property is affected if
- * the property's current value was its old default value, in which
- * case it changes to the new default value. If the property's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the property
- * @param value the new default value for the property; must be
- * a number (not a NaN)
- */
- public void setDefault(String name, float value) {
- if (Float.isNaN(value))
- throw new IllegalArgumentException();
- getDefaultPreferences().putFloat(name, value);
- }
-
- /**
- * Returns the current value of the integer-valued property with the
- * given name.
- * Returns the default-default value (<code>0</code>) if there
- * is no property with the given name, or if the current value
- * cannot be treated as an integter.
- *
- * @param name the name of the property
- * @return the int-valued property
- */
- public int getInt(String name) {
- return getPluginPreferences(true).getInt(name, getDefaultPreferences().getInt(name, INT_DEFAULT_DEFAULT));
- }
-
- /**
- * Sets the current value of the integer-valued property with the
- * given name.
- * <p>
- * A property change event is reported if the current value of the
- * property actually changes from its previous value. In the event
- * object, the property name is the name of the property, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * If the given value is the same as the corresponding default value
- * for the given property, the explicit setting is deleted.
- * Note that the recommended way of re-initializing a property to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the property
- * @param value the new current value of the property
- */
- public void setValue(String name, int value) {
- final int intValue = getInt(name);
- if (value == intValue)
- return;
- Integer oldValue = new Integer(intValue);
- Integer newValue = new Integer(value);
- try {
- notify = false;
- if (getDefaultInt(name) == value)
- getPluginPreferences(true).remove(name);
- else
- getPluginPreferences(true).putInt(name, value);
- firePropertyChangeEvent(name, oldValue, newValue);
- } finally {
- notify = true;
- }
- }
-
- /**
- * Returns the default value for the integer-valued property
- * with the given name.
- * Returns the default-default value (<code>0</code>) if there
- * is no default property with the given name, or if the default
- * value cannot be treated as an integer.
- *
- * @param name the name of the property
- * @return the default value of the named property
- */
- public int getDefaultInt(String name) {
- return getDefaultPreferences().getInt(name, INT_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the default value for the integer-valued property with the
- * given name.
- * <p>
- * Note that the current value of the property is affected if
- * the property's current value was its old default value, in which
- * case it changes to the new default value. If the property's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the property
- * @param value the new default value for the property
- */
- public void setDefault(String name, int value) {
- getDefaultPreferences().putInt(name, value);
- }
-
- /**
- * Returns the current value of the long-valued property with the
- * given name.
- * Returns the default-default value (<code>0L</code>) if there
- * is no property with the given name, or if the current value
- * cannot be treated as a long.
- *
- * @param name the name of the property
- * @return the long-valued property
- */
- public long getLong(String name) {
- return getPluginPreferences(true).getLong(name, getDefaultPreferences().getLong(name, LONG_DEFAULT_DEFAULT));
- }
-
- /**
- * Sets the current value of the long-valued property with the
- * given name.
- * <p>
- * A property change event is reported if the current value of the
- * property actually changes from its previous value. In the event
- * object, the property name is the name of the property, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * If the given value is the same as the corresponding default value
- * for the given property, the explicit setting is deleted.
- * Note that the recommended way of re-initializing a property to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the property
- * @param value the new current value of the property
- */
- public void setValue(String name, long value) {
- final long longValue = getLong(name);
- if (value == longValue)
- return;
- Long oldValue = new Long(longValue);
- Long newValue = new Long(value);
- try {
- notify = false;
- if (getDefaultLong(name) == value)
- getPluginPreferences(true).remove(name);
- else
- getPluginPreferences(true).putLong(name, value);
- firePropertyChangeEvent(name, oldValue, newValue);
- } finally {
- notify = true;
- }
- }
-
- /**
- * Returns the default value for the long-valued property
- * with the given name.
- * Returns the default-default value (<code>0L</code>) if there
- * is no default property with the given name, or if the default
- * value cannot be treated as a long.
- *
- * @param name the name of the property
- * @return the default value of the named property
- */
- public long getDefaultLong(String name) {
- return getDefaultPreferences().getLong(name, LONG_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the default value for the long-valued property with the
- * given name.
- * <p>
- * Note that the current value of the property is affected if
- * the property's current value was its old default value, in which
- * case it changes to the new default value. If the property's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the property
- * @param value the new default value for the property
- */
- public void setDefault(String name, long value) {
- getDefaultPreferences().putLong(name, value);
- }
-
- /**
- * Returns the current value of the string-valued property with the
- * given name.
- * Returns the default-default value (the empty string <code>""</code>)
- * if there is no property with the given name.
- *
- * @param name the name of the property
- * @return the string-valued property
- */
- public String getString(String name) {
- return getPluginPreferences(true).get(name, getDefaultPreferences().get(name, STRING_DEFAULT_DEFAULT));
- }
-
- /**
- * Sets the current value of the string-valued property with the
- * given name.
- * <p>
- * A property change event is reported if the current value of the
- * property actually changes from its previous value. In the event
- * object, the property name is the name of the property, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * If the given value is the same as the corresponding default value
- * for the given property, the explicit setting is deleted.
- * Note that the recommended way of re-initializing a property to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the property
- * @param value the new current value of the property
- */
- public void setValue(String name, String value) {
- if (value == null)
- throw new IllegalArgumentException();
- String oldValue = getString(name);
- if (value.equals(oldValue))
- return;
- try {
- notify = false;
- if (getDefaultString(name).equals(value))
- getPluginPreferences(true).remove(name);
- else
- getPluginPreferences(true).put(name, value);
- firePropertyChangeEvent(name, oldValue, value);
- } finally {
- notify = true;
- }
- }
-
- /**
- * Returns the default value for the string-valued property
- * with the given name.
- * Returns the default-default value (the empty string <code>""</code>)
- * is no default property with the given name, or if the default
- * value cannot be treated as a string.
- *
- * @param name the name of the property
- * @return the default value of the named property
- */
- public String getDefaultString(String name) {
- return getDefaultPreferences().get(name, STRING_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the default value for the string-valued property with the
- * given name.
- * <p>
- * Note that the current value of the property is affected if
- * the property's current value was its old default value, in which
- * case it changes to the new default value. If the property's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the property
- * @param value the new default value for the property
- */
- public void setDefault(String name, String value) {
- if (value == null)
- throw new IllegalArgumentException();
- getDefaultPreferences().put(name, value);
- }
-
- /**
- * Returns whether the property with the given name has the default value in
- * virtue of having no explicitly set value.
- *
- * @param name the name of the property
- * @return <code>true</code> if the property has no explicitly set value,
- * and <code>false</code> otherwise (including the case where the property
- * is unknown to this object)
- */
- public boolean isDefault(String name) {
- if (name == null)
- return false;
- return getPluginPreferences(true).get(name, null) == null;
- }
-
- /**
- * Sets the current value of the property with the given name back
- * to its default value. Has no effect if the property does not have
- * its own current value.
- * <p>
- * Note that the recommended way of re-initializing a property to the
- * appropriate default value is to call <code>setToDefault</code>.
- * This is implemented by removing the named value from the object,
- * thereby exposing the default value.
- * </p>
- * <p>
- * A property change event is always reported. In the event
- * object, the property name is the name of the property, and the
- * old and new values are either strings, or <code>null</code>
- * indicating the default-default value.
- * </p>
- *
- * @param name the name of the property
- */
- public void setToDefault(String name) {
- IEclipsePreferences preferences = getPluginPreferences(true);
- Object oldValue = preferences.get(name, null);
- if (oldValue != null)
- preferences.remove(name);
- }
-
- /**
- * Returns a list of all properties known to this preference object which
- * have current values other than their default value.
- *
- * @return an array of property names
- */
- public String[] propertyNames() {
- return getPluginPreferences(true).keys();
- }
-
- /**
- * Returns a list of all properties known to this preference object which
- * have default values other than their default-default value.
- *
- * @return an array of property names
- */
- public String[] defaultPropertyNames() {
- try {
- return getDefaultPreferences().keys();
- } catch (BackingStoreException e) {
- logError(e.getMessage(), e);
- return new String[0];
- }
- }
-
- /**
- * Returns whether the current values in this preference object
- * require saving.
- *
- * @return <code>true</code> if at least one of the properties
- * known to this preference object has a current value different from its
- * default value, and <code>false</code> otherwise
- */
- public boolean needsSaving() {
- return getPluginPreferences(true).isDirty();
- }
-
- /**
- * Flush the values of these plug-in preferences to disk.
- *
- * @throws BackingStoreException
- */
- public void flush() throws BackingStoreException {
- IEclipsePreferences node = getPluginPreferences(false);
- if (node != null)
- node.flush();
- }
-
- /*
- * Something bad happened so log it.
- */
- private void logError(String message, Exception e) {
- IStatus status = new Status(IStatus.ERROR, PrefsMessages.OWNER_NAME, IStatus.ERROR, message, e);
- RuntimeLog.log(status);
- }
-
- /*
- * @see org.eclipse.core.runtime.Preferences#load(java.io.InputStream)
- */
- public void load(InputStream in) throws IOException {
- Properties result = new Properties();
- result.load(in);
- convertFromProperties(result);
- // We loaded the prefs from a non-default location so now
- // store them to disk. This also clears the dirty flag
- // and therefore sets the #needsSaving() state correctly.
- try {
- flush();
- } catch (BackingStoreException e) {
- throw new IOException(e.getMessage());
- }
- }
-
- /*
- * @see org.eclipse.core.runtime.Preferences#store(java.io.OutputStream, java.lang.String)
- */
- public void store(OutputStream out, String header) throws IOException {
- Properties result = convertToProperties();
- result.store(out, header);
- // We stored the prefs to a non-default location but the spec
- // says that the dirty state is cleared so we want to store
- // them to disk at the default location as well.
- try {
- flush();
- } catch (BackingStoreException e) {
- throw new IOException(e.getMessage());
- }
- }
-
- private void convertFromProperties(Properties props) {
- IEclipsePreferences preferences = getPluginPreferences(true);
- for (Iterator i = props.keySet().iterator(); i.hasNext();) {
- String key = (String) i.next();
- String value = props.getProperty(key);
- if (value != null)
- preferences.put(key, value);
- }
- }
-
- public String toString() {
- return "PreferenceForwarder(" + pluginID + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * Convert the preferences in this node to a properties file
- * suitable for persistence.
- */
- private Properties convertToProperties() {
- Properties result = new Properties();
- String[] keys = propertyNames();
- for (int i = 0; i < keys.length; i++) {
- String key = keys[i];
- String value = getString(key);
- if (!Preferences.STRING_DEFAULT_DEFAULT.equals(value))
- result.put(key, value);
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/legacy/ProductPreferencesService.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/legacy/ProductPreferencesService.java
deleted file mode 100644
index ebf2e4b..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/legacy/ProductPreferencesService.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.preferences.legacy;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Properties;
-import org.eclipse.core.internal.preferences.exchange.IProductPreferencesService;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.*;
-import org.osgi.framework.Bundle;
-
-public class ProductPreferencesService implements IProductPreferencesService {
-
- private static final IPath NL_DIR = new Path("$nl$"); //$NON-NLS-1$
-
- // declared in org.eclipse.ui.branding.IProductConstants
- public static final String PRODUCT_KEY = "preferenceCustomization"; //$NON-NLS-1$
- private static final String LEGACY_PRODUCT_CUSTOMIZATION_FILENAME = "plugin_customization.ini"; //$NON-NLS-1$
- private static final String PROPERTIES_FILE_EXTENSION = "properties"; //$NON-NLS-1$
-
- private boolean initialized = false;
- private String customizationValue = null; // it won't change during the product run time
- private Bundle customizationBundle = null;
- private String productID = null;
-
- private void initValues() {
- if (initialized)
- return;
- initialized = true;
-
- IProduct product = Platform.getProduct();
- if (product == null) {
- if (InternalPlatform.DEBUG_PLUGIN_PREFERENCES)
- InternalPlatform.message("Product not available to set product default preference overrides."); //$NON-NLS-1$
- return;
- }
- productID = product.getId();
- if (productID == null) {
- if (InternalPlatform.DEBUG_PLUGIN_PREFERENCES)
- InternalPlatform.message("Product ID not available to apply product-level preference defaults."); //$NON-NLS-1$
- return;
- }
- customizationBundle = product.getDefiningBundle();
- if (customizationBundle == null) {
- if (InternalPlatform.DEBUG_PLUGIN_PREFERENCES)
- InternalPlatform.message("Bundle not available to apply product-level preference defaults for product id: " + productID); //$NON-NLS-1$
- return;
- }
- customizationValue = product.getProperty(PRODUCT_KEY);
- if (customizationValue == null) {
- if (InternalPlatform.DEBUG_PLUGIN_PREFERENCES)
- InternalPlatform.message("Product : " + productID + " does not define preference customization file. Using legacy file: plugin_customization.ini"); //$NON-NLS-1$//$NON-NLS-2$
- customizationValue = LEGACY_PRODUCT_CUSTOMIZATION_FILENAME;
- }
- }
-
- public Properties getProductCustomization() {
- initValues();
- URL url = null;
- if (customizationValue != null) {
- // try to convert the key to a URL
- try {
- url = new URL(customizationValue);
- } catch (MalformedURLException e) {
- // didn't work so treat it as a filename
- url = FileLocator.find(customizationBundle, new Path(customizationValue), null);
- }
- }
-
- if (url == null) {
- if (InternalPlatform.DEBUG_PLUGIN_PREFERENCES)
- InternalPlatform.message("Product preference customization file: " + customizationValue + " not found for bundle: " + productID); //$NON-NLS-1$//$NON-NLS-2$
- }
-
- return loadProperties(url);
- }
-
- public Properties getProductTranslation() {
- initValues();
- URL transURL = null;
-
- if (customizationValue != null)
- transURL = FileLocator.find(customizationBundle, NL_DIR.append(customizationValue).removeFileExtension().addFileExtension(PROPERTIES_FILE_EXTENSION), null);
-
- if (transURL == null && InternalPlatform.DEBUG_PLUGIN_PREFERENCES)
- InternalPlatform.message("No preference translations found for product/file: " + customizationBundle.getSymbolicName() + '/' + customizationValue); //$NON-NLS-1$
-
- return loadProperties(transURL);
- }
-
- private Properties loadProperties(URL url) {
- Properties result = new Properties();
- if (url == null)
- return result;
- InputStream input = null;
- try {
- input = url.openStream();
- result.load(input);
- } catch (IOException e) {
- if (InternalPlatform.DEBUG_PLUGIN_PREFERENCES) {
- InternalPlatform.message("Problem opening stream to preference customization file: " + url); //$NON-NLS-1$
- e.printStackTrace();
- }
- } finally {
- if (input != null)
- try {
- input.close();
- } catch (IOException e) {
- // ignore
- }
- }
- return result;
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/CompatibilityHelper.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/CompatibilityHelper.java
deleted file mode 100644
index b11fd04..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/CompatibilityHelper.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-import java.lang.reflect.Method;
-import org.eclipse.core.runtime.*;
-import org.osgi.framework.Bundle;
-
-/**
- * This class isolates calls to the backward compatibility layer.
- * It uses reflection so it can be loaded with success even in the absence of
- * the compatibility plugin.
- *
- * @deprecated Marked as deprecated to suppress deprecation warnings.
- */
-public class CompatibilityHelper {
- private static final String OPTION_DEBUG_COMPATIBILITY = Platform.PI_RUNTIME + "/compatibility/debug"; //$NON-NLS-1$
- public static final boolean DEBUG = Boolean.TRUE.toString().equalsIgnoreCase(InternalPlatform.getDefault().getOption(OPTION_DEBUG_COMPATIBILITY));
- public static final String PI_RUNTIME_COMPATIBILITY = "org.eclipse.core.runtime.compatibility"; //$NON-NLS-1$
- private static Bundle compatibility = null;
-
- public synchronized static void nullCompatibility() {
- compatibility = null;
- }
-
- public synchronized static Bundle initializeCompatibility() {
- // if compatibility is stale (has been uninstalled or unresolved)
- // then we try to get a new resolved compatibility bundle
- if (compatibility == null || (compatibility.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED | Bundle.STOPPING)) != 0)
- compatibility = org.eclipse.core.internal.runtime.InternalPlatform.getDefault().getBundle(PI_RUNTIME_COMPATIBILITY);
- return compatibility;
- }
-
- public static void setPlugin(IPluginDescriptor descriptor, Plugin plugin) {
- //Here we use reflection so the runtime code can run without the compatibility plugin
- if (initializeCompatibility() == null)
- throw new IllegalStateException();
-
- try {
- Method setPlugin = descriptor.getClass().getMethod("setPlugin", new Class[] {Plugin.class}); //$NON-NLS-1$
- setPlugin.invoke(descriptor, new Object[] {plugin});
- } catch (Exception e) {
- //Ignore the exceptions
- }
- }
-
- public synchronized static IPluginDescriptor getPluginDescriptor(String pluginId) {
- //Here we use reflection so the runtime code can run without the compatibility
- initializeCompatibility();
- if (compatibility == null)
- throw new IllegalStateException();
-
- Class oldInternalPlatform = null;
- try {
- oldInternalPlatform = compatibility.loadClass("org.eclipse.core.internal.plugins.InternalPlatform"); //$NON-NLS-1$
- Method getPluginDescriptor = oldInternalPlatform.getMethod("getPluginDescriptor", new Class[] {String.class}); //$NON-NLS-1$
- return (IPluginDescriptor) getPluginDescriptor.invoke(oldInternalPlatform, new Object[] {pluginId});
- } catch (Exception e) {
- if (DEBUG) {
- String msg = "Error running compatibility code"; //$NON-NLS-1$
- IStatus error = new Status(IStatus.ERROR, Platform.PI_RUNTIME, 1, msg, e);
- InternalPlatform.getDefault().log(error);
- }
- //Ignore the exceptions, return null
- }
- return null;
- }
-
- public synchronized static void setActive(IPluginDescriptor descriptor) {
- initializeCompatibility();
- if (compatibility == null)
- throw new IllegalStateException();
-
- try {
- Method setPlugin = descriptor.getClass().getMethod("setActive", null); //$NON-NLS-1$
- setPlugin.invoke(descriptor, null);
- } catch (Exception e) {
- //Ignore the exceptions
- }
- }
-
- public synchronized static boolean hasPluginObject(IPluginDescriptor descriptor) {
- initializeCompatibility();
- if (compatibility == null)
- throw new IllegalStateException();
-
- Boolean result = Boolean.FALSE;
- try {
- Method setPlugin = descriptor.getClass().getMethod("hasPluginObject", null); //$NON-NLS-1$
- result = (Boolean) setPlugin.invoke(descriptor, null);
- } catch (Exception e) {
- //Ignore the exceptions
- }
- return result.booleanValue();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java
deleted file mode 100644
index 6a49b0b..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java
+++ /dev/null
@@ -1,879 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Julian Chen - fix for bug #92572, jclRM
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-import java.io.*;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.*;
-import org.eclipse.core.internal.preferences.exchange.ILegacyPreferences;
-import org.eclipse.core.internal.preferences.exchange.IProductPreferencesService;
-import org.eclipse.core.internal.preferences.legacy.InitLegacyPreferences;
-import org.eclipse.core.internal.preferences.legacy.ProductPreferencesService;
-import org.eclipse.core.internal.runtime.auth.AuthorizationHandler;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.core.runtime.preferences.IPreferencesService;
-import org.eclipse.equinox.app.IApplicationContext;
-import org.eclipse.equinox.internal.app.*;
-import org.eclipse.equinox.internal.app.Activator;
-import org.eclipse.osgi.framework.log.FrameworkLog;
-import org.eclipse.osgi.service.datalocation.Location;
-import org.eclipse.osgi.service.debug.DebugOptions;
-import org.eclipse.osgi.service.environment.EnvironmentInfo;
-import org.eclipse.osgi.service.resolver.PlatformAdmin;
-import org.osgi.framework.*;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * Bootstrap class for the platform. It is responsible for setting up the
- * platform class loader and passing control to the actual application class
- */
-public final class InternalPlatform {
-
- private static final String[] ARCH_LIST = {Platform.ARCH_PA_RISC, //
- Platform.ARCH_PPC, //
- Platform.ARCH_SPARC, //
- Platform.ARCH_X86, //
- Platform.ARCH_AMD64, //
- Platform.ARCH_IA64, //
- Platform.ARCH_IA64_32};
-
- // debug support: set in loadOptions()
- public static boolean DEBUG = false;
- public static boolean DEBUG_PLUGIN_PREFERENCES = false;
-
- static boolean splashEnded = false;
- private static boolean initialized;
- private static final String KEYRING = "-keyring"; //$NON-NLS-1$
- private static String keyringFile;
-
- //XXX This is not synchronized
- private static Map logs = new HashMap(5);
-
- private static final String[] OS_LIST = {Platform.OS_AIX, Platform.OS_HPUX, Platform.OS_LINUX, Platform.OS_MACOSX, Platform.OS_QNX, Platform.OS_SOLARIS, Platform.OS_WIN32};
- private static String password = ""; //$NON-NLS-1$
- private static final String PASSWORD = "-password"; //$NON-NLS-1$
- private static PlatformLogWriter platformLog = null;
-
- private static final String PLUGIN_PATH = ".plugin-path"; //$NON-NLS-1$
-
- public static final String PROP_APPLICATION = "eclipse.application"; //$NON-NLS-1$
- public static final String PROP_ARCH = "osgi.arch"; //$NON-NLS-1$
- public static final String PROP_CONFIG_AREA = "osgi.configuration.area"; //$NON-NLS-1$
- public static final String PROP_CONSOLE_LOG = "eclipse.consoleLog"; //$NON-NLS-1$
- public static final String PROP_DEBUG = "osgi.debug"; //$NON-NLS-1$
- public static final String PROP_DEV = "osgi.dev"; //$NON-NLS-1$
-
- // OSGI system properties. Copied from EclipseStarter
- public static final String PROP_INSTALL_AREA = "osgi.install.area"; //$NON-NLS-1$
- public static final String PROP_NL = "osgi.nl"; //$NON-NLS-1$
- public static final String PROP_OS = "osgi.os"; //$NON-NLS-1$
-
- // Eclipse System Properties
- public static final String PROP_PRODUCT = "eclipse.product"; //$NON-NLS-1$
- public static final String PROP_WS = "osgi.ws"; //$NON-NLS-1$
- public static final String PROP_ACTIVATE_PLUGINS = "eclipse.activateRuntimePlugins"; //$NON-NLS-1$
-
- private static final InternalPlatform singleton = new InternalPlatform();
-
- private static final String[] WS_LIST = {Platform.WS_CARBON, Platform.WS_GTK, Platform.WS_MOTIF, Platform.WS_PHOTON, Platform.WS_WIN32, Platform.WS_WPF};
- private Path cachedInstanceLocation; // Cache the path of the instance location
- private ServiceTracker configurationLocation = null;
- private BundleContext context;
-
- private Map groupProviders = new HashMap(3);
- private ServiceTracker installLocation = null;
- private ServiceTracker instanceLocation = null;
-
- private Plugin runtimeInstance; // Keep track of the plugin object for runtime in case the backward compatibility is run.
-
- private ServiceRegistration legacyPreferencesService = null;
- private ServiceRegistration customPreferencesService = null;
-
- private ServiceTracker environmentTracker = null;
- private ServiceTracker logTracker = null;
- private ServiceTracker bundleTracker = null;
- private ServiceTracker debugTracker = null;
- private ServiceTracker contentTracker = null;
- private ServiceTracker preferencesTracker = null;
- private ServiceTracker userLocation = null;
- private ServiceTracker groupProviderTracker = null;
-
- private IProduct product;
-
- public static InternalPlatform getDefault() {
- return singleton;
- }
-
- /**
- * Private constructor to block instance creation.
- */
- private InternalPlatform() {
- super();
- }
-
- /**
- * @see Platform#addLogListener(ILogListener)
- */
- public void addLogListener(ILogListener listener) {
- assertInitialized();
- RuntimeLog.addLogListener(listener);
- }
-
- private void assertInitialized() {
- //avoid the Policy.bind if assertion is true
- if (!initialized)
- Assert.isTrue(false, Messages.meta_appNotInit);
- }
-
- /**
- * @see Platform#endSplash()
- */
- public void endSplash() {
- synchronized (this) {
- if (splashEnded)
- return; // do not do this more than once
- splashEnded = true;
- }
- IApplicationContext applicationContext = getApplicationContext();
- if (applicationContext != null)
- applicationContext.applicationRunning();
- }
-
- /**
- * @see Platform#getAdapterManager()
- */
- public IAdapterManager getAdapterManager() {
- assertInitialized();
- return AdapterManager.getDefault();
- }
-
- public String[] getApplicationArgs() {
- return CommandLineArgs.getApplicationArgs();
- }
-
- public boolean getBooleanOption(String option, boolean defaultValue) {
- String value = getOption(option);
- if (value == null)
- return defaultValue;
- return value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
-
- public Bundle getBundle(String symbolicName) {
- PackageAdmin packageAdmin = getBundleAdmin();
- if (packageAdmin == null)
- return null;
- Bundle[] bundles = packageAdmin.getBundles(symbolicName, null);
- if (bundles == null)
- return null;
- //Return the first bundle that is not installed or uninstalled
- for (int i = 0; i < bundles.length; i++) {
- if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
- return bundles[i];
- }
- }
- return null;
- }
-
- public BundleContext getBundleContext() {
- return context;
- }
-
- /**
- * Returns the bundle id of the bundle that contains the provided object, or
- * <code>null</code> if the bundle could not be determined.
- */
- public String getBundleId(Object object) {
- if (object == null)
- return null;
- PackageAdmin packageAdmin = getBundleAdmin();
- if (packageAdmin == null)
- return null;
- Bundle source = packageAdmin.getBundle(object.getClass());
- if (source != null && source.getSymbolicName() != null)
- return source.getSymbolicName();
- return null;
- }
-
- public IBundleGroupProvider[] getBundleGroupProviders() {
- if (groupProviderTracker == null) {
- // acquire the service and get the list of services
- Filter filter = null;
- try {
- filter = getBundleContext().createFilter("(objectClass=" + IBundleGroupProvider.class.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (InvalidSyntaxException e) {
- // ignore this, it should never happen
- }
- groupProviderTracker = new ServiceTracker(getBundleContext(), filter, null);
- groupProviderTracker.open();
- }
- Object[] objectArray = groupProviderTracker.getServices();
- if (objectArray == null) // getServices may return null; but we can not.
- return new IBundleGroupProvider[0];
- IBundleGroupProvider[] result = new IBundleGroupProvider[objectArray.length];
- System.arraycopy(objectArray, 0, result, 0, objectArray.length);
- return result;
- }
-
- public void registerBundleGroupProvider(IBundleGroupProvider provider) {
- // get the bundle context and register the provider as a service
- ServiceRegistration registration = getBundleContext().registerService(IBundleGroupProvider.class.getName(), provider, null);
- // store the service registration (map provider -> registration)
- synchronized (groupProviders) {
- groupProviders.put(provider, registration);
- }
- }
-
- public void unregisterBundleGroupProvider(IBundleGroupProvider provider) {
- // get the service reference (map provider -> reference)
- ServiceRegistration registration;
- synchronized (groupProviders) {
- registration = (ServiceRegistration) groupProviders.remove(provider);
- }
- if (registration == null)
- return;
- // unregister the provider
- registration.unregister();
- }
-
- public Bundle[] getBundles(String symbolicName, String version) {
- PackageAdmin packageAdmin = getBundleAdmin();
- if (packageAdmin == null)
- return null;
- Bundle[] bundles = packageAdmin.getBundles(symbolicName, version);
- if (bundles == null)
- return null;
- // optimize for common case; length==1
- if (bundles.length == 1 && (bundles[0].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0)
- return bundles;
- //Remove all the bundles that are installed or uninstalled
- Bundle[] selectedBundles = new Bundle[bundles.length];
- int added = 0;
- for (int i = 0; i < bundles.length; i++) {
- if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
- selectedBundles[added++] = bundles[i];
- }
- }
- if (added == 0)
- return null;
-
- //return an array of the correct size
- Bundle[] results = new Bundle[added];
- System.arraycopy(selectedBundles, 0, results, 0, added);
- return results;
- }
-
- public String[] getCommandLineArgs() {
- return CommandLineArgs.getAllArgs();
- }
-
- public Location getConfigurationLocation() {
- assertInitialized();
- if (configurationLocation == null) {
- Filter filter = null;
- try {
- filter = context.createFilter(Location.CONFIGURATION_FILTER);
- } catch (InvalidSyntaxException e) {
- // ignore this. It should never happen as we have tested the above format.
- }
- configurationLocation = new ServiceTracker(context, filter, null);
- configurationLocation.open();
- }
- return (Location) configurationLocation.getService();
- }
-
- /**
- * Lazy initialize ContentTypeManager - it can only be used after the registry is up and running
- */
- public IContentTypeManager getContentTypeManager() {
- if (contentTracker == null) {
- if (context == null)
- return null;
- contentTracker = new ServiceTracker(context, IContentTypeManager.class.getName(), null);
- contentTracker.open();
- }
- return (IContentTypeManager) contentTracker.getService();
- }
-
- public EnvironmentInfo getEnvironmentInfoService() {
- if (environmentTracker == null) {
- if (context == null)
- return null;
- environmentTracker = new ServiceTracker(context, EnvironmentInfo.class.getName(), null);
- environmentTracker.open();
- }
- return (EnvironmentInfo) environmentTracker.getService();
- }
-
- public Bundle[] getFragments(Bundle bundle) {
- PackageAdmin packageAdmin = getBundleAdmin();
- if (packageAdmin == null)
- return null;
- return packageAdmin.getFragments(bundle);
- }
-
- public FrameworkLog getFrameworkLog() {
- if (logTracker == null) {
- if (context == null)
- return null;
- logTracker = new ServiceTracker(context, FrameworkLog.class.getName(), null);
- logTracker.open();
- }
- return (FrameworkLog) logTracker.getService();
- }
-
- public Bundle[] getHosts(Bundle bundle) {
- PackageAdmin packageAdmin = getBundleAdmin();
- if (packageAdmin == null)
- return null;
- return packageAdmin.getHosts(bundle);
- }
-
- public Location getInstallLocation() {
- assertInitialized();
- Filter filter = null;
- if (installLocation == null) {
- try {
- filter = context.createFilter(Location.INSTALL_FILTER);
- } catch (InvalidSyntaxException e) {
- // ignore this. It should never happen as we have tested the above format.
- }
- installLocation = new ServiceTracker(context, filter, null);
- installLocation.open();
- }
- return (Location) installLocation.getService();
- }
-
- public URL getInstallURL() {
- Location location = getInstallLocation();
- // it is pretty much impossible for the install location to be null. If it is, the
- // system is in a bad way so throw and exception and get the heck outta here.
- if (location == null)
- throw new IllegalStateException("The installation location must not be null"); //$NON-NLS-1$
- return location.getURL();
- }
-
- public Location getInstanceLocation() {
- assertInitialized();
- if (instanceLocation == null) {
- Filter filter = null;
- try {
- filter = context.createFilter(Location.INSTANCE_FILTER);
- } catch (InvalidSyntaxException e) {
- // ignore this. It should never happen as we have tested the above format.
- }
- instanceLocation = new ServiceTracker(context, filter, null);
- instanceLocation.open();
- }
- return (Location) instanceLocation.getService();
- }
-
- /**
- * @see Platform#getLocation()
- */
- public IPath getLocation() throws IllegalStateException {
- if (cachedInstanceLocation == null) {
- Location location = getInstanceLocation();
- if (location == null)
- return null;
- // This makes the assumption that the instance location is a file: URL
- File file = new File(location.getURL().getFile());
- cachedInstanceLocation = new Path(file.toString());
- }
- return cachedInstanceLocation;
- }
-
- /**
- * Returns a log for the given plugin. Creates a new one if needed.
- */
- public ILog getLog(Bundle bundle) {
- ILog result = (ILog) logs.get(bundle);
- if (result != null)
- return result;
- result = new Log(bundle);
- logs.put(bundle, result);
- return result;
- }
-
- /**
- * Returns the object which defines the location and organization
- * of the platform's meta area.
- */
- public DataArea getMetaArea() {
- // TODO: deprecate?
- return MetaDataKeeper.getMetaArea();
- }
-
- public String getNL() {
- return getBundleContext().getProperty(PROP_NL);
- }
-
- /**
- * @see Platform
- */
- public String getOption(String option) {
- DebugOptions options = getDebugOptions();
- if (options != null)
- return options.getOption(option);
- return null;
- }
-
- public String getOS() {
- return getBundleContext().getProperty(PROP_OS);
- }
-
- public String getOSArch() {
- return getBundleContext().getProperty(PROP_ARCH);
- }
-
- public PlatformAdmin getPlatformAdmin() {
- if (context == null)
- return null;
- ServiceReference platformAdminReference = context.getServiceReference(PlatformAdmin.class.getName());
- if (platformAdminReference == null)
- return null;
- return (PlatformAdmin) context.getService(platformAdminReference);
- }
-
- //TODO I guess it is now time to get rid of that
- /*
- * This method is retained for R1.0 compatibility because it is defined as API.
- * Its function matches the API description (returns <code>null</code> when
- * argument URL is <code>null</code> or cannot be read).
- */
- public URL[] getPluginPath(URL pluginPathLocation /*R1.0 compatibility*/
- ) {
- InputStream input = null;
- // first try and see if the given plugin path location exists.
- if (pluginPathLocation == null)
- return null;
- try {
- input = pluginPathLocation.openStream();
- } catch (IOException e) {
- //fall through
- }
-
- // if the given path was null or did not exist, look for a plugin path
- // definition in the install location.
- if (input == null)
- try {
- URL url = new URL("platform:/base/" + PLUGIN_PATH); //$NON-NLS-1$
- input = url.openStream();
- } catch (MalformedURLException e) {
- //fall through
- } catch (IOException e) {
- //fall through
- }
-
- // nothing was found at the supplied location or in the install location
- if (input == null)
- return null;
- // if we found a plugin path definition somewhere so read it and close the location.
- URL[] result = null;
- try {
- try {
- result = readPluginPath(input);
- } finally {
- input.close();
- }
- } catch (IOException e) {
- //let it return null on failure to read
- }
- return result;
- }
-
- /**
- *
- */
- public IPreferencesService getPreferencesService() {
- if (preferencesTracker == null) {
- if (context == null)
- return null;
- preferencesTracker = new ServiceTracker(context, IPreferencesService.class.getName(), null);
- preferencesTracker.open();
- }
- return (IPreferencesService) preferencesTracker.getService();
- }
-
- public IProduct getProduct() {
- if (product != null)
- return product;
- EclipseAppContainer container = Activator.getContainer();
- IBranding branding = container == null ? null : container.getBranding();
- if (branding == null)
- return null;
- Object brandingProduct = branding.getProduct();
- if (!(brandingProduct instanceof IProduct))
- brandingProduct = new Product(branding);
- product = (IProduct) brandingProduct;
- return product;
- }
-
- public IExtensionRegistry getRegistry() {
- return RegistryFactory.getRegistry();
- }
-
- public ResourceBundle getResourceBundle(Bundle bundle) {
- return ResourceTranslator.getResourceBundle(bundle);
- }
-
- public String getResourceString(Bundle bundle, String value) {
- return ResourceTranslator.getResourceString(bundle, value);
- }
-
- public String getResourceString(Bundle bundle, String value, ResourceBundle resourceBundle) {
- return ResourceTranslator.getResourceString(bundle, value, resourceBundle);
- }
-
- /**
- * This method is only used to register runtime once compatibility has been started.
- */
- public Plugin getRuntimeInstance() {
- return runtimeInstance;
- }
-
- private IApplicationContext getApplicationContext() {
- ServiceReference[] ref;
- try {
- ref = context.getServiceReferences(IApplicationContext.class.getName(), "(eclipse.application.type=main.thread)"); //$NON-NLS-1$
- } catch (InvalidSyntaxException e) {
- return null;
- }
- if (ref == null || ref.length == 0)
- return null;
- // assumes the application context is available as a service
- IApplicationContext result = (IApplicationContext) context.getService(ref[0]);
- if (result != null) {
- context.ungetService(ref[0]);
- return result;
- }
- return null;
- }
-
- public IPath getStateLocation(Bundle bundle) {
- return getStateLocation(bundle, true);
- }
-
- public IPath getStateLocation(Bundle bundle, boolean create) throws IllegalStateException {
- assertInitialized();
- IPath result = getMetaArea().getStateLocation(bundle);
- if (create)
- result.toFile().mkdirs();
- return result;
- }
-
- public long getStateTimeStamp() {
- PlatformAdmin admin = getPlatformAdmin();
- return admin == null ? -1 : admin.getState(false).getTimeStamp();
- }
-
- public Location getUserLocation() {
- assertInitialized();
- if (userLocation == null) {
- Filter filter = null;
- try {
- filter = context.createFilter(Location.USER_FILTER);
- } catch (InvalidSyntaxException e) {
- // ignore this. It should never happen as we have tested the above format.
- }
- userLocation = new ServiceTracker(context, filter, null);
- userLocation.open();
- }
- return (Location) userLocation.getService();
- }
-
- public String getWS() {
- return getBundleContext().getProperty(PROP_WS);
- }
-
- private void initializeAuthorizationHandler() {
- try {
- AuthorizationHandler.setKeyringFile(keyringFile);
- AuthorizationHandler.setPassword(password);
- } catch (NoClassDefFoundError e) {
- // The authorization fragment is not available. If someone tries to use that API, an error will be logged
- }
- }
-
- /*
- * Finds and loads the options file
- */
- void initializeDebugFlags() {
- // load runtime options
- DEBUG = getBooleanOption(Platform.PI_RUNTIME + "/debug", false); //$NON-NLS-1$
- if (DEBUG) {
- DEBUG_PLUGIN_PREFERENCES = getBooleanOption(Platform.PI_RUNTIME + "/preferences/plugin", false); //$NON-NLS-1$
- }
- }
-
- public boolean isFragment(Bundle bundle) {
- PackageAdmin packageAdmin = getBundleAdmin();
- if (packageAdmin == null)
- return false;
- return (packageAdmin.getBundleType(bundle) & PackageAdmin.BUNDLE_TYPE_FRAGMENT) > 0;
- }
-
- public boolean isRunning() {
- try {
- return initialized && context != null && context.getBundle().getState() == Bundle.ACTIVE;
- } catch (IllegalStateException e) {
- return false;
- }
- }
-
- /**
- * Returns a list of known system architectures.
- *
- * @return the list of system architectures known to the system
- */
- public String[] knownOSArchValues() {
- return ARCH_LIST;
- }
-
- /**
- * Returns a list of known operating system names.
- *
- * @return the list of operating systems known to the system
- */
- public String[] knownOSValues() {
- return OS_LIST;
- }
-
- /**
- * Returns a list of known windowing system names.
- *
- * @return the list of window systems known to the system
- */
- public String[] knownWSValues() {
- return WS_LIST;
- }
-
- /**
- * Notifies all listeners of the platform log. This includes the console log, if
- * used, and the platform log file. All Plugin log messages get funnelled
- * through here as well.
- */
- public void log(final IStatus status) {
- // TODO: deprecate?
- RuntimeLog.log(status);
- }
-
- private void processCommandLine(String[] args) {
- if (args == null || args.length == 0)
- return;
-
- for (int i = 0; i < args.length; i++) {
- // check for args with parameters
- if (i == args.length - 1 || args[i + 1].startsWith("-")) //$NON-NLS-1$
- continue;
- String arg = args[++i];
-
- // look for the keyring file
- if (args[i - 1].equalsIgnoreCase(KEYRING))
- keyringFile = arg;
- // look for the user password.
- if (args[i - 1].equalsIgnoreCase(PASSWORD))
- password = arg;
- }
- }
-
- private URL[] readPluginPath(InputStream input) {
- Properties ini = new Properties();
- try {
- ini.load(input);
- } catch (IOException e) {
- return null;
- }
- Vector result = new Vector(5);
- for (Enumeration groups = ini.propertyNames(); groups.hasMoreElements();) {
- String group = (String) groups.nextElement();
- for (StringTokenizer entries = new StringTokenizer(ini.getProperty(group), ";"); entries.hasMoreElements();) { //$NON-NLS-1$
- String entry = (String) entries.nextElement();
- if (!entry.equals("")) //$NON-NLS-1$
- try {
- result.addElement(new URL(entry));
- } catch (MalformedURLException e) {
- //intentionally ignore bad URLs
- System.err.println("Ignoring plugin: " + entry); //$NON-NLS-1$
- }
- }
- }
- return (URL[]) result.toArray(new URL[result.size()]);
- }
-
- /**
- * @see Platform#removeLogListener(ILogListener)
- */
- public void removeLogListener(ILogListener listener) {
- assertInitialized();
- RuntimeLog.removeLogListener(listener);
- }
-
- /**
- * This method is only used to register runtime once compatibility has been started.
- */
- public void setRuntimeInstance(Plugin runtime) {
- runtimeInstance = runtime;
- }
-
- /**
- * Internal method for starting up the platform. The platform is not started with any location
- * and should not try to access the instance data area.
- *
- * Note: the content type manager must be initialized only after the registry has been created
- */
- public void start(BundleContext runtimeContext) {
- this.context = runtimeContext;
- splashEnded = false;
- processCommandLine(getEnvironmentInfoService().getNonFrameworkArgs());
- initializeDebugFlags();
- initialized = true;
- getMetaArea();
- initializeAuthorizationHandler();
- FrameworkLog log = getFrameworkLog();
- if (log != null) {
- platformLog = new PlatformLogWriter(getFrameworkLog());
- addLogListener(platformLog);
- } else
- platformLog = null;
- startServices();
-
- // See if need to activate rest of the runtime plugins. Plugins are "gently" activated by touching
- // a class from the corresponding plugin(s).
- boolean shouldActivate = !"false".equalsIgnoreCase(context.getProperty(PROP_ACTIVATE_PLUGINS)); //$NON-NLS-1$
- if (shouldActivate) {
- // activate Preferences plugin by creating a class from it:
- new org.eclipse.core.runtime.preferences.DefaultScope();
- // activate Jobs plugin by creating a class from it:
- org.eclipse.core.runtime.jobs.Job.getJobManager();
- }
- }
-
- /**
- * Shutdown runtime pieces in this order:
- * Content[auto shutdown] -> Preferences[auto shutdown] -> Registry -> Jobs
- * The "auto" shutdown takes place before this code is executed
- */
- public void stop(BundleContext bundleContext) {
- assertInitialized();
- stopServices(); // should be done after preferences shutdown
- if (platformLog != null)
- RuntimeLog.removeLogListener(platformLog); // effectively turns the platform logging off
- initialized = false;
- closeOSGITrackers();
- context = null;
- }
-
- private void startServices() {
- // The check for getProduct() is relatively expensive (about 3% of the headless startup),
- // so we don't want to enforce it here.
- customPreferencesService = getBundleContext().registerService(IProductPreferencesService.class.getName(), new ProductPreferencesService(), new Hashtable());
-
- // Only register this interface if compatibility is installed - the check for a bundle presence
- // is a quick test that doesn't consume much.
- if (getBundle(CompatibilityHelper.PI_RUNTIME_COMPATIBILITY) != null)
- legacyPreferencesService = getBundleContext().registerService(ILegacyPreferences.class.getName(), new InitLegacyPreferences(), new Hashtable());
- }
-
- private void stopServices() {
- if (legacyPreferencesService != null) {
- legacyPreferencesService.unregister();
- legacyPreferencesService = null;
- }
- if (customPreferencesService != null) {
- customPreferencesService.unregister();
- customPreferencesService = null;
- }
- }
-
- private PackageAdmin getBundleAdmin() {
- if (bundleTracker == null) {
- if (context == null)
- return null;
- bundleTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
- bundleTracker.open();
- }
- return (PackageAdmin) bundleTracker.getService();
- }
-
- private DebugOptions getDebugOptions() {
- if (debugTracker == null) {
- if (context == null)
- return null;
- debugTracker = new ServiceTracker(context, DebugOptions.class.getName(), null);
- debugTracker.open();
- }
- return (DebugOptions) debugTracker.getService();
- }
-
- private void closeOSGITrackers() {
- if (preferencesTracker != null) {
- preferencesTracker.close();
- preferencesTracker = null;
- }
- if (contentTracker != null) {
- contentTracker.close();
- contentTracker = null;
- }
- if (debugTracker != null) {
- debugTracker.close();
- debugTracker = null;
- }
- if (bundleTracker != null) {
- bundleTracker.close();
- bundleTracker = null;
- }
- if (logTracker != null) {
- logTracker.close();
- logTracker = null;
- }
- if (groupProviderTracker != null) {
- groupProviderTracker.close();
- groupProviderTracker = null;
- }
- if (environmentTracker != null) {
- environmentTracker.close();
- environmentTracker = null;
- }
- }
-
- /**
- * Print a debug message to the console.
- * Pre-pend the message with the current date and the name of the current thread.
- */
- public static void message(String message) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(new Date(System.currentTimeMillis()));
- buffer.append(" - ["); //$NON-NLS-1$
- buffer.append(Thread.currentThread().getName());
- buffer.append("] "); //$NON-NLS-1$
- buffer.append(message);
- System.out.println(buffer.toString());
- }
-
- public static void start(Bundle bundle) throws BundleException {
- int originalState = bundle.getState();
- if ((originalState & Bundle.ACTIVE) != 0)
- return; // bundle is already active
- try {
- // attempt to activate the bundle
- bundle.start(Bundle.START_TRANSIENT);
- } catch (BundleException e) {
- if ((originalState & Bundle.STARTING) != 0 && (bundle.getState() & Bundle.STARTING) != 0)
- // This can happen if the bundle was in the process of being activated on this thread, just return
- return;
- throw e;
- }
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Log.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Log.java
deleted file mode 100644
index cf4871e..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Log.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.core.runtime.*;
-import org.osgi.framework.Bundle;
-
-/**
- *
- */
-public class Log implements ILog {
- Bundle bundle;
- Set logListeners = new HashSet(5);
-
- public Log(Bundle plugin) {
- this.bundle = plugin;
- }
-
- /**
- * Adds the given log listener to this log. Subsequently the log listener will
- * receive notification of all log events passing through this log.
- *
- * @see Platform#addLogListener(ILogListener)
- */
- public void addLogListener(ILogListener listener) {
- synchronized (logListeners) {
- logListeners.add(listener);
- }
- }
-
- /**
- * Returns the plug-in with which this log is associated.
- */
- public Bundle getBundle() {
- return bundle;
- }
-
- /**
- * Logs the given status. The status is distributed to the log listeners
- * installed on this log and then to the log listeners installed on the platform.
- *
- * @see Plugin#getLog()
- */
- public void log(final IStatus status) {
- // Log to the platform log first in case a listener throws an error.
- InternalPlatform.getDefault().log(status);
- // create array to avoid concurrent access
- ILogListener[] listeners;
- synchronized (logListeners) {
- listeners = (ILogListener[]) logListeners.toArray(new ILogListener[logListeners.size()]);
- }
- for (int i = 0; i < listeners.length; i++) {
- final ILogListener listener = listeners[i];
- ISafeRunnable code = new ISafeRunnable() {
- public void run() throws Exception {
- listener.logging(status, bundle.getSymbolicName());
- }
-
- public void handleException(Throwable e) {
- //Ignore
- }
- };
- SafeRunner.run(code);
- }
- }
-
- /**
- * Removes the given log listener to this log. Subsequently the log listener will
- * no longer receive notification of log events passing through this log.
- *
- * @see Platform#removeLogListener(ILogListener)
- */
- public void removeLogListener(ILogListener listener) {
- synchronized (logListeners) {
- logListeners.remove(listener);
- }
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Messages.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Messages.java
deleted file mode 100644
index 857fc16..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Messages.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.core.internal.runtime;
-
-import org.eclipse.osgi.util.NLS;
-
-// Runtime plugin message catalog
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.core.internal.runtime.messages"; //$NON-NLS-1$
-
- // authorization
- public static String auth_notAvailable;
-
- // line separator platforms
- public static String line_separator_platform_mac_os_9;
- public static String line_separator_platform_unix;
- public static String line_separator_platform_windows;
-
- // metadata
- public static String meta_appNotInit;
- public static String meta_exceptionParsingLog;
- // parsing/resolve
- public static String plugin_deactivatedLoad;
-
- // plugins
- public static String plugin_shutdownProblems;
- public static String plugin_startupProblems;
-
- // Preferences
- public static String preferences_saveProblems;
-
- // Product
- public static String product_notFound;
- public static String provider_invalid;
- public static String provider_invalid_general;
-
- // Compatibility - parsing/resolve
- public static String parse_badPrereqOnFrag;
- public static String parse_duplicateFragment;
- public static String parse_duplicateLib;
- public static String parse_internalStack;
- public static String parse_unknownElement;
- public static String parse_unknownTopElement;
- public static String parse_unknownAttribute;
- public static String parse_error;
- public static String parse_errorProcessing;
- public static String parse_errorNameLineColumn;
- public static String parse_validExport;
- public static String parse_validMatch;
- public static String parse_unknownLibraryType;
- public static String parse_nullFragmentIdentifier;
- public static String parse_nullPluginIdentifier;
- public static String parse_duplicatePlugin;
- public static String parse_unknownEntry;
- public static String parse_missingPluginId;
- public static String parse_missingPluginName;
- public static String parse_missingFPName;
- public static String parse_missingFPVersion;
- public static String parse_missingPluginVersion;
- public static String parse_fragmentMissingAttr;
- public static String parse_pluginMissingAttr;
- public static String parse_pluginMissingIdName;
- public static String parse_fragmentMissingIdName;
- public static String parse_missingFragmentPd;
- public static String parse_extPointDisabled;
- public static String parse_extPointUnknown;
- public static String parse_unsatisfiedOptPrereq;
- public static String parse_unsatisfiedPrereq;
- public static String parse_prereqDisabled;
- public static String parse_prereqLoop;
- public static String parse_prereqOptLoop;
-
- // Compatibility - plugins
- public static String plugin_notPluginClass;
- public static String plugin_unableToResolve;
- public static String plugin_pluginDisabled;
- public static String plugin_instantiateClassError;
- public static String plugin_loadClassError;
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PerformanceStatsProcessor.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PerformanceStatsProcessor.java
deleted file mode 100644
index 3d0c1ea..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PerformanceStatsProcessor.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.PerformanceStats.PerformanceListener;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osgi.framework.log.FrameworkLog;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-
-/**
- * Processes, records, and performs notification of performance events
- * that occur in the system.
- */
-public class PerformanceStatsProcessor extends Job {
- private static final PerformanceStatsProcessor instance = new PerformanceStatsProcessor();
-
- private static final long SCHEDULE_DELAY = 2000;
-
- /**
- * Events that have occurred but have not yet been broadcast.
- */
- private final ArrayList changes = new ArrayList();
-
- /**
- * Event failures that have occurred but have not yet been broadcast.
- * Maps (PerformanceStats -> Long).
- */
- private final HashMap failures = new HashMap();
-
- /**
- * Event listeners.
- */
- private final org.eclipse.core.runtime.ListenerList listeners = new org.eclipse.core.runtime.ListenerList();
-
- private PlatformLogWriter log;
-
- /*
- * @see PerformanceStats#addListener
- */
- public static void addListener(PerformanceListener listener) {
- instance.listeners.add(listener);
- }
-
- /**
- * Records the fact that an event occurred.
- *
- * @param stats The event that occurred
- */
- public static void changed(PerformanceStats stats) {
- synchronized (instance) {
- instance.changes.add(stats);
- }
- instance.schedule(SCHEDULE_DELAY);
- }
-
- /**
- * Records the fact that an event failed.
- *
- * @param stats The event that occurred
- * @param pluginId The id of the plugin that declared the blame object, or
- * <code>null</code>
- * @param elapsed The elapsed time for this failure
- */
- public static void failed(PerformanceStats stats, String pluginId, long elapsed) {
- synchronized (instance) {
- instance.failures.put(stats, new Long(elapsed));
- }
- instance.schedule(SCHEDULE_DELAY);
- instance.logFailure(stats, pluginId, elapsed);
- }
-
- /*
- * @see PerformanceStats#printStats(PrintWriter)
- */
- public static void printStats(PrintWriter out) {
- /* gather totals */
- long totalTime = 0;
- int totalCount = 0;
- PerformanceStats[] allStats = PerformanceStats.getAllStats();
- for (int i = 0; i < allStats.length; i++) {
- PerformanceStats stats = allStats[i];
- totalTime += stats.getRunningTime();
- totalCount += stats.getRunCount();
- }
- //dump stats
- out.println("---------------------------------------------------------------"); //$NON-NLS-1$
- for (int i = 0; i < allStats.length; i++) {
- PerformanceStats stats = allStats[i];
- out.print("Event: "); //$NON-NLS-1$
- out.print(stats.getEvent());
- out.print(" Blame: "); //$NON-NLS-1$
- out.print(stats.getBlameString());
- if (stats.getContext() != null) {
- out.print(" Context: "); //$NON-NLS-1$
- out.print(stats.getContext());
- }
- out.println();
-
- int runCount = stats.getRunCount();
- if (runCount > 0) {
- out.print("Run count: "); //$NON-NLS-1$
- out.print(Integer.toString(runCount));
- out.print(" ("); //$NON-NLS-1$
- out.print(Integer.toString((int) (runCount * 100.0 / totalCount)));
- out.println(" % of total)"); //$NON-NLS-1$
- }
-
- long runTime = stats.getRunningTime();
- if (runTime > 0) {
- out.print("Duration (ms): "); //$NON-NLS-1$
- out.print(Long.toString(runTime));
- out.print(" ("); //$NON-NLS-1$
- out.print(Integer.toString((int) (runTime * 100.0 / totalTime)));
- out.println(" % of total)"); //$NON-NLS-1$
- }
- out.println(""); //$NON-NLS-1$
- }
- }
-
- /*
- * @see PerformanceStats#removeListener
- */
- public static void removeListener(PerformanceListener listener) {
- instance.listeners.remove(listener);
- }
-
- /**
- * Private constructor to enforce singleton usage.
- */
- private PerformanceStatsProcessor() {
- super("Performance Stats"); //$NON-NLS-1$
- setSystem(true);
- setPriority(DECORATE);
- BundleContext context = PlatformActivator.getContext();
- String filter = '(' + FrameworkLog.SERVICE_PERFORMANCE + '=' + Boolean.TRUE.toString() + ')';
- ServiceReference[] references;
- FrameworkLog perfLog = null;
- try {
- references = context.getServiceReferences(FrameworkLog.class.getName(), filter);
- if (references != null && references.length > 0) {
- //just take the first matching service
- perfLog = (FrameworkLog) context.getService(references[0]);
- //make sure correct location is set
- IPath logLocation = Platform.getLogFileLocation();
- logLocation = logLocation.removeLastSegments(1).append("performance.log"); //$NON-NLS-1$
- perfLog.setFile(logLocation.toFile(), false);
- }
- } catch (Exception e) {
- IStatus error = new Status(IStatus.ERROR, Platform.PI_RUNTIME, 1, "Error loading performance log", e); //$NON-NLS-1$
- InternalPlatform.getDefault().log(error);
- }
- //use the platform log if we couldn't create the performance log
- if (perfLog == null)
- perfLog = InternalPlatform.getDefault().getFrameworkLog();
- log = new PlatformLogWriter(perfLog);
- }
-
- /**
- * Logs performance event failures to the platform's performance log
- */
- private void logFailure(PerformanceStats stats, String pluginId, long elapsed) {
- //may have failed to get the performance log service
- if (log == null)
- return;
- if (pluginId == null)
- pluginId = Platform.PI_RUNTIME;
- String msg = "Performance failure: " + stats.getEvent() + " blame: " + stats.getBlameString() + " context: " + stats.getContext() + " duration: " + elapsed; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- log.logging(new Status(IStatus.WARNING, pluginId, 1, msg, new RuntimeException()), pluginId);
- }
-
- /*
- * @see Job#run(IProgressMonitor)
- */
- protected IStatus run(IProgressMonitor monitor) {
- PerformanceStats[] events;
- PerformanceStats[] failedEvents;
- Long[] failedTimes;
- synchronized (this) {
- events = (PerformanceStats[]) changes.toArray(new PerformanceStats[changes.size()]);
- changes.clear();
- failedEvents = (PerformanceStats[]) failures.keySet().toArray(new PerformanceStats[failures.size()]);
- failedTimes = (Long[]) failures.values().toArray(new Long[failures.size()]);
- failures.clear();
- }
-
- //notify performance listeners
- Object[] toNotify = listeners.getListeners();
- for (int i = 0; i < toNotify.length; i++) {
- final PerformanceStats.PerformanceListener listener = ((PerformanceStats.PerformanceListener) toNotify[i]);
- if (events.length > 0)
- listener.eventsOccurred(events);
- for (int j = 0; j < failedEvents.length; j++)
- listener.eventFailed(failedEvents[j], failedTimes[j].longValue());
- }
- schedule(SCHEDULE_DELAY);
- return Status.OK_STATUS;
- }
-
- /*
- * @see Job#shouldRun()
- */
- public boolean shouldRun() {
- return !changes.isEmpty() || !failures.isEmpty();
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformActivator.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformActivator.java
deleted file mode 100644
index 5820520..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformActivator.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Julian Chen - fix for bug #92572, jclRM
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.app.CommandLineArgs;
-import org.osgi.framework.*;
-
-/**
- * Activator for the Eclipse runtime.
- */
-public class PlatformActivator extends Plugin implements BundleActivator {
- private static BundleContext context;
- private ServiceRegistration entryLocatorRegistration;
-
- public static BundleContext getContext() {
- return context;
- }
-
- public void start(BundleContext runtimeContext) throws Exception {
- PlatformActivator.context = runtimeContext;
- InternalPlatform.getDefault().start(runtimeContext);
- startAppContainer();
- InternalPlatform.getDefault().setRuntimeInstance(this);
- super.start(runtimeContext);
- }
-
- public void stop(BundleContext runtimeContext) {
- // unregister the EntryLocator to prevent the Framework from calling it
- unregisterEntryLocator();
- // Stop the platform orderly.
- InternalPlatform.getDefault().stop(runtimeContext);
- InternalPlatform.getDefault().setRuntimeInstance(null);
- }
-
- private void startAppContainer() {
- // just using a class out of app admin to force it to lazy-start
- CommandLineArgs.getApplicationArgs();
- }
-
- private void unregisterEntryLocator() {
- if (entryLocatorRegistration != null) {
- entryLocatorRegistration.unregister();
- entryLocatorRegistration = null;
- }
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformLogWriter.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformLogWriter.java
deleted file mode 100644
index 8731ddb..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformLogWriter.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.framework.log.FrameworkLog;
-import org.eclipse.osgi.framework.log.FrameworkLogEntry;
-
-/**
- * A log writer that writes log entries.
- * See PlatformLogReader for reading logs back into memory.
- * <p>
- * Note that this class just provides a bridge from the old ILog interface
- * to the OSGi FrameworkLog interface.
- */
-public class PlatformLogWriter implements ILogListener {
- private final FrameworkLog frameworkLog;
-
- public PlatformLogWriter(FrameworkLog frameworkLog) {
- this.frameworkLog = frameworkLog;
- }
-
- /**
- * @see ILogListener#logging(IStatus, String)
- */
- public synchronized void logging(IStatus status, String plugin) {
- frameworkLog.log(getLog(status));
- }
-
- protected FrameworkLogEntry getLog(IStatus status) {
- Throwable t = status.getException();
- ArrayList childlist = new ArrayList();
-
- int stackCode = t instanceof CoreException ? 1 : 0;
- // ensure a substatus inside a CoreException is properly logged
- if (stackCode == 1) {
- IStatus coreStatus = ((CoreException) t).getStatus();
- if (coreStatus != null) {
- childlist.add(getLog(coreStatus));
- }
- }
-
- if (status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- childlist.add(getLog(children[i]));
- }
- }
-
- FrameworkLogEntry[] children = (FrameworkLogEntry[]) (childlist.size() == 0 ? null : childlist.toArray(new FrameworkLogEntry[childlist.size()]));
-
- return new FrameworkLogEntry(status.getPlugin(), status.getSeverity(), status.getCode(), status.getMessage(), stackCode, t, children);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Product.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Product.java
deleted file mode 100644
index 2737c36..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Product.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-import org.eclipse.core.runtime.IProduct;
-import org.eclipse.equinox.internal.app.IBranding;
-import org.osgi.framework.Bundle;
-
-public class Product implements IProduct {
- IBranding branding;
- public Product(IBranding branding) {
- this.branding = branding;
- }
-
- public String getApplication() {
- return branding.getApplication();
- }
-
- public Bundle getDefiningBundle() {
- return branding.getDefiningBundle();
- }
-
- public String getDescription() {
- return branding.getDescription();
- }
-
- public String getId() {
- return branding.getId();
- }
-
- public String getName() {
- return branding.getName();
- }
-
- public String getProperty(String key) {
- return branding.getProperty(key);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/messages.properties b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/messages.properties
deleted file mode 100644
index b5ec8ed..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/messages.properties
+++ /dev/null
@@ -1,79 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-### Runtime plugin messages
-
-### Authorization
-auth_notAvailable = Authorization infrastructure (org.eclipse.core.runtime.compatibility.auth) not installed.
-
-### metadata
-meta_appNotInit = The application has not been initialized.
-meta_exceptionParsingLog = An exception occurred while parsing the log file: {0}
-
-### plugins
-plugin_deactivatedLoad = Attempt to load class \"{0}\" from de-activated plug-in \"{1}\".
-plugin_shutdownProblems = Problems encountered shutting down plug-in: \"{0}\".
-plugin_startupProblems = Problems encountered starting up plug-in: \"{0}\".
-
-### Preferences
-preferences_saveProblems = Problems saving preferences.
-
-### Line Separator Platforms
-line_separator_platform_mac_os_9 = Mac OS 9
-line_separator_platform_unix = Unix
-line_separator_platform_windows = Windows
-
-### Product
-provider_invalid_general = Errors while processing the product providers.
-provider_invalid = Problem creating the provider registered by {0}.
-product_notFound = Product {0} could not be found.
-
-### Compatibility - parsing/resolving
-parse_badPrereqOnFrag = Fragment \"{0}\" requires non-existent plug-in \"{1}\". Fragment ignored.
-parse_duplicateFragment = Duplicate fragment found with id \"{0}\" and version \"{1}\".
-parse_duplicateLib = Fragment \"{0}\" for plug-in \"{1}\", has added duplicate library entry \"{2}\" .
-parse_duplicatePlugin = Two plug-ins found with the same id: \"{0}\". Ignoring duplicate at \"{1}\".
-parse_error = Parsing error: \"{0}\".
-parse_errorNameLineColumn = Parsing error in \"{0}\" [line {1}, column {2}]: \"{3}\".
-parse_errorProcessing = Error while processing \"{0}\".
-parse_extPointDisabled = Extension point \"{0}\" specified in plug-in \"{1}\" is disabled.
-parse_extPointUnknown = Unknown extension point \"{0}\" specified in plug-in \"{1}\".
-parse_fragmentMissingAttr = Fragment \"{0}\" ignored due to missing attributes.
-parse_fragmentMissingIdName = Fragment ignored due to missing attributes (including name and id).
-parse_internalStack = Element/end element mismatch for element \"{0}\".
-parse_missingFPName = Plug-in name attribute missing from fragment at \"{0}\".
-parse_missingFPVersion = Plug-in version attribute missing from fragment at \"{0}\".
-parse_missingFragmentPd = Plug-in descriptor \"{0}\" not found for fragment \"{1}\". Fragment ignored.
-parse_missingPluginId = Id attribute missing from plug-in or fragment at \"{0}\".
-parse_missingPluginName = Name attribute missing from plug-in or fragment at \"{0}\".
-parse_missingPluginVersion = Version attribute missing from plug-in or fragment at \"{0}\".
-parse_nullFragmentIdentifier = Fragment not loaded due to missing id or version number: \"{0}\".
-parse_nullPluginIdentifier = Plug-in not loaded due to missing id or version number: \"{0}\".
-parse_pluginMissingAttr = Plug-in \"{0}\" disabled due to missing attributes.
-parse_pluginMissingIdName = Plug-in disabled due to missing attributes (including name and id).
-parse_prereqDisabled = Plug-in \"{0}\" was disabled due to missing or disabled prerequisite plug-in \"{1}\".
-parse_prereqLoop = Detected prerequisite loop from \"{0}\" to \"{1}\".
-parse_prereqOptLoop = Optional prerequisite from \"{0}\" to \"{1}\" produced loop. Prerequisite ignored.
-parse_unknownAttribute = Unknown attribute \"{1}\" for element \"{0}\" ignored.
-parse_unknownElement = Unknown element \"{1}\", found within a \"{0}\", ignored.
-parse_unknownEntry = Unknown element parsed by plug-in registry: \"{0}\".
-parse_unknownLibraryType = Unknown library type \"{0}\" for library \"{1}\".
-parse_unknownTopElement = Unknown element \"{0}\", found at the top level, ignored.
-parse_unsatisfiedOptPrereq = Optional prerequisite constraint from \"{0}\" to\" {1}\" ignored.
-parse_unsatisfiedPrereq = Unable to satisfy prerequisite constraint from \"{0}\" to \"{1}\".
-parse_validExport = \"{0}\" is not a valid value for the attribute \"export\". Use \"true\" or \"false\".
-parse_validMatch = \"{0}\" is not a valid value for the attribute \"match\". Use \"perfect\", \"equivalent\", \"compatible\" or \"greaterOrEqual\".
-
-### Compatibility - plugins
-plugin_notPluginClass = Supplied runtime class \"{0}\" does not extend class Plugin.
-plugin_unableToResolve = Unable to resolve plug-in registry.
-plugin_pluginDisabled = Attempt to activate a disabled plug-in: \"{0}\".
-plugin_instantiateClassError = Plug-in \"{0}\" was unable to instantiate class \"{1}\".
-plugin_loadClassError = Plug-in {0} was unable to load class {1}.
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILibrary.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILibrary.java
deleted file mode 100644
index d83ea1b..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILibrary.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import org.eclipse.osgi.util.ManifestElement;
-import org.osgi.framework.Constants;
-
-/**
- * A runtime library declared in a plug-in. Libraries contribute elements to the search path.
- * These contributions are specified as a path to a directory or Jar file. This path is always
- * considered to be relative to the containing plug-in.
- * <p>
- * Libraries are typed. The type is used to determine to which search path the library's
- * contribution should be added. The valid types are: <code>CODE</code> and
- * <code>RESOURCE</code>.
- * </p><p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IPluginDescriptor#getRuntimeLibraries()
- * @deprecated
- * In Eclipse 3.0 the plug-in classpath representation was changed. Clients of
- * <code>ILibrary</code> are directed to the headers associated with the relevant bundle.
- * In particular, the <code>Bundle-Classpath</code> header contains all available information
- * about the classpath of a plug-in. Having retrieved the header, the {@link ManifestElement}
- * helper class can be used to parse the value and discover the individual
- * class path entries. The various header attributes are defined in {@link Constants}.
- * <p>For example,
- * <pre>
- * String header = bundle.getHeaders().get(Constants.BUNDLE_CLASSPATH);
- * ManifestElement[] elements = ManifestElement.parseHeader(
- * Constants.BUNDLE_CLASSPATH, header);
- * if (elements == null)
- * return;
- * elements[0].getValue(); // the jar/dir containing the code
- * ...
- * </pre>
- * </p><p>
- * Note that this new structure does not include information on
- * which packages are exported or present in the listed classpath entries. This
- * information is no longer relevant.
- * </p><p>
- * See {@link IPluginDescriptor} for information on the relationship between plug-in
- * descriptors and bundles.
- * </p><p>
- * This interface must only be used by plug-ins
- * which explicitly require the org.eclipse.core.runtime.compatibility plug-in.
- * </p>
- */
-public interface ILibrary {
- /**
- * Constant string (value "code") indicating the code library type.
- * @deprecated As of Eclipse 3.0 library types are obsolete.
- * There is no replacement.
- */
- public static final String CODE = "code"; //$NON-NLS-1$
-
- /**
- * Constant string (value "resource") indicating the resource library type.
- * @deprecated As of Eclipse 3.0 library types are obsolete.
- * There is no replacement.
- */
- public static final String RESOURCE = "resource"; //$NON-NLS-1$
-
- /**
- * Returns the content filters, or <code>null</code>.
- * Each content filter identifies a specific class, or
- * a group of classes, using a notation and matching rules
- * equivalent to Java <code>import</code> declarations
- * (e.g., "java.io.File", or "java.io.*"). Returns <code>null</code>
- * if the library is not exported, or it is fully exported
- * (no filtering).
- *
- * @return the content filters, or <code>null</code> if none
- * @deprecated As of Eclipse 3.0 content filters are obsolete.
- * There is no replacement.
- */
- public String[] getContentFilters();
-
- /**
- * Returns the path of this runtime library, relative to the
- * installation location.
- *
- * @return the path of the library
- * @see IPluginDescriptor#getInstallURL()
- * @deprecated
- * Given a manifest element corresponding to a classpath entry, the path
- * for the entry can be accessed by getting the value of the manifest element.
- * For example,
- * <pre>
- * element.getValue(); // the jar/dir containing the code
- * </pre>
- */
- public IPath getPath();
-
- /**
- * Returns this library's type.
- *
- * @return the type of this library. The valid types are: <code>CODE</code> and <code>RESOURCE</code>.
- * @see #CODE
- * @see #RESOURCE
- * @deprecated As of Eclipse 3.0 library types are obsolete.
- * There is no replacement.
- */
- public String getType();
-
- /**
- * Returns whether the library is exported. The contents of an exported
- * library may be visible to other plug-ins that declare a dependency
- * on the plug-in containing this library, subject to content filtering.
- * Libraries that are not exported are entirely private to the declaring
- * plug-in.
- *
- * @return <code>true</code> if the library is exported, <code>false</code>
- * if it is private
- * @deprecated As of Eclipse 3.0 exporting an individual library is obsolete.
- * There is no replacement.
- */
- public boolean isExported();
-
- /**
- * Returns whether this library is fully exported. A library is considered
- * fully exported iff it is exported and has no content filters.
- *
- * @return <code>true</code> if the library is fully exported, and
- * <code>false</code> if it is private or has filtered content
- * @deprecated As of Eclipse 3.0 exporting an individual library is obsolete.
- * There is no replacement.
- */
- public boolean isFullyExported();
-
- /**
- * Returns the array of package prefixes that this library declares. This
- * is used in classloader enhancements and is an optional entry in the plugin.xml.
- *
- * @return the array of package prefixes or <code>null</code>
- * @since 2.1
- * @deprecated As of Eclipse 3.0 package prefix filtering is obsolete.
- * There is no replacement.
- */
- public String[] getPackagePrefixes();
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILog.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILog.java
deleted file mode 100644
index d4c95f6..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILog.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import org.osgi.framework.Bundle;
-
-/**
- * A log to which status events can be written. Logs appear on individual
- * plug-ins and on the platform itself. Clients can register log listeners which
- * will receive notification of all log events as they come in.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * XXX Need to create a new log interface on common plugin. That interface should be a super interface of this ILog.
- * getBundle() would stay here. In the super interface we would have getName()
- */
-public interface ILog {
- /**
- * Adds the given log listener to this log. Subsequently the log listener will
- * receive notification of all log events passing through this log.
- * This method has no affect if the identical listener is already registered on this log.
- *
- * @param listener the listener to add to this log
- * @see Platform#addLogListener(ILogListener)
- */
- public void addLogListener(ILogListener listener);
-
- /**
- * Returns the plug-in with which this log is associated.
- *
- * @return the plug-in with which this log is associated
- * @since 3.0
- */
- public Bundle getBundle();
-
- /**
- * Logs the given status. The status is distributed to the log listeners
- * installed on this log and then to the log listeners installed on the platform.
- *
- * @param status the status to log
- */
- public void log(IStatus status);
-
- /**
- * Removes the given log listener to this log. Subsequently the log listener will
- * no longer receive notification of log events passing through this log.
- * This method has no affect if the identical listener is not registered on this log.
- *
- * @param listener the listener to remove
- * @see Platform#removeLogListener(ILogListener)
- */
- public void removeLogListener(ILogListener listener);
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPlatformRunnable.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPlatformRunnable.java
deleted file mode 100644
index 483be2e..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPlatformRunnable.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import org.eclipse.equinox.app.IApplication;
-
-/**
- * Bootstrap type for the platform. Platform runnables represent executable
- * entry points into plug-ins. Runnables can be configured into the Platform's
- * <code>org.eclipse.core.runtime.applications</code> extension-point
- * or be made available through code or extensions on other plug-in's extension-points.
- *
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @since 3.0
- * @deprecated use {@link IApplication}
- */
-public interface IPlatformRunnable {
-
- /**
- * Exit object indicating normal termination
- */
- public static final Integer EXIT_OK = new Integer(0);
-
- /**
- * Exit object requesting platform restart
- */
- public static final Integer EXIT_RESTART = new Integer(23);
-
- /**
- * Exit object requesting that the command passed back be executed. Typically
- * this is used to relaunch Eclipse with different command line arguments. When the executable is
- * relaunched the command line will be retrieved from the <code>eclipse.exitdata</code> system property.
- */
- public static final Integer EXIT_RELAUNCH = new Integer(24);
-
- /**
- * Runs this runnable with the given args and returns a result.
- * The content of the args is unchecked and should conform to the expectations of
- * the runnable being invoked. Typically this is a <code>String</code> array.
- * Applications can return any object they like. If an <code>Integer</code> is returned
- * it is treated as the program exit code if Eclipse is exiting.
- *
- * @param args the argument(s) to pass to the application
- * @return the return value of the application
- * @exception Exception if there is a problem running this runnable.
- * @see #EXIT_OK
- * @see #EXIT_RESTART
- * @see #EXIT_RELAUNCH
- */
- public Object run(Object args) throws Exception;
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPluginDescriptor.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPluginDescriptor.java
deleted file mode 100644
index 5f6c315..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPluginDescriptor.java
+++ /dev/null
@@ -1,524 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import java.net.URL;
-import java.util.*;
-
-/**
- * A plug-in descriptor contains information about a plug-in
- * obtained from the plug-in's manifest (<code>plugin.xml</code>) file.
- * <p>
- * Plug-in descriptors are platform-defined objects that exist
- * in the plug-in registry independent of whether a plug-in has
- * been started. In contrast, a plug-in's runtime object
- * (<code>getPlugin</code>) generally runs plug-in-defined code.
- * </p>
- * <p>This interface is not intended to be implemented by clients.
- * </p>
- *
- * @deprecated
- * <code>IPluginDescriptor</code> was refactored in Eclipse 3.0.
- * Most of the functionality has moved to {@link Platform} and the
- * plug-in descriptor has been replaced with the OSGi <code>Bundle</code>
- * object.
- * <p>
- * This interface must only be used by plug-ins
- * which explicitly require the org.eclipse.core.runtime.compatibility plug-in.
- * </p>
- * <p>
- * For most uses the bundle object can be treated as an opaque token
- * representing your plug-in to the system -- It must be supplied to various
- * <code>Platform</code> methods but need not be interrogated itself.
- * There are a small number of plug-in descriptor method equivalents
- * supplied by <code>Bundle</code> itself. The details are spelled out
- * in the comments on each <code>IPluginDescriptor</code> method.
- * </p>
- * <p>
- * Clients of this interface have a reference to an <code>IPluginDescriptor</code>
- * corresponding to a plug-in. To adapt to the deprecation, the bundle corresponding
- * to the plug-in generally needs to be acquired. There are several cases:
- * <ul>
- * <li>the descriptor was discovered using methods such as
- * <code>IPluginRegistry.getPluginDescriptor()</code>. The code should be
- * updated to use one of the bundle discovery mechanisms such as
- * <code>Platform.getBundle()</code>.
- * </li>
- * <li>the descriptor is from the plug-in itself. The code should be updated to
- * use the plug-in's bundle instead.
- * </li>
- * <li>the descriptor is supplied by a third party. The plug-in writer must
- * cooperate with that party to obtain a bundle rather than a descriptor.
- * </li>
- * </ul>
- * </p>
- * <p>
- * The resulting bundle object can be used
- * to carry out the adaptation steps outlined for each of the
- * <code>IPluginDescriptor</code> methods.
- * </p>
- *
- * @see #getPlugin()
- */
-public interface IPluginDescriptor {
- /**
- * Returns the extension with the given simple identifier declared in
- * this plug-in, or <code>null</code> if there is no such extension.
- * Since an extension might not have an identifier, some extensions
- * can only be found via the <code>getExtensions</code> method.
- *
- * @param extensionName the simple identifier of the extension (e.g. <code>"main"</code>).
- * @return the extension, or <code>null</code>
- * @deprecated
- * Use
- * <pre>
- * Platform.getExtensionRegistry().getExtension(id + "." + extensionName)
- * </pre>
- * where <code>id</code> is the plug-in id.
- */
- public IExtension getExtension(String extensionName);
-
- /**
- * Returns the extension point with the given simple identifier
- * declared in this plug-in, or <code>null</code> if there is no such extension point.
- *
- * @param extensionPointId the simple identifier of the extension point (e.g. <code>"wizard"</code>).
- * @return the extension point, or <code>null</code>
- * @deprecated
- * Use
- * <pre>
- * Platform.getExtensionRegistry().getExtensionPoint(id, extensionPointId)
- * </pre>
- * where <code>id</code> is the plug-in id.
- */
- public IExtensionPoint getExtensionPoint(String extensionPointId);
-
- /**
- * Returns all extension points declared by this plug-in.
- * Returns an empty array if this plug-in does not declare any extension points.
- *
- * @return the extension points declared by this plug-in
- * @deprecated
- * Use
- * <pre>
- * Platform.getExtensionRegistry().getExtensionPoints(id)
- * </pre>
- * where <code>id</code> is the plug-in id.
- */
- public IExtensionPoint[] getExtensionPoints();
-
- /**
- * Returns all extensions declared by this plug-in.
- * Returns an empty array if this plug-in does not declare any extensions.
- *
- * @return the extensions declared by this plug-in
- * @deprecated
- * Use
- * <pre>
- * Platform.getExtensionRegistry().getExtensions(id)
- * </pre>
- * where <code>id</code> is the plug-in id.
- */
- public IExtension[] getExtensions();
-
- /**
- * Returns the URL of this plug-in's install directory.
- * This is the directory containing
- * the plug-in manifest file, resource bundle, runtime libraries,
- * and any other files supplied with this plug-in. This directory is usually
- * read-only. Plug-in relative information should be written to the location
- * provided by <code>Plugin.getStateLocation</code>.
- *
- * @return the URL of this plug-in's install directory
- * @see #getPlugin()
- * @see Plugin#getStateLocation()
- * @deprecated
- * Use
- * <pre>
- * bundle.getEntry("/");
- * </pre>
- * where <code>bundle</code> is the bundle associated with
- * the relevant plug-in or simply use the <code>getEntry</code> API
- * to construct the desired URL.
- */
- public URL getInstallURL();
-
- /**
- * Returns a displayable label for this plug-in.
- * Returns the empty string if no label for this plug-in
- * is specified in the plug-in manifest file.
- * <p> Note that any translation specified in the plug-in manifest
- * file is automatically applied.
- * </p>
- *
- * @return a displayable string label for this plug-in,
- * possibly the empty string
- * @see #getResourceString(String)
- * @deprecated
- * Use
- * <pre>
- * bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_NAME)
- * </pre>
- * where <code>bundle</code> is the bundle associated with
- * the relevant plug-in.
- */
- public String getLabel();
-
- /**
- * Returns the plug-in runtime object corresponding to this
- * plug-in descriptor. Unlike other methods on this object,
- * invoking this method may activate the plug-in.
- * The returned object is an instance of the plug-in runtime class
- * specified in the plug-in's manifest file;
- * if a class is not specified there, the returned object
- * is an internally-supplied one that does not react to life cycle requests.
- *
- * @return the plug-in runtime object
- * @exception CoreException
- * if this plug-in's runtime object could not be created.
- * @see #isPluginActivated()
- * @deprecated
- * In Eclipse 3.0 plug-in runtime objects are not globally managed and
- * so are not generically accessible. Rather, each plug-in is free to declare
- * API which exposes the plug-in runtime object (e.g., <code>MyPlugin.getInstance()</code>).
- *
- * If this method is being used to activate a plug-in then the following code is
- * equivalent:
- * <pre>
- * bundle.start()
- * </pre>
- * where <code>bundle</code> is the bundle associated with
- * the relevant plug-in.
- */
- public Plugin getPlugin() throws CoreException;
-
- /**
- * Returns the plug-in class loader used to load classes and resources
- * for this plug-in. The class loader can be used to directly access
- * plug-in resources and classes. Note that accessing a resource will
- * <b>not activate</b> the corresponding plug-in. Successfully loading
- * a class will <b>always activate</b> the corresponding plug-in.
- * <p>
- * The following examples illustrate the direct use of the plug-in class
- * loader and its effect on plug-in activation (example ignores error
- * handling).
- *
- * <pre>
- * ClassLoader loader = descriptor.getPluginClassLoader();
- *
- * // Load resource by name. Will not activate the plug-in.
- * URL res = loader.getResource("com/example/Foo/button.gif");
- * InputStream is = loader.getResourceAsStream("splash.jpg");
- *
- * // Load resource for class. Will activate the plug-in because
- * // the referenced class is loaded first and triggers activation.
- * URL u = com.example.Foo.class.getResource("button.gif");
- *
- * // Load class by name. Will activate the plug-in.
- * Class c = loader.loadClass("com.example.Bar");
- *
- * // Load a resource bundle. May, or may not activate the plug-in, depending
- * // on the bundle implementation. If implemented as a class, the plug-in
- * // will be activated. If implemented as a properties file, the plug-in will
- * // not be activated.
- * ResourceBundle b =
- * ResourceBundle.getBundle("bundle", Locale.getDefault(), loader);
- * </pre>
- *
- * @return the plug-in class loader
- * @see IConfigurationElement#createExecutableExtension(String)
- * @see #isPluginActivated()
- * @see #getResourceBundle()
- * @deprecated
- * Use
- * <pre>
- * bundle.loadClass(className)
- * </pre>
- * where <code>bundle</code> is the bundle associated with
- * the relevant plug-in.
- */
- public ClassLoader getPluginClassLoader();
-
- /**
- * Returns a list of plug-in prerequisites required
- * for correct execution of this plug-in.
- *
- * @return an array of plug-in prerequisites, or an empty array
- * if no prerequisites were specified
- * @deprecated
- * Use
- * <pre>
- * import org.eclipse.osgi.util.ManifestElement;
- * import org.osgi.framework.Constants;
- * ...
- * String requires = (String)bundle.getHeaders().get(Constants.REQUIRE_BUNDLE);
- * ManifestElement[] elements = ManifestElement.parseHeader(Constants.REQUIRE_BUNDLE, requires);
- * </pre>
- * where <code>bundle</code> is the bundle associated with
- * the relevant plug-in. The resultant elements array contains one
- * entry for each required plug-in.
- */
- public IPluginPrerequisite[] getPluginPrerequisites();
-
- /**
- * Returns the name of the provider of this plug-in.
- * Returns the empty string if no provider name is specified in
- * the plug-in manifest file.
- * <p> Note that any translation specified in the plug-in manifest
- * file is automatically applied.
- * </p>
- * @return the name of the provider, possibly the empty string
- * @see #getResourceString(String)
- * @deprecated
- * Use
- * <pre>
- * bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VENDOR)
- * </pre>
- * where <code>bundle</code> is the bundle associated with
- * the relevant plug-in.
- */
- public String getProviderName();
-
- /**
- * Returns this plug-in's resource bundle for the current locale.
- * <p>
- * The bundle is stored as the <code>plugin.properties</code> file
- * in the plug-in install directory, and contains any translatable
- * strings used in the plug-in manifest file (<code>plugin.xml</code>)
- * along with other resource strings used by the plug-in implementation.
- * </p>
- *
- * @return the resource bundle
- * @exception MissingResourceException if the resource bundle was not found
- * @deprecated
- * Use
- * <pre>
- * Platform.getResourceBundle(bundle)
- * </pre>
- * where <code>bundle</code> is the bundle associated with
- * the relevant plug-in.
- */
- public ResourceBundle getResourceBundle() throws MissingResourceException;
-
- /**
- * Returns a resource string corresponding to the given argument value.
- * If the argument value specifies a resource key, the string
- * is looked up in the default resource bundle. If the argument does not
- * specify a valid key, the argument itself is returned as the
- * resource string. The key lookup is performed in the
- * plugin.properties resource bundle. If a resource string
- * corresponding to the key is not found in the resource bundle
- * the key value, or any default text following the key in the
- * argument value is returned as the resource string.
- * A key is identified as a string beginning with the "%" character.
- * Note, that the "%" character is stripped off prior to lookup
- * in the resource bundle.
- * <p>
- * Equivalent to <code>getResourceString(value, getResourceBundle())</code>
- * </p>
- *
- * @param value the value
- * @return the resource string
- * @see #getResourceBundle()
- * @deprecated
- * Use
- * <pre>
- * Platform.getResourceString(bundle, value)
- * </pre>
- * where <code>bundle</code> is the bundle associated with
- * the relevant plug-in.
- */
- public String getResourceString(String value);
-
- /**
- * Returns a resource string corresponding to the given argument
- * value and bundle.
- * If the argument value specifies a resource key, the string
- * is looked up in the given resource bundle. If the argument does not
- * specify a valid key, the argument itself is returned as the
- * resource string. The key lookup is performed against the
- * specified resource bundle. If a resource string
- * corresponding to the key is not found in the resource bundle
- * the key value, or any default text following the key in the
- * argument value is returned as the resource string.
- * A key is identified as a string beginning with the "%" character.
- * Note that the "%" character is stripped off prior to lookup
- * in the resource bundle.
- * <p>
- * For example, assume resource bundle plugin.properties contains
- * name = Project Name
- * <pre>
- * getResourceString("Hello World") returns "Hello World"</li>
- * getResourceString("%name") returns "Project Name"</li>
- * getResourceString("%name Hello World") returns "Project Name"</li>
- * getResourceString("%abcd Hello World") returns "Hello World"</li>
- * getResourceString("%abcd") returns "%abcd"</li>
- * getResourceString("%%name") returns "%name"</li>
- * </pre>
- * </p>
- *
- * @param value the value
- * @param resourceBundle the resource bundle
- * @return the resource string
- * @see #getResourceBundle()
- * @deprecated
- * Use
- * <pre>
- * Platform.getResourceString(bundle, value, resourceBundle)
- * </pre>
- * where <code>bundle</code> is the bundle associated with
- * the relevant plug-in.
- */
- public String getResourceString(String value, ResourceBundle resourceBundle);
-
- /**
- * Returns all runtime libraries declared by this plug-in.
- * Returns an empty array if this plug-in has no runtime libraries.
- *
- * @return the runtime libraries declared by this plug-in
- * @deprecated
- * Use
- * <pre>
- * import org.eclipse.osgi.util.ManifestElement;
- * import org.osgi.framework.Constants;
- * ...
- * String requires = (String)bundle.getHeaders().get(Constants.BUNDLE_CLASSPATH);
- * ManifestElement[] elements = ManifestElement.parseHeader(Constants.BUNDLE_CLASSPATH, requires);
- * </pre>
- * where <code>bundle</code> is the bundle associated with
- * the relevant plug-in. The resultant elements array contains one
- * entry for each entry on the bundle's classpath..
- */
- public ILibrary[] getRuntimeLibraries();
-
- /**
- * Returns the unique identifier of this plug-in.
- * This identifier is a non-empty string and is unique
- * within the plug-in registry.
- *
- * @return the unique identifier of the plug-in (e.g. <code>"org.eclipse.core.runtime"</code>)
- * @deprecated
- * Use
- * <pre>
- * bundle.getSymbolicName()
- * </pre>
- * where <code>bundle</code> is the bundle associated with
- * the relevant plug-in.
- */
- public String getUniqueIdentifier();
-
- /**
- * Returns the version identifier of this plug-in.
- *
- * @return the plug-in version identifier
- * @deprecated
- * Use
- * <pre>
- * String version = (String) bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION);
- * new PluginVersionIdentifier(version);
- * </pre>
- * where <code>bundle</code> is the bundle associated with
- * the relevant plug-in.
- */
- public PluginVersionIdentifier getVersionIdentifier();
-
- /**
- * Returns whether the plug-in described by this descriptor
- * has been activated. Invoking this method will not cause the
- * plug-in to be activated.
- *
- * @return <code>true</code> if this plug-in is activated, and
- * <code>false</code> otherwise
- * @see #getPlugin()
- * @deprecated
- * Use
- * <pre>
- * bundle.getState == org.osgi.framework.Bundle.ACTIVE
- * </pre>
- * where <code>bundle</code> is the bundle associated with
- * the relevant plug-in.
- */
- public boolean isPluginActivated();
-
- /**
- * Returns a URL for the given path. Returns <code>null</code> if the URL
- * could not be computed or created.
- *
- * @param path path relative to plug-in installation location
- * @return a URL for the given path or <code>null</code> It is not
- * necessary to perform a 'resolve' on this URL.
- *
- * @since 2.0
- * @deprecated
- * Use
- * <pre>
- * Platform.find(bundle, file)
- * </pre>
- * where <code>bundle</code> is the bundle associated with
- * the relevant plug-in.
- */
- public URL find(IPath path);
-
- /**
- * Returns a URL for the given path. Returns <code>null</code> if the URL
- * could not be computed or created.
- *
- * find will look for this path under the directory structure for this plugin
- * and any of its fragments. If this path will yield a result outside the
- * scope of this plugin, <code>null</code> will be returned. Note that
- * there is no specific order to the fragments.
- *
- * The following arguments may also be used
- *
- * $nl$ - for language specific information
- * $os$ - for operating system specific information
- * $ws$ - for windowing system specific information
- *
- * A path of $nl$/about.properties in an environment with a default
- * locale of en_CA will return a URL corresponding to the first place
- * about.properties is found according to the following order:
- * plugin root/nl/en/CA/about.properties
- * fragment1 root/nl/en/CA/about.properties
- * fragment2 root/nl/en/CA/about.properties
- * ...
- * plugin root/nl/en/about.properties
- * fragment1 root/nl/en/about.properties
- * fragment2 root/nl/en/about.properties
- * ...
- * plugin root/about.properties
- * fragment1 root/about.properties
- * fragment2 root/about.properties
- * ...
- *
- * If a locale other than the default locale is desired, use an
- * override map.
- *
- * @param path file path relative to plug-in installation location
- * @param override map of override substitution arguments to be used for
- * any $arg$ path elements. The map keys correspond to the substitution
- * arguments (eg. "$nl$" or "$os$"). The resulting
- * values must be of type java.lang.String. If the map is <code>null</code>,
- * or does not contain the required substitution argument, the default
- * is used.
- * @return a URL for the given path or <code>null</code>. It is not
- * necessary to perform a 'resolve' on this URL.
- *
- * @since 2.0
- * @deprecated
- * Use
- * <pre>
- * Platform.find(bundle, path, override)
- * </pre>
- * where <code>bundle</code> is the bundle associated with
- * the relevant plug-in.
- */
- public URL find(IPath path, Map override);
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPluginPrerequisite.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPluginPrerequisite.java
deleted file mode 100644
index eb6efd0..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPluginPrerequisite.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.osgi.util.ManifestElement;
-import org.osgi.framework.Constants;
-
-/**
- * A prerequisite entry declared by a plug-in. The declaration causes
- * classes defined by the prerequisite plug-in to be visible
- * to the plug-in that declared the dependency.
- * <p>
- * This interface is not intended to be implemented by developers.
- * </p>
- *
- * @see IPluginDescriptor#getPluginPrerequisites()
- * @deprecated
- * In Eclipse 3.0 the plug-in prerequisite representation was changed. Clients of
- * <code>IPluginPrerequisite</code> are directed to the headers associated with the relevant bundle.
- * In particular, the <code>Require-Bundle</code> header contains all available information
- * about the prerequisites of a plug-in. Having retrieved the header, the {@link ManifestElement}
- * helper class can be used to parse the value and discover the individual
- * prerequisite plug-ins. The various header attributes are defined in {@link Constants}.
- * <p>For example,
- * <pre> String header = bundle.getHeaders().get(Constants.REQUIRE_BUNDLE);
- * ManifestElement[] elements = ManifestElement.parseHeader(
- * Constants.REQUIRE_BUNDLE, header);
- * if (elements == null)
- * return;
- * elements[0].getValue(); // the prerequisite plug-in id
- * elements[0].getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE); // the prerequisite plug-in version
- * ...
- * </pre>
- * </p><p>
- * See {@link IPluginDescriptor} for information on the relationship between plug-in
- * descriptors and bundles.
- * </p><p>
- * This interface must only be used by plug-ins
- * which explicitly require the org.eclipse.core.runtime.compatibility plug-in.
- * </p>
- */
-public interface IPluginPrerequisite {
- /**
- * Returns the actual version identifier that is used
- * at runtime to resolve this prerequisite dependency,
- * or null, if the dependency is not resolved.
- *
- * @return the plug-in version identifier, or null
- * @deprecated Callers of this method should interrogate the current {@link State}
- * of the platform. For example,
- * <pre>
- * State state = Platform.getPlatformAdmin().getState();
- * BundleDescription bundle = state.getBundle("my plug-in id", my plug-in version);
- * BundleSpecification spec = bundle.getRequiredBundle("required plug-in id");
- * BundleDescription prereq = spec.getSupplier();
- * </pre>
- */
- public PluginVersionIdentifier getResolvedVersionIdentifier();
-
- /**
- * Returns the plug-in identifier of the prerequisite plug-in.
- *
- * @return the plug-in identifier
- * @deprecated Given a manifest element equivalent of a plug-in
- * prerequisite (see the class comment), this method is replaced by:
- * <pre>
- * element.getValue();
- * </pre>
- */
- public String getUniqueIdentifier();
-
- /**
- * Returns the version identifier of the prerequisite plug-in,
- * or <code>null</code> if none.
- *
- * @return the plug-in version identifier, or <code>null</code> if
- * none was specified
- * @deprecated Callers of this method should interrogate the current {@link State}
- * of the platform. For example,
- * <pre>
- * State state = Platform.getPlatformAdmin().getState();
- * BundleDescription bundle = state.getBundle("my plug-in id", my plug-in version);
- * BundleSpecification spec = bundle.getRequiredBundle("required plug-in id");
- * Version reqMinVersion = spec.getVersionRange().getMinimum();
- * </pre>
- */
- public PluginVersionIdentifier getVersionIdentifier();
-
- /**
- * Indicates whether this prerequisite plug-in is further exposed to any
- * plug-ins that declare a dependency on this plug-in. This allows
- * for chaining of dependencies. For example, if plug-in A depends
- * on plug-in B which depends on plug-in C, the classes from C
- * are typically visible to B, but not to A. A can get around this
- * if either B explicitly exports its dependency on C, or
- * A explicitly declares C as a prerequisite in addition to B.
- *
- * @return <code>true</code> if this prerequisite plug-in is exposed,
- * <code>false</code> otherwise
- * @deprecated Given a manifest element equivalent of a plug-in
- * prerequisite (see the class comment), this method is replaced by:
- * <pre>
- * element.getAttribute(Constants.REPROVIDE_ATTRIBUTE);
- * </pre>
- */
- public boolean isExported();
-
- /**
- * Indicates that this plug-in prerequisite can be resolved
- * against a configured plug-in with an identifier that is
- * greater than or equal to it.
- *
- * @return <code>true</code> if greater or equal match is allowed,
- * <code>false</code> otherwise.
- * @since 2.0
- * @deprecated Callers of this method should interrogate the current {@link State}
- * of the platform. For example,
- * <pre>
- * State state = Platform.getPlatformAdmin().getState();
- * BundleDescription bundle = state.getBundle("my plug-in id", my plug-in version);
- * BundleSpecification spec = bundle.getRequiredBundle("required plug-in id");
- * VersionRange versionRange = spec.getVersionRange();
- * if (versionRange == null || versionRange.getMinimum() == null)
- * return false;
- * Version minimum = versionRange.getMinimum();
- * Version maximum = versionRange.getMaximum() == null ? Version.maxVersion : versionRange.getMaximum();
- * if (maximum.equals(Version.maxVersion))
- * return true;
- * return false;
- * </pre>
- */
- public boolean isMatchedAsGreaterOrEqual();
-
- /**
- * Indicates that this plug-in prerequisite can be resolved
- * against a configured plug-in with a compatible identifier.
- *
- * @return <code>true</code> if compatible match is allowed,
- * <code>false</code> if exact match is required.
- * @deprecated Callers of this method should interrogate the current {@link State}
- * of the platform. For example,
- * <pre>
- * State state = Platform.getPlatformAdmin().getState();
- * BundleDescription bundle = state.getBundle("my plug-in id", my plug-in version);
- * BundleSpecification spec = bundle.getRequiredBundle("required plug-in id");
- * VersionRange versionRange = spec.getVersionRange();
- * if (versionRange == null || versionRange.getMinimum() == null)
- * return false;
- * Version minimum = versionRange.getMinimum();
- * Version maximum = versionRange.getMaximum() == null ? Version.maxVersion : versionRange.getMaximum();
- * if (!minimum.isInclusive() || maximum.isInclusive())
- * return false;
- * else if (minimum.getMajorComponent() == maximum.getMajorComponent() - 1)
- * return true;
- * return false;
- * </pre>
- */
- public boolean isMatchedAsCompatible();
-
- /**
- * Indicates that this plug-in prerequisite can only be resolved
- * against a configured plug-in with an equivalent plug-in
- * identifier.
- *
- * @return <code>true</code> if only equivalent identifier match
- * satisfies this dependency, <code>false</code> otherwise.
- * @since 2.0
- * @deprecated Callers of this method should interrogate the current {@link State}
- * of the platform. For example,
- * <pre>
- * State state = Platform.getPlatformAdmin().getState();
- * BundleDescription bundle = state.getBundle("my plug-in id", my plug-in version);
- * BundleSpecification spec = bundle.getRequiredBundle("required plug-in id");
- * VersionRange versionRange = spec.getVersionRange();
- * if (versionRange == null || versionRange.getMinimum() == null)
- * return false;
- * Version minimum = versionRange.getMinimum();
- * Version maximum = versionRange.getMaximum() == null ? Version.maxVersion : versionRange.getMaximum();
- * if (!minimum.isInclusive() || maximum.isInclusive())
- * return false;
- * else if (minimum.getMajorComponent() == maximum.getMajorComponent() - 1)
- * return false;
- * else if (minimum.getMajorComponent() != maximum.getMajorComponent())
- * return false;
- * else if (minimum.getMinorComponent() == maximum.getMinorComponent() - 1)
- * return true;
- * return false;
- * </pre>
- */
- public boolean isMatchedAsEquivalent();
-
- /**
- * Indicates that this plug-in prerequisite can only be resolved
- * against a configured plug-in with a plug-in identifier that
- * is perfectly equal.
- *
- * @return <code>true</code> if only perfectly equal
- * identifier match satisfies this dependency,
- * <code>false</code> otherwise.
- * @since 2.0
- * @deprecated Callers of this method should interrogate the current {@link State}
- * of the platform. For example,
- * <pre>
- * State state = Platform.getPlatformAdmin().getState();
- * BundleDescription bundle = state.getBundle("my plug-in id", my plug-in version);
- * BundleSpecification spec = bundle.getRequiredBundle("required plug-in id");
- * VersionRange versionRange = spec.getVersionRange();
- * if (versionRange == null || versionRange.getMinimum() == null)
- * return false;
- * Version minimum = versionRange.getMinimum();
- * Version maximum = versionRange.getMaximum() == null ? Version.maxVersion : versionRange.getMaximum();
- * if (minimum.equals(maximum))
- * return true;
- * return false;
- * </pre>
- */
- public boolean isMatchedAsPerfect();
-
- /**
- * Indicates that this plug-in prerequisite can only be resolved
- * against a configured plug-in with exactly the same plug-in
- * identifier.
- *
- * @return <code>true</code> if only exact identifier match
- * satisfies this dependency, <code>false</code> if compatible
- * plug-in will satisfy this dependency.
- * @deprecated Callers of this method should interrogate the current {@link State}
- * of the platform. For example,
- * <pre>
- * State state = Platform.getPlatformAdmin().getState();
- * BundleDescription bundle = state.getBundle("my plug-in id", my plug-in version);
- * BundleSpecification spec = bundle.getRequiredBundle("required plug-in id");
- * VersionRange versionRange = spec.getVersionRange();
- * if (versionRange == null || versionRange.getMinimum() == null)
- * return false;
- * Version minimum = versionRange.getMinimum();
- * Version maximum = versionRange.getMaximum() == null ? Version.maxVersion : versionRange.getMaximum();
- * if (!minimum.isInclusive() || maximum.isInclusive())
- * return false;
- * else if (minimum.getMajorComponent() == maximum.getMajorComponent() - 1)
- * return false;
- * else if (minimum.getMajorComponent() != maximum.getMajorComponent())
- * return false;
- * else if (minimum.getMinorComponent() == maximum.getMinorComponent() - 1)
- * return true;
- * return false;
- * </pre>
- */
- public boolean isMatchedAsExact();
-
- /**
- * Indicates whether this plug-in prerequisite is optional. If a required (i.e., non-optional)
- * prerequisite is missing, this plugin is disabled.
- *
- * @return <code>true</code> if this prerequisite is optional, <code>false</code> otherwise
- * @deprecated Given a manifest element equivalent of a plug-in
- * prerequisite (see the class comment), this method is replaced by:
- * <pre>
- * "true".equals(element.getAttribute(Constants.OPTIONAL_ATTRIBUTE);
- * </pre>
- */
- public boolean isOptional();
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPluginRegistry.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPluginRegistry.java
deleted file mode 100644
index 03a4f6d..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPluginRegistry.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * The plug-in registry holds the master list of all
- * discovered plug-ins, extension points, and extensions.
- * <p>
- * The plug-in registry can be queried, by name, for
- * plug-ins, extension points, and extensions.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @deprecated
- * The plug-in registry has been generalized in Eclipse 3.0. It is now the
- * {@link IExtensionRegistry}. Most of the <code>IPluginRegistry</code> function
- * is directly supported on the new interface without change. Most clients
- * of <code>IPluginRegistry</code> need only to change their references to use
- * <code>IExtensionRegistry</code>. The only exceptions are
- * methods that return <code>IPluginDescriptor</code>s. See the relevant method
- * comments for details.
- * <p>
- * This interface must only be used by plug-ins
- * which explicitly require the org.eclipse.core.runtime.compatibility plug-in.
- * </p>
- */
-public interface IPluginRegistry {
- /**
- * Returns all configuration elements from all extensions configured
- * into the identified extension point. Returns an empty array if the extension
- * point does not exist, has no extensions configured, or none of the extensions
- * contain configuration elements.
- *
- * @param extensionPointId the unique identifier of the extension point
- * (e.g. <code>"org.eclipse.core.resources.builders"</code>)
- * @return the configuration elements
- * @deprecated Replaced by {@link IExtensionRegistry#getConfigurationElementsFor(String)}.
- */
- public IConfigurationElement[] getConfigurationElementsFor(String extensionPointId);
-
- /**
- * Returns all configuration elements from all extensions configured
- * into the identified extension point. Returns an empty array if the extension
- * point does not exist, has no extensions configured, or none of the extensions
- * contain configuration elements.
- *
- * @param pluginId the unique identifier of the plug-in
- * (e.g. <code>"org.eclipse.core.resources"</code>)
- * @param extensionPointName the simple identifier of the
- * extension point (e.g. <code>"builders"</code>)
- * @return the configuration elements
- * @deprecated Replaced by {@link IExtensionRegistry#getConfigurationElementsFor(String, String)}.
- */
- public IConfigurationElement[] getConfigurationElementsFor(String pluginId, String extensionPointName);
-
- /**
- * Returns all configuration elements from the identified extension.
- * Returns an empty array if the extension does not exist or
- * contains no configuration elements.
- *
- * @param pluginId the unique identifier of the plug-in
- * (e.g. <code>"org.eclipse.core.resources"</code>)
- * @param extensionPointName the simple identifier of the
- * extension point (e.g. <code>"builders"</code>)
- * @param extensionId the unique identifier of the extension
- * (e.g. <code>"com.example.acme.coolbuilder</code>)
- * @return the configuration elements
- * @deprecated Replaced by {@link IExtensionRegistry#getConfigurationElementsFor(String, String, String)}.
- */
- public IConfigurationElement[] getConfigurationElementsFor(String pluginId, String extensionPointName, String extensionId);
-
- /**
- * Returns the specified extension in this plug-in registry,
- * or <code>null</code> if there is no such extension.
- * The first parameter identifies the extension point, and the second
- * parameter identifies an extension plugged in to that extension point.
- *
- * @param extensionPointId the unique identifier of the extension point
- * (e.g. <code>"org.eclipse.core.resources.builders"</code>)
- * @param extensionId the unique identifier of the extension
- * (e.g. <code>"com.example.acme.coolbuilder"</code>)
- * @return the extension, or <code>null</code>
- * @deprecated Replaced by {@link IExtensionRegistry#getExtension(String, String)}.
- */
- public IExtension getExtension(String extensionPointId, String extensionId);
-
- /**
- * Returns the specified extension in this plug-in registry,
- * or <code>null</code> if there is no such extension.
- * The first two parameters identify the extension point, and the third
- * parameter identifies an extension plugged in to that extension point.
- *
- * @param pluginId the unique identifier of the plug-in
- * (e.g. <code>"org.eclipse.core.resources"</code>)
- * @param extensionPointName the simple identifier of the
- * extension point (e.g. <code>"builders"</code>)
- * @param extensionId the unique identifier of the extension
- * (e.g. <code>"com.example.acme.coolbuilder"</code>)
- * @return the extension, or <code>null</code>
- * @deprecated Replaced by {@link IExtensionRegistry#getExtension(String, String, String)}.
- */
- public IExtension getExtension(String pluginId, String extensionPointName, String extensionId);
-
- /**
- * Returns the extension point with the given extension point identifier
- * in this plug-in registry, or <code>null</code> if there is no such
- * extension point.
- *
- * @param extensionPointId the unique identifier of the extension point
- * (e.g., <code>"org.eclipse.core.resources.builders"</code>)
- * @return the extension point, or <code>null</code>
- * @deprecated Replaced by {@link IExtensionRegistry#getExtensionPoint(String)}.
- */
- public IExtensionPoint getExtensionPoint(String extensionPointId);
-
- /**
- * Returns the extension point in this plug-in registry
- * with the given plug-in identifier and extension point simple identifier,
- * or <code>null</code> if there is no such extension point.
- *
- * @param pluginId the unique identifier of the plug-in
- * (e.g. <code>"org.eclipse.core.resources"</code>)
- * @param extensionPointName the simple identifier of the
- * extension point (e.g. <code>" builders"</code>)
- * @return the extension point, or <code>null</code>
- * @deprecated Replaced by {@link IExtensionRegistry#getExtensionPoint(String, String)}.
- */
- public IExtensionPoint getExtensionPoint(String pluginId, String extensionPointName);
-
- /**
- * Returns all extension points known to this plug-in registry.
- * Returns an empty array if there are no extension points.
- *
- * @return the extension points known to this plug-in registry
- * @deprecated Replaced by {@link IExtensionRegistry#getExtensionPoints()}.
- */
- public IExtensionPoint[] getExtensionPoints();
-
- /**
- * Returns the plug-in descriptor with the given plug-in identifier
- * in this plug-in registry, or <code>null</code> if there is no such
- * plug-in. If there are multiple versions of the identified plug-in,
- * one will be non-deterministically chosen and returned.
- *
- * @param pluginId the unique identifier of the plug-in
- * (e.g. <code>"com.example.acme"</code>).
- * @return the plug-in descriptor, or <code>null</code>
- * @deprecated
- * <code>IPluginDescriptor</code> was refactored in Eclipse 3.0.
- * The <code>getPluginDescriptor()</code> method may only be called by plug-ins
- * which explicitly require the org.eclipse.core.runtime.compatibility plug-in.
- * See the comments on {@link IPluginDescriptor} and its methods for details.
- */
- public IPluginDescriptor getPluginDescriptor(String pluginId);
-
- /**
- * Returns the plug-in descriptor with the given plug-in identifier
- * and version in this plug-in registry, or <code>null</code> if
- * there is no such plug-in.
- *
- * @param pluginId the unique identifier of the plug-in
- * (e.g. <code>"org.eclipse.core.resources"</code>)
- * @param version plug-in version identifier. If <code>null</code> is specified,
- * a non-deterministically chosen version of the identified plug-in (if any)
- * will be returned
- * @return the plug-in descriptor, or <code>null</code>
- * @deprecated
- * <code>IPluginDescriptor</code> was refactored in Eclipse 3.0.
- * The <code>getPluginDescriptor()</code> method may only be called by plug-ins
- * which explicitly require the org.eclipse.core.runtime.compatibility plug-in.
- * See the comments on {@link IPluginDescriptor} and its methods for details.
- */
- public IPluginDescriptor getPluginDescriptor(String pluginId, PluginVersionIdentifier version);
-
- /**
- * Returns all plug-in descriptors known to this plug-in registry.
- * Returns an empty array if there are no installed plug-ins.
- *
- * @return the plug-in descriptors known to this plug-in registry
- * @deprecated
- * <code>IPluginDescriptor</code> was refactored in Eclipse 3.0.
- * The <code>getPluginDescriptors()</code> method may only be called by plug-ins
- * which explicitly require the org.eclipse.core.runtime.compatibility plug-in.
- * See the comments on {@link IPluginDescriptor} and its methods for details.
- */
- public IPluginDescriptor[] getPluginDescriptors();
-
- /**
- * Returns all versions of the identified plug-in descriptor
- * known to this plug-in registry.
- * Returns an empty array if there are no plug-ins
- * with the specified identifier.
- *
- * @param pluginId the unique identifier of the plug-in
- * (e.g. <code>"org.eclipse.core.resources"</code>).
- * @return the plug-in descriptors known to this plug-in registry
- * @deprecated
- * <code>IPluginDescriptor</code> was refactored in Eclipse 3.0.
- * The <code>getPluginDescriptors()</code> method may only be called by plug-ins
- * which explicitly require the org.eclipse.core.runtime.compatibility plug-in.
- * See the comments on {@link IPluginDescriptor} and its methods for details.
- */
- public IPluginDescriptor[] getPluginDescriptors(String pluginId);
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProduct.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProduct.java
deleted file mode 100644
index f696629..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProduct.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import org.osgi.framework.Bundle;
-
-/**
- * Products are the Eclipse unit of branding. From the runtime point of view they have
- * a name, id and description and identify the Eclipse application to run.
- * <p>
- * Since the bulk of the branding related information is
- * specific to the UI, products also carry an arbitrary set of properties. The valid set of
- * key-value pairs and their interpretation defined by the UI of the target environment.
- * For example, in the standard Eclipse UI, <code>org.eclipse.ui.branding.IProductConstants</code>
- * the properties of interest to the UI. Other clients may specify additional properties.
- * </p><p>
- * Products can be defined directly using extensions to the <code>org.eclipse.core.runtime.products</code>
- * extension point or by using facilities provided by IProductProvider implementations.
- * </p><p>
- * For readers familiar with Eclipse 2.1 and earlier, products are roughly equivalent to
- * <i>primary features</i>.
- * </p>
- *
- * @see IProductProvider
- * @since 3.0
- */
-public interface IProduct {
- /**
- * Returns the application associated with this product. This information is used
- * to guide the runtime as to what application extension to create and execute.
- *
- * @return this product's application or <code>null</code> if none
- */
- public String getApplication();
-
- /**
- * Returns the name of this product. The name is typically used in the title
- * bar of UI windows.
- *
- * @return the name of this product or <code>null</code> if none
- */
- public String getName();
-
- /**
- * Returns the text description of this product
- *
- * @return the description of this product or <code>null</code> if none
- */
- public String getDescription();
-
- /** Returns the unique product id of this product.
- *
- * @return the id of this product
- */
- public String getId();
-
- /**
- * Returns the property of this product with the given key.
- * <code>null</code> is returned if there is no such key/value pair.
- *
- * @param key the name of the property to return
- * @return the value associated with the given key or <code>null</code> if none
- */
- public String getProperty(String key);
-
- /**
- * Returns the bundle which is responsible for the definition of this product.
- * Typically this is used as a base for searching for images and other files
- * that are needed in presenting the product.
- *
- * @return the bundle which defines this product or <code>null</code> if none
- */
- public Bundle getDefiningBundle();
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProductProvider.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProductProvider.java
deleted file mode 100644
index 5e72785..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProductProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * Product providers define products (units of branding) which have been installed in
- * the current system. Typically, a configuration agent (i.e., plug-in installer) will
- * define a product provider so that it can report to the system the products it has installed.
- * <p>
- * Products are normally defined and installed in the system using extensions to the
- * <code>org.eclipse.core.runtime.products</code> extension point. In cases where
- * the notion of product is defined by alternate means (e.g., primary feature), an <code>IProductProvider</code>
- * can be installed in this extension point using an executable extension. The provider
- * then acts as a proxy for the product extensions that represent the products installed.
- * </p>
- *
- * @see IProduct
- * @since 3.0
- */
-public interface IProductProvider {
- /**
- * Returns the human-readable name of this product provider.
- *
- * @return the name of this product provider
- */
- public String getName();
-
- /**
- * Returns the products provided by this provider.
- *
- * @return the products provided by this provider
- */
- public IProduct[] getProducts();
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/PerformanceStats.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/PerformanceStats.java
deleted file mode 100644
index 76dada2..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/PerformanceStats.java
+++ /dev/null
@@ -1,535 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import java.io.PrintWriter;
-import java.util.*;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.internal.runtime.PerformanceStatsProcessor;
-
-/**
- * PerformanceStats collects and aggregates timing data about events such as
- * a builder running, an editor opening, etc. This data is collected for the
- * purpose of performance analysis, and is not intended to be used as
- * a generic event tracking and notification system.
- * <p>
- * Each performance event can have an associated maximum acceptable
- * duration that is specified in the platform debug options file (.options).
- * Events that take longer than this maximum are logged as errors. Along
- * with option file entries for each debug event, there are some global debug
- * options for enabling or disabling performance event gathering and reporting.
- * See the "org.eclipse.core.runtime/perf*" debug options in the .options file
- * for the org.eclipse.core.runtime plugin for more details.
- * </p><p>
- * A performance event can optionally have additional context information
- * ({@link #getContext}). This information is only stored in the case
- * of a performance failure, and can be used to provide further diagnostic
- * information that can help track down the cause of the failure.
- * </p><p>
- * Performance events and performance failures are batched up and periodically
- * sent to interested performance event listeners.
- * </p><p>
- * This class is not intended to be subclassed or instantiated by clients.
- * </p>
- * @since 3.1
- */
-public class PerformanceStats {
- /**
- * A performance listener is periodically notified after performance events occur
- * or after events fail.
- * <p>
- * This class is intended to be subclassed.
- * </p>
- *
- * @see PerformanceStats#addListener(PerformanceStats.PerformanceListener)
- */
- public static abstract class PerformanceListener {
- /**
- * Creates a new listener.
- */
- protected PerformanceListener() {
- super();
- }
-
- /**
- * Notifies than an event exceeded the maximum duration for that event type.
- * <p>
- * This default implementation does nothing. Subclasses may override.
- * </p>
- *
- * @param event The event that failed
- * @param duration The duration of the failed event, in milliseconds
- */
- public void eventFailed(PerformanceStats event, long duration) {
- //default implementation does nothing
- }
-
- /**
- * Notifies that an event occurred. Notification might not occur
- * in the same thread or near the time of the actual event.
- * <p>
- * This default implementation does nothing. Subclasses may override.
- * </p>
- *
- * @param event The event that occurred
- */
- public void eventsOccurred(PerformanceStats[] event) {
- //default implementation does nothing
- }
- }
-
- /**
- * An empty stats object that is returned when tracing is turned off
- */
- private static final PerformanceStats EMPTY_STATS = new PerformanceStats("", ""); //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * Constant indicating whether or not tracing is enabled
- */
- public static final boolean ENABLED;
-
- /**
- * A constant indicating that the timer has not been started.
- */
- private static final long NOT_STARTED = -1;
-
- /**
- * All known event statistics.
- */
- private final static Map statMap = Collections.synchronizedMap(new HashMap());
-
- /**
- * Maximum allowed durations for each event.
- * Maps String (event name) -> Long (threshold)
- */
- private final static Map thresholdMap = Collections.synchronizedMap(new HashMap());
-
- /**
- * Whether non-failure statistics should be retained.
- */
- private static final boolean TRACE_SUCCESS;
-
- /**
- * An identifier that can be used to figure out who caused the event. This is
- * typically a string representation of the object whose code was running when
- * the event occurred or a <code>String</code> describing the event.
- */
- private String blame;
-
- /**
- * The id of the plugin that defined the blame object for this event, or
- * <code>null</code> if it could not be determined.
- */
- private String blamePluginId;
-
- /**
- * An optional context for the event (may be <code>null</code>).
- * The context can provide extra information about an event, such as the
- * name of a project being built, or the input of an editor being opened.
- */
- private String context;
-
- /**
- * The starting time of the current occurrence of this event.
- */
- private long currentStart = NOT_STARTED;
-
- /**
- * The symbolic name of the event that occurred. This is usually the name of
- * the debug option for this event.
- */
- private String event;
-
- /**
- * Whether this is a performance failure event
- */
- private boolean isFailure;
-
- /**
- * The total number of times this event has occurred.
- */
- private int runCount = 0;
-
- /**
- * The total time in milliseconds taken by all occurrences of this event.
- */
- private long runningTime = 0;
-
- static {
- ENABLED = InternalPlatform.getDefault().getBooleanOption(Platform.PI_RUNTIME + "/perf", false);//$NON-NLS-1$
- //turn these on by default if the global trace flag is turned on
- TRACE_SUCCESS = InternalPlatform.getDefault().getBooleanOption(Platform.PI_RUNTIME + "/perf/success", ENABLED); //$NON-NLS-1$
- }
-
- /**
- * Adds a listener that is notified when performance events occur. If
- * an equal listener is already installed, it will be replaced.
- *
- * @param listener The listener to be added
- * @see #removeListener(PerformanceStats.PerformanceListener)
- */
- public static void addListener(PerformanceListener listener) {
- if (ENABLED)
- PerformanceStatsProcessor.addListener(listener);
- }
-
- /**
- * Discards all known performance event statistics.
- */
- public static void clear() {
- statMap.clear();
- }
-
- /**
- * Returns all performance event statistics.
- *
- * @return An array of known performance event statistics. The array
- * will be empty if there are no recorded statistics.
- */
- public static PerformanceStats[] getAllStats() {
- return (PerformanceStats[]) statMap.values().toArray(new PerformanceStats[statMap.values().size()]);
- }
-
- /**
- * Returns the stats object corresponding to the given parameters.
- * A stats object is created and added to the global list of events if it did not
- * already exist.
- *
- * @param eventName A symbolic event name. This is usually the name of
- * the debug option for this event. An example event name from
- * the org.eclipse.core.resources plugin describing a build event might look like:
- * <code>"org.eclipse.core.resources/perf/building"</code>"
- * @param blameObject The blame for the event. This is typically the object
- * whose code was running when the event occurred. If a blame object cannot
- * be obtained, a <code>String</code> describing the event should be supplied
- */
- public static PerformanceStats getStats(String eventName, Object blameObject) {
- if (!ENABLED || eventName == null || blameObject == null)
- return EMPTY_STATS;
- PerformanceStats newStats = new PerformanceStats(eventName, blameObject);
- if (!TRACE_SUCCESS)
- return newStats;
- //use existing stats object if available
- PerformanceStats oldStats = (PerformanceStats) statMap.get(newStats);
- if (oldStats != null)
- return oldStats;
- statMap.put(newStats, newStats);
- return newStats;
- }
-
- /**
- * Returns whether monitoring of a given performance event is enabled.
- * <p>
- * For frequent performance events, the result of this method call should
- * be cached by the caller to minimize overhead when performance monitoring
- * is turned off. It is not possible for enablement to change during the life
- * of this invocation of the platform.
- * </p>
- *
- * @param eventName The name of the event to determine enablement for
- * @return <code>true</code>If the performance event with the given
- * name is enabled, and <code>false</code> otherwise.
- */
- public static boolean isEnabled(String eventName) {
- if (!ENABLED)
- return false;
- String option = Platform.getDebugOption(eventName);
- return option != null && !option.equalsIgnoreCase("false") && !option.equalsIgnoreCase("-1"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Prints all statistics to the standard output.
- */
- public static void printStats() {
- if (!ENABLED)
- return;
- PrintWriter writer = new PrintWriter(System.out);
- PerformanceStatsProcessor.printStats(writer);
- writer.flush();
- writer.close();
- }
-
- /**
- * Writes all statistics using the provided writer
- *
- * @param out The writer to print stats to.
- */
- public static void printStats(PrintWriter out) {
- if (!ENABLED)
- return;
- PerformanceStatsProcessor.printStats(out);
- }
-
- /**
- * Removes an event listener. Has no effect if an equal
- * listener object is not currently registered.
- *
- * @param listener The listener to remove
- * @see #addListener(PerformanceStats.PerformanceListener)
- */
- public static void removeListener(PerformanceListener listener) {
- if (ENABLED)
- PerformanceStatsProcessor.removeListener(listener);
- }
-
- /**
- * Removes statistics for a given event and blame
- *
- * @param eventName The name of the event to remove
- * @param blameObject The blame for the event to remove
- */
- public static void removeStats(String eventName, Object blameObject) {
- synchronized (statMap) {
- for (Iterator it = statMap.keySet().iterator(); it.hasNext();) {
- PerformanceStats stats = (PerformanceStats) it.next();
- if (stats.getEvent().equals(eventName) && stats.getBlame().equals(blameObject))
- it.remove();
- }
- }
- }
-
- /**
- * Creates a new PerformanceStats object. Private to prevent client instantiation.
- */
- private PerformanceStats(String event, Object blame) {
- this(event, blame, null);
- }
-
- /**
- * Creates a new PerformanceStats object. Private to prevent client instantiation.
- */
- private PerformanceStats(String event, Object blameObject, String context) {
- this.event = event;
- this.blame = blameObject instanceof String ? (String) blameObject : blameObject.getClass().getName();
- this.blamePluginId = InternalPlatform.getDefault().getBundleId(blameObject);
- this.context = context;
- }
-
- /**
- * Adds an occurrence of this event to the cumulative counters. This method
- * can be used as an alternative to <code>startRun</code> and <code>endRun</code>
- * for clients that want to track the context and execution time separately.
- *
- * @param elapsed The elapsed time of the new occurrence in milliseconds
- * @param contextName The context for the event to return, or <code>null</code>.
- * The context optionally provides extra information about an event, such as the
- * name of a project being built, or the input of an editor being opened.
- */
- public void addRun(long elapsed, String contextName) {
- if (!ENABLED)
- return;
- runCount++;
- runningTime += elapsed;
- if (elapsed > getThreshold(event))
- PerformanceStatsProcessor.failed(createFailureStats(contextName, elapsed), blamePluginId, elapsed);
- if (TRACE_SUCCESS)
- PerformanceStatsProcessor.changed(this);
- }
-
- /**
- * Creates a stats object representing a performance failure
- *
- * @param contextName The failure context information.
- * @param elapsed The elapsed time in milliseconds
- * @return The failure stats
- */
- private PerformanceStats createFailureStats(String contextName, long elapsed) {
- PerformanceStats failedStat = new PerformanceStats(event, blame, contextName);
- PerformanceStats old = (PerformanceStats) statMap.get(failedStat);
- if (old == null)
- statMap.put(failedStat, failedStat);
- else
- failedStat = old;
- failedStat.isFailure = true;
- failedStat.runCount++;
- failedStat.runningTime += elapsed;
- return failedStat;
- }
-
- /**
- * Stops timing the occurrence of this event that was started by the previous
- * call to <code>startRun</code>. The event is automatically added to
- * the cumulative counters for this event and listeners are notified.
- * <p>
- * Note that this facility guards itself against runs that start but fail to stop,
- * so it is not necessary to call this method from a finally block. Tracking
- * performance of failure cases is generally not of interest.
- * </p>
- *
- * @see #startRun()
- */
- public void endRun() {
- if (!ENABLED || currentStart == NOT_STARTED)
- return;
- addRun(System.currentTimeMillis() - currentStart, context);
- currentStart = NOT_STARTED;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals()
- */
- public boolean equals(Object obj) {
- //count and time are not considered part of equality
- if (!(obj instanceof PerformanceStats))
- return false;
- PerformanceStats that = (PerformanceStats) obj;
- if (!this.event.equals(that.event))
- return false;
- if (!this.getBlameString().equals(that.getBlameString()))
- return false;
- return this.context == null ? that.context == null : this.context.equals(that.context);
- }
-
- /**
- * Returns an object that can be used to figure out who caused the event,
- * or a string describing the cause of the event.
- *
- * @return The blame for this event
- */
- public Object getBlame() {
- return blame;
- }
-
- /**
- * Returns a string describing the blame for this event.
- *
- * @return A string describing the blame.
- */
- public String getBlameString() {
- return blame;
- }
-
- /**
- * Returns the optional event context, such as the input of an editor, or the target project
- * of a build event.
- *
- * @return The context, or <code>null</code> if there is none
- */
- public String getContext() {
- return context;
- }
-
- /**
- * Returns the symbolic name of the event that occurred.
- *
- * @return The name of the event.
- */
- public String getEvent() {
- return event;
- }
-
- /**
- * Returns the total number of times this event has occurred.
- *
- * @return The number of occurrences of this event.
- */
- public int getRunCount() {
- return runCount;
- }
-
- /**
- * Returns the total execution time in milliseconds for all occurrences
- * of this event.
- *
- * @return The total running time in milliseconds.
- */
- public long getRunningTime() {
- return runningTime;
- }
-
- /**
- * Returns the performance threshold for this event.
- */
- private long getThreshold(String eventName) {
- Long value = (Long) thresholdMap.get(eventName);
- if (value == null) {
- String option = InternalPlatform.getDefault().getOption(eventName);
- if (option != null) {
- try {
- value = new Long(option);
- } catch (NumberFormatException e) {
- //invalid option, just ignore
- }
- }
- if (value == null)
- value = new Long(Long.MAX_VALUE);
- thresholdMap.put(eventName, value);
- }
- return value.longValue();
- }
-
- public int hashCode() {
- //count and time are not considered part of equality
- int hash = event.hashCode() * 37 + getBlameString().hashCode();
- if (context != null)
- hash = hash * 37 + context.hashCode();
- return hash;
- }
-
- /**
- * Returns whether this performance event represents a performance failure.
- *
- * @return <code>true</code> if this is a performance failure, and
- * <code>false</code> otherwise.
- */
- public boolean isFailure() {
- return isFailure;
- }
-
- /**
- * Resets count and running time for this particular stats event.
- */
- public void reset() {
- runningTime = 0;
- runCount = 0;
- }
-
- /**
- * Starts timing an occurrence of this event. This is a convenience method,
- * fully equivalent to <code>startRun(null)</code>.
- */
- public void startRun() {
- if (ENABLED)
- startRun(null);
- }
-
- /**
- * Starts timing an occurrence of this event. The event should be stopped
- * by a subsequent call to <code>endRun</code>.
- *
- * @param contextName The context for the event to return, or <code>null</code>.
- * The context optionally provides extra information about an event, such as the
- * name of a project being built, or the input of an editor being opened.
- * @see #endRun
- */
- public void startRun(String contextName) {
- if (!ENABLED)
- return;
- this.context = contextName;
- this.currentStart = System.currentTimeMillis();
- }
-
- /**
- * For debugging purposes only.
- */
- public String toString() {
- StringBuffer result = new StringBuffer("PerformanceStats("); //$NON-NLS-1$
- result.append(event);
- result.append(',');
- result.append(blame);
- if (context != null) {
- result.append(',');
- result.append(context);
- }
- result.append(')');
- return result.toString();
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Platform.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Platform.java
deleted file mode 100644
index 611a730..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Platform.java
+++ /dev/null
@@ -1,1556 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.*;
-import org.eclipse.core.internal.runtime.*;
-import org.eclipse.core.internal.runtime.auth.AuthorizationHandler;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.preferences.IPreferencesService;
-import org.eclipse.osgi.service.datalocation.Location;
-import org.eclipse.osgi.service.debug.DebugOptions;
-import org.eclipse.osgi.service.environment.EnvironmentInfo;
-import org.eclipse.osgi.service.resolver.PlatformAdmin;
-import org.osgi.framework.Bundle;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * The central class of the Eclipse Platform Runtime. This class cannot
- * be instantiated or subclassed by clients; all functionality is provided
- * by static methods. Features include:
- * <ul>
- * <li>the platform registry of installed plug-ins</li>
- * <li>the platform adapter manager</li>
- * <li>the platform log</li>
- * <li>the authorization info management</li>
- * </ul>
- * <p>
- * Most users don't have to worry about Platform's lifecycle. However, if your
- * code can call methods of this class when Platform is not running, it becomes
- * necessary to check {@link #isRunning()} before making the call. A runtime
- * exception might be thrown or incorrect result might be returned if a method
- * from this class is called while Platform is not running.
- * </p>
- */
-public final class Platform {
-
- /**
- * The unique identifier constant (value "<code>org.eclipse.core.runtime</code>")
- * of the Core Runtime (pseudo-) plug-in.
- */
- public static final String PI_RUNTIME = "org.eclipse.core.runtime"; //$NON-NLS-1$
-
- /**
- * The simple identifier constant (value "<code>applications</code>") of
- * the extension point of the Core Runtime plug-in where plug-ins declare
- * the existence of runnable applications. A plug-in may define any
- * number of applications; however, the platform is only capable
- * of running one application at a time.
- *
- */
- public static final String PT_APPLICATIONS = "applications"; //$NON-NLS-1$
-
- /**
- * The simple identifier constant (value "<code>adapters</code>") of
- * the extension point of the Core Runtime plug-in where plug-ins declare
- * the existence of adapter factories. A plug-in may define any
- * number of adapters.
- *
- * @see IAdapterManager#hasAdapter(Object, String)
- * @since 3.0
- */
- public static final String PT_ADAPTERS = "adapters"; //$NON-NLS-1$
-
- /**
- * The simple identifier constant (value "<code>preferences</code>") of
- * the extension point of the Core Runtime plug-in where plug-ins declare
- * extensions to the preference facility. A plug-in may define any number
- * of preference extensions.
- *
- * @see #getPreferencesService()
- * @since 3.0
- */
- public static final String PT_PREFERENCES = Preferences.PT_PREFERENCES;
-
- /**
- * The simple identifier constant (value "<code>products</code>") of
- * the extension point of the Core Runtime plug-in where plug-ins declare
- * the existence of a product. A plug-in may define any
- * number of products; however, the platform is only capable
- * of running one product at a time.
- *
- * @see #getProduct()
- * @since 3.0
- */
- public static final String PT_PRODUCT = "products"; //$NON-NLS-1$
-
- /**
- * Debug option value denoting the time at which the platform runtime
- * was started. This constant can be used in conjunction with
- * <code>getDebugOption</code> to find the string value of
- * <code>System.currentTimeMillis()</code> when the platform was started.
- */
- public static final String OPTION_STARTTIME = PI_RUNTIME + "/starttime"; //$NON-NLS-1$
-
- /**
- * Name of a preference for configuring the performance level for this system.
- *
- * <p>
- * This value can be used by all components to customize features to suit the
- * speed of the user's machine. The platform job manager uses this value to make
- * scheduling decisions about background jobs.
- * </p>
- * <p>
- * The preference value must be an integer between the constant values
- * MIN_PERFORMANCE and MAX_PERFORMANCE
- * </p>
- * @see #MIN_PERFORMANCE
- * @see #MAX_PERFORMANCE
- * @since 3.0
- */
- public static final String PREF_PLATFORM_PERFORMANCE = "runtime.performance"; //$NON-NLS-1$
-
- /**
- * Constant (value "line.separator") name of the preference used for storing
- * the line separator.
- *
- * @see #knownPlatformLineSeparators
- * @since 3.1
- */
- public static final String PREF_LINE_SEPARATOR = "line.separator"; //$NON-NLS-1$
-
- /**
- * Constant (value 1) indicating the minimum allowed value for the
- * <code>PREF_PLATFORM_PERFORMANCE</code> preference setting.
- * @since 3.0
- */
- public static final int MIN_PERFORMANCE = 1;
-
- /**
- * Constant (value 5) indicating the maximum allowed value for the
- * <code>PREF_PLATFORM_PERFORMANCE</code> preference setting.
- * @since 3.0
- */
- public static final int MAX_PERFORMANCE = 5;
-
- /**
- * Status code constant (value 1) indicating a problem in a plug-in
- * manifest (<code>plugin.xml</code>) file.
- */
- public static final int PARSE_PROBLEM = 1;
-
- /**
- * Status code constant (value 2) indicating an error occurred while running a plug-in.
- */
- public static final int PLUGIN_ERROR = 2;
-
- /**
- * Status code constant (value 3) indicating an error internal to the
- * platform has occurred.
- */
- public static final int INTERNAL_ERROR = 3;
-
- /**
- * Status code constant (value 4) indicating the platform could not read
- * some of its metadata.
- */
- public static final int FAILED_READ_METADATA = 4;
-
- /**
- * Status code constant (value 5) indicating the platform could not write
- * some of its metadata.
- */
- public static final int FAILED_WRITE_METADATA = 5;
-
- /**
- * Status code constant (value 6) indicating the platform could not delete
- * some of its metadata.
- */
- public static final int FAILED_DELETE_METADATA = 6;
-
- /**
- * Constant string (value "win32") indicating the platform is running on a
- * Window 32-bit operating system (e.g., Windows 98, NT, 2000).
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String OS_WIN32 = "win32";//$NON-NLS-1$
-
- /**
- * Constant string (value "linux") indicating the platform is running on a
- * Linux-based operating system.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String OS_LINUX = "linux";//$NON-NLS-1$
-
- /**
- * Constant string (value "aix") indicating the platform is running on an
- * AIX-based operating system.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String OS_AIX = "aix";//$NON-NLS-1$
-
- /**
- * Constant string (value "solaris") indicating the platform is running on a
- * Solaris-based operating system.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String OS_SOLARIS = "solaris";//$NON-NLS-1$
-
- /**
- * Constant string (value "hpux") indicating the platform is running on an
- * HP/UX-based operating system.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String OS_HPUX = "hpux";//$NON-NLS-1$
-
- /**
- * Constant string (value "qnx") indicating the platform is running on a
- * QNX-based operating system.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String OS_QNX = "qnx";//$NON-NLS-1$
-
- /**
- * Constant string (value "macosx") indicating the platform is running on a
- * Mac OS X operating system.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String OS_MACOSX = "macosx";//$NON-NLS-1$
-
- /**
- * Constant string (value "unknown") indicating the platform is running on a
- * machine running an unknown operating system.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String OS_UNKNOWN = "unknown";//$NON-NLS-1$
-
- /**
- * Constant string (value "x86") indicating the platform is running on an
- * x86-based architecture.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String ARCH_X86 = "x86";//$NON-NLS-1$
-
- /**
- * Constant string (value "PA_RISC") indicating the platform is running on an
- * PA_RISC-based architecture.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String ARCH_PA_RISC = "PA_RISC";//$NON-NLS-1$
-
- /**
- * Constant string (value "ppc") indicating the platform is running on an
- * PowerPC-based architecture.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String ARCH_PPC = "ppc";//$NON-NLS-1$
-
- /**
- * Constant string (value "sparc") indicating the platform is running on an
- * Sparc-based architecture.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String ARCH_SPARC = "sparc";//$NON-NLS-1$
-
- /**
- * Constant string (value "x86_64") indicating the platform is running on an
- * x86 64bit-based architecture.
- *
- * @since 3.1
- */
- public static final String ARCH_X86_64 = "x86_64";//$NON-NLS-1$
-
- /**
- * Constant string (value "amd64") indicating the platform is running on an
- * AMD64-based architecture.
- *
- * @since 3.0
- * @deprecated use <code>ARCH_X86_64</code> instead. Note the values
- * has been changed to be the value of the <code>ARCH_X86_64</code> constant.
- */
- public static final String ARCH_AMD64 = ARCH_X86_64;
-
- /**
- * Constant string (value "ia64") indicating the platform is running on an
- * IA64-based architecture.
- *
- * @since 3.0
- */
- public static final String ARCH_IA64 = "ia64"; //$NON-NLS-1$
-
- /**
- * Constant string (value "ia64_32") indicating the platform is running on an
- * IA64 32bit-based architecture.
- *
- * @since 3.1
- */
- public static final String ARCH_IA64_32 = "ia64_32";//$NON-NLS-1$
-
- /**
- * Constant string (value "win32") indicating the platform is running on a
- * machine using the Windows windowing system.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String WS_WIN32 = "win32";//$NON-NLS-1$
-
- /**
- * Constant string (value "motif") indicating the platform is running on a
- * machine using the Motif windowing system.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String WS_MOTIF = "motif";//$NON-NLS-1$
-
- /**
- * Constant string (value "gtk") indicating the platform is running on a
- * machine using the GTK windowing system.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String WS_GTK = "gtk";//$NON-NLS-1$
-
- /**
- * Constant string (value "photon") indicating the platform is running on a
- * machine using the Photon windowing system.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String WS_PHOTON = "photon";//$NON-NLS-1$
-
- /**
- * Constant string (value "carbon") indicating the platform is running on a
- * machine using the Carbon windowing system (Mac OS X).
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String WS_CARBON = "carbon";//$NON-NLS-1$
-
- /**
- * Constant string (value "wpf") indicating the platform is running on a
- * machine using the WPF windowing system.
- * @since 3.3
- */
- public static final String WS_WPF = "wpf";//$NON-NLS-1$
-
- /**
- * Constant string (value "unknown") indicating the platform is running on a
- * machine running an unknown windowing system.
- * <p>
- * Note this constant has been moved from the deprecated
- * org.eclipse.core.boot.BootLoader class and its value has not changed.
- * </p>
- * @since 3.0
- */
- public static final String WS_UNKNOWN = "unknown";//$NON-NLS-1$
-
- // private constants for platform line separators and their associated platform names
- private static final String LINE_SEPARATOR_KEY_MAC_OS_9 = Messages.line_separator_platform_mac_os_9;
- private static final String LINE_SEPARATOR_KEY_UNIX = Messages.line_separator_platform_unix;
- private static final String LINE_SEPARATOR_KEY_WINDOWS = Messages.line_separator_platform_windows;
-
- private static final String LINE_SEPARATOR_VALUE_CR = "\r"; //$NON-NLS-1$
- private static final String LINE_SEPARATOR_VALUE_LF = "\n"; //$NON-NLS-1$
- private static final String LINE_SEPARATOR_VALUE_CRLF = "\r\n"; //$NON-NLS-1$
-
- /**
- * Private constructor to block instance creation.
- */
- private Platform() {
- super();
- }
-
- /**
- * Adds the given authorization information to the key ring. The
- * information is relevant for the specified protection space and the
- * given authorization scheme. The protection space is defined by the
- * combination of the given server URL and realm. The authorization
- * scheme determines what the authorization information contains and how
- * it should be used. The authorization information is a <code>Map</code>
- * of <code>String</code> to <code>String</code> and typically
- * contains information such as user names and passwords.
- *
- * @param serverUrl the URL identifying the server for this authorization
- * information. For example, "http://www.example.com/".
- * @param realm the subsection of the given server to which this
- * authorization information applies. For example,
- * "realm1@example.com" or "" for no realm.
- * @param authScheme the scheme for which this authorization information
- * applies. For example, "Basic" or "" for no authorization scheme
- * @param info a <code>Map</code> containing authorization information
- * such as user names and passwords (key type : <code>String</code>,
- * value type : <code>String</code>)
- * @exception CoreException if there are problems setting the
- * authorization information. Reasons include:
- * <ul>
- * <li>The keyring could not be saved.</li>
- * </ul>
- * @deprecated Authorization database is superseded by the Equinox secure storage.
- * Use <code>org.eclipse.equinox.security.storage.SecurePreferencesFactory</code>
- * to obtain secure preferences and <code>org.eclipse.equinox.security.storage.ISecurePreferences</code>
- * for data access and modifications.
- * Consider using <code>ISecurePreferences#put(String, String, boolean)</code> as a replacement of this method.
- */
- public static void addAuthorizationInfo(URL serverUrl, String realm, String authScheme, Map info) throws CoreException {
- try {
- AuthorizationHandler.addAuthorizationInfo(serverUrl, realm, authScheme, info);
- } catch (NoClassDefFoundError e) {
- // The authorization code is not available so just log and continue
- logAuthNotAvailable(e);
- }
- }
-
- /**
- * Adds the given log listener to the notification list of the platform.
- * <p>
- * Once registered, a listener starts receiving notification as entries
- * are added to plug-in logs via <code>ILog.log()</code>. The listener continues to
- * receive notifications until it is replaced or removed.
- * </p>
- *
- * @param listener the listener to register
- * @see ILog#addLogListener(ILogListener)
- * @see #removeLogListener(ILogListener)
- * XXX Use the LogMgr service.
- */
- public static void addLogListener(ILogListener listener) {
- InternalPlatform.getDefault().addLogListener(listener);
- }
-
- /**
- * Adds the specified resource to the protection space specified by the
- * given realm. All targets at or deeper than the depth of the last
- * symbolic element in the path of the given resource URL are assumed to
- * be in the same protection space.
- *
- * @param resourceUrl the URL identifying the resources to be added to
- * the specified protection space. For example,
- * "http://www.example.com/folder/".
- * @param realm the name of the protection space. For example,
- * "realm1@example.com"
- * @exception CoreException if there are problems setting the
- * authorization information. Reasons include:
- * <ul>
- * <li>The key ring could not be saved.</li>
- * </ul>
- * @deprecated Authorization database is superseded by the Equinox secure storage.
- * Use <code>org.eclipse.equinox.security.storage.SecurePreferencesFactory</code>
- * to obtain secure preferences and <code>org.eclipse.equinox.security.storage.ISecurePreferences</code>
- * for data access and modifications.
- */
- public static void addProtectionSpace(URL resourceUrl, String realm) throws CoreException {
- try {
- AuthorizationHandler.addProtectionSpace(resourceUrl, realm);
- } catch (NoClassDefFoundError e) {
- // The authorization code is not available so just log and continue
- logAuthNotAvailable(e);
- }
- }
-
- /**
- * Returns a URL that is the local equivalent of the
- * supplied URL. This method is expected to be used with the
- * plug-in-relative URLs returned by IPluginDescriptor, Bundle.getEntry()
- * and Platform.find().
- * If the specified URL is not a plug-in-relative URL, it
- * is returned as is. If the specified URL is a plug-in-relative
- * URL of a file (including .jar archive), it is returned as
- * a locally accessible URL using "file:" protocol
- * (extracting/caching the file locally, if required). If the specified URL
- * is a plug-in-relative URL of a directory, the directory and any files and directories
- * under it are made locally accessible likewise.
- *
- * @param url original plug-in-relative URL.
- * @return the resolved URL
- * @exception IOException if unable to resolve URL
- * @see #resolve(URL)
- * @see #find(Bundle, IPath)
- * @see Bundle#getEntry(String)
- * @deprecated use {@link FileLocator#toFileURL(URL)} instead
- */
- public static URL asLocalURL(URL url) throws IOException {
- return FileLocator.toFileURL(url);
- }
-
- /**
- * Takes down the splash screen if one was put up.
- * XXX this is application life cycle. Need to have the appropriate method on IApplication.
- */
- public static void endSplash() {
- InternalPlatform.getDefault().endSplash();
- }
-
- /**
- * Removes the authorization information for the specified protection
- * space and given authorization scheme. The protection space is defined
- * by the given server URL and realm.
- *
- * @param serverUrl the URL identifying the server to remove the
- * authorization information for. For example,
- * "http://www.example.com/".
- * @param realm the subsection of the given server to remove the
- * authorization information for. For example,
- * "realm1@example.com" or "" for no realm.
- * @param authScheme the scheme for which the authorization information
- * to remove applies. For example, "Basic" or "" for no
- * authorization scheme.
- * @exception CoreException if there are problems removing the
- * authorization information. Reasons include:
- * <ul>
- * <li>The keyring could not be saved.</li>
- * </ul>
- * @deprecated Authorization database is superseded by the Equinox secure storage.
- * Use <code>org.eclipse.equinox.security.storage.SecurePreferencesFactory</code>
- * to obtain secure preferences and <code>org.eclipse.equinox.security.storage.ISecurePreferences</code>
- * for data access and modifications.
- * Consider using <code>ISecurePreferences#clear()</code> as a replacement of this method.
- */
- public static void flushAuthorizationInfo(URL serverUrl, String realm, String authScheme) throws CoreException {
- try {
- AuthorizationHandler.flushAuthorizationInfo(serverUrl, realm, authScheme);
- } catch (NoClassDefFoundError e) {
- // The authorization code is not available so just log and continue
- logAuthNotAvailable(e);
- }
- }
-
- private static void logAuthNotAvailable(Throwable e) {
- InternalPlatform.getDefault().log(new Status(IStatus.WARNING, Platform.PI_RUNTIME, 0, Messages.auth_notAvailable, null));
- }
-
- /**
- * Returns the adapter manager used for extending
- * <code>IAdaptable</code> objects.
- *
- * @return the adapter manager for this platform
- * @see IAdapterManager
- * XXX register as a service (same pattern than Jobs)
- * Do we want to make it available as a singleton?
- */
- public static IAdapterManager getAdapterManager() {
- return InternalPlatform.getDefault().getAdapterManager();
- }
-
- /**
- * Returns the authorization information for the specified protection
- * space and given authorization scheme. The protection space is defined
- * by the given server URL and realm. Returns <code>null</code> if no
- * such information exists.
- *
- * @param serverUrl the URL identifying the server for the authorization
- * information. For example, "http://www.example.com/".
- * @param realm the subsection of the given server to which the
- * authorization information applies. For example,
- * "realm1@example.com" or "" for no realm.
- * @param authScheme the scheme for which the authorization information
- * applies. For example, "Basic" or "" for no authorization scheme
- * @return the authorization information for the specified protection
- * space and given authorization scheme, or <code>null</code> if no
- * such information exists
- * @deprecated Authorization database is superseded by the Equinox secure storage.
- * Use <code>org.eclipse.equinox.security.storage.SecurePreferencesFactory</code>
- * to obtain secure preferences and <code>org.eclipse.equinox.security.storage.ISecurePreferences</code>
- * for data access and modifications.
- * Consider using <code>ISecurePreferences#get(String, String)</code> as a replacement of this method.
- */
- public static Map getAuthorizationInfo(URL serverUrl, String realm, String authScheme) {
- try {
- return AuthorizationHandler.getAuthorizationInfo(serverUrl, realm, authScheme);
- } catch (NoClassDefFoundError e) {
- // The authorization code is not available so just log and continue
- logAuthNotAvailable(e);
- }
- return null;
- }
-
- /**
- * Returns the command line args provided to the Eclipse runtime layer when it was first run.
- * The returned value does not include arguments consumed by the lower levels of Eclipse
- * (e.g., OSGi or the launcher).
- * Note that individual platform runnables may be provided with different arguments
- * if they are being run individually rather than with <code>Platform.run()</code>.
- * <p>
- * Clients are also able to acquire the {@link EnvironmentInfo} service and query it for
- * the command-line arguments.
- * </p>
- * @return the command line used to start the platform
- */
- public static String[] getCommandLineArgs() {
- return InternalPlatform.getDefault().getCommandLineArgs();
- }
-
- /**
- * Returns the content type manager.
- * <p>
- * Clients are also able to acquire the {@link IContentTypeManager} service.
- * </p>
- * @return the content type manager
- * @since 3.0
- */
- public static IContentTypeManager getContentTypeManager() {
- return InternalPlatform.getDefault().getContentTypeManager();
- }
-
- /**
- * Returns the identified option. <code>null</code>
- * is returned if no such option is found. Options are specified
- * in the general form <i><plug-in id>/<option-path></i>.
- * For example, <code>org.eclipse.core.runtime/debug</code>
- * <p>
- * Clients are also able to acquire the {@link DebugOptions} service
- * and query it for debug options.
- * </p>
- * @param option the name of the option to lookup
- * @return the value of the requested debug option or <code>null</code>
- */
- public static String getDebugOption(String option) {
- return InternalPlatform.getDefault().getOption(option);
- }
-
- /**
- * Returns the location of the platform working directory.
- * <p>
- * Callers of this method should consider using <code>getInstanceLocation</code>
- * instead. In various, typically non IDE-related configurations of Eclipse, the platform
- * working directory may not be on the local file system. As such, the more general
- * form of this location is as a URL.
- * </p><p>
- * Alternatively, instead of calling <code>getInstanceLocation</code> clients are
- * able to acquire the {@link Location} service (with the type {@link Location#INSTANCE_FILTER})
- * and then change the resulting URL to a path. See the javadoc for <code>getInstanceLocation</code>
- * for more details.
- * </p>
- * @return the location of the platform
- * @see #getInstanceLocation()
- */
- public static IPath getLocation() throws IllegalStateException {
- return InternalPlatform.getDefault().getLocation();
- }
-
- /**
- * Returns the location of the platform log file. This file may contain information
- * about errors that have previously occurred during this invocation of the Platform.
- * <p>
- * It is recommended not to keep this value, as the log location may vary when an instance
- * location is being set.</p>
- * <p>
- * Note: it is very important that users of this method do not leave the log
- * file open for extended periods of time. Doing so may prevent others
- * from writing to the log file, which could result in important error messages
- * being lost. It is strongly recommended that clients wanting to read the
- * log file for extended periods should copy the log file contents elsewhere,
- * and immediately close the original file.</p>
- * @return the path of the log file on disk.
- *
- * XXX consider making an ILogger interface that listeners can implements and it allows
- * us to implement Platform.getLogLocation()
- */
- public static IPath getLogFileLocation() {
- return InternalPlatform.getDefault().getMetaArea().getLogLocation();
- }
-
- /**
- * Returns the plug-in runtime object for the identified plug-in
- * or <code>null</code> if no such plug-in can be found. If
- * the plug-in is defined but not yet activated, the plug-in will
- * be activated before being returned.
- * <p>
- * <b>Note</b>: This method is only able to find and return plug-in
- * objects for plug-ins described using plugin.xml according to the
- * traditional Eclipse conventions. Eclipse 3.0 permits plug-ins to be
- * described in manifest.mf files and to define their own bundle
- * activators. Such plug-ins cannot be discovered by this method.</p>
- *
- * @param id the unique identifier of the desired plug-in
- * (e.g., <code>"com.example.acme"</code>).
- * @return the plug-in runtime object, or <code>null</code>
- * @deprecated
- * This method only works if the compatibility layer is installed and must not be used otherwise.
- * See the comments on {@link IPluginDescriptor#getPlugin()} for details.
- */
- public static Plugin getPlugin(String id) {
- try {
- IPluginRegistry registry = getPluginRegistry();
- if (registry == null)
- throw new IllegalStateException();
- IPluginDescriptor pd = registry.getPluginDescriptor(id);
- if (pd == null)
- return null;
- return pd.getPlugin();
- } catch (CoreException e) {
- // TODO log the exception
- }
- return null;
- }
-
- /**
- * Returns the plug-in registry for this platform.
- *
- * @return the plug-in registry
- * @see IPluginRegistry
- * @deprecated <code>IPluginRegistry</code> was refactored in Eclipse 3.0.
- * This method only works if the compatibility layer is installed and must not be used otherwise.
- * See the comments on {@link IPluginRegistry} and its methods for details.
- */
- public static IPluginRegistry getPluginRegistry() {
- Bundle compatibility = InternalPlatform.getDefault().getBundle(CompatibilityHelper.PI_RUNTIME_COMPATIBILITY);
- if (compatibility == null)
- throw new IllegalStateException();
-
- Class oldInternalPlatform = null;
- try {
- oldInternalPlatform = compatibility.loadClass("org.eclipse.core.internal.plugins.InternalPlatform"); //$NON-NLS-1$
- Method getPluginRegistry = oldInternalPlatform.getMethod("getPluginRegistry", null); //$NON-NLS-1$
- return (IPluginRegistry) getPluginRegistry.invoke(oldInternalPlatform, null);
- } catch (Exception e) {
- //Ignore the exceptions, return null
- }
- return null;
-
- }
-
- /**
- * Returns the location in the local file system of the plug-in
- * state area for the given plug-in.
- * The platform must be running.
- * <p>
- * The plug-in state area is a file directory within the
- * platform's metadata area where a plug-in is free to create files.
- * The content and structure of this area is defined by the plug-in,
- * and the particular plug-in is solely responsible for any files
- * it puts there. It is recommended for plug-in preference settings.
- * </p>
- *
- * @param plugin the plug-in whose state location is returned
- * @return a local file system path
- * @deprecated clients should call <code>getStateLocation</code> instead
- */
- public static IPath getPluginStateLocation(Plugin plugin) {
- return plugin.getStateLocation();
- }
-
- /**
- * Returns the protection space (realm) for the specified resource, or
- * <code>null</code> if the realm is unknown.
- *
- * @param resourceUrl the URL of the resource whose protection space is
- * returned. For example, "http://www.example.com/folder/".
- * @return the protection space (realm) for the specified resource, or
- * <code>null</code> if the realm is unknown
- * @deprecated Authorization database is superseded by the Equinox secure storage.
- * Use <code>org.eclipse.equinox.security.storage.SecurePreferencesFactory</code>
- * to obtain secure preferences and <code>org.eclipse.equinox.security.storage.ISecurePreferences</code>
- * for data access and modifications.
- */
- public static String getProtectionSpace(URL resourceUrl) {
- try {
- return AuthorizationHandler.getProtectionSpace(resourceUrl);
- } catch (NoClassDefFoundError e) {
- // The authorization code is not available so just log and continue
- logAuthNotAvailable(e);
- }
- return null;
- }
-
- /**
- * Removes the indicated (identical) log listener from the notification list
- * of the platform. If no such listener exists, no action is taken.
- *
- * @param listener the listener to de-register
- * @see ILog#removeLogListener(ILogListener)
- * @see #addLogListener(ILogListener)
- * XXX Use the LogMgr service.
- */
- public static void removeLogListener(ILogListener listener) {
- InternalPlatform.getDefault().removeLogListener(listener);
- }
-
- /**
- * Returns a URL which is the resolved equivalent of the
- * supplied URL. This method is expected to be used with the
- * plug-in-relative URLs returned by IPluginDescriptor, Bundle.getEntry()
- * and Platform.find().
- * <p>
- * If the specified URL is not a plug-in-relative URL, it is returned
- * as is. If the specified URL is a plug-in-relative URL, this method
- * attempts to reduce the given URL to one which is native to the Java
- * class library (eg. file, http, etc).
- * </p><p>
- * Note however that users of this API should not assume too much about the
- * results of this method. While it may consistently return a file: URL in certain
- * installation configurations, others may result in jar: or http: URLs.
- * </p>
- * @param url original plug-in-relative URL.
- * @return the resolved URL
- * @exception IOException if unable to resolve URL
- * @see #asLocalURL(URL)
- * @see #find(Bundle, IPath)
- * @see Bundle#getEntry(String)
- * @deprecated use {@link FileLocator#resolve(URL)} instead
- */
- public static URL resolve(URL url) throws IOException {
- return FileLocator.resolve(url);
- }
-
- /**
- * Runs the given runnable in a protected mode. Exceptions
- * thrown in the runnable are logged and passed to the runnable's
- * exception handler. Such exceptions are not rethrown by this method.
- *
- * @param runnable the runnable to run
- * @deprecated clients should use <code>SafeRunner#run</code> instead
- */
- public static void run(ISafeRunnable runnable) {
- SafeRunner.run(runnable);
- }
-
- /**
- * Returns the platform job manager.
- *
- * @return the platform's job manager
- * @since 3.0
- * @deprecated The method {@link Job#getJobManager()} should be used instead.
- */
- public static IJobManager getJobManager() {
- return Job.getJobManager();
- }
-
- /**
- * Returns the extension registry for this platform.
- *
- * @return the extension registry
- * @see IExtensionRegistry
- * @since 3.0
- */
- public static IExtensionRegistry getExtensionRegistry() {
- return InternalPlatform.getDefault().getRegistry();
- }
-
- /**
- * Returns a URL for the given path in the given bundle. Returns <code>null</code> if the URL
- * could not be computed or created.
- *
- * @param bundle the bundle in which to search
- * @param path path relative to plug-in installation location
- * @return a URL for the given path or <code>null</code>. The actual form
- * of the returned URL is not specified.
- * @see #find(Bundle, IPath, Map)
- * @see #resolve(URL)
- * @see #asLocalURL(URL)
- * @since 3.0
- * @deprecated use {@link FileLocator#find(Bundle, IPath, Map)}
- */
- public static URL find(Bundle bundle, IPath path) {
- return FileLocator.find(bundle, path, null);
- }
-
- /**
- * Returns a URL for the given path in the given bundle. Returns <code>null</code> if the URL
- * could not be computed or created.
- * <p>
- * find looks for this path in given bundle and any attached fragments.
- * <code>null</code> is returned if no such entry is found. Note that
- * there is no specific order to the fragments.
- * </p><p>
- * The following arguments may also be used
- * <pre>
- * $nl$ - for language specific information
- * $os$ - for operating system specific information
- * $ws$ - for windowing system specific information
- * </pre>
- * </p><p>
- * A path of $nl$/about.properties in an environment with a default
- * locale of en_CA will return a URL corresponding to the first place
- * about.properties is found according to the following order:
- * <pre>
- * plugin root/nl/en/CA/about.properties
- * fragment1 root/nl/en/CA/about.properties
- * fragment2 root/nl/en/CA/about.properties
- * ...
- * plugin root/nl/en/about.properties
- * fragment1 root/nl/en/about.properties
- * fragment2 root/nl/en/about.properties
- * ...
- * plugin root/about.properties
- * fragment1 root/about.properties
- * fragment2 root/about.properties
- * ...
- * </pre>
- * </p><p>
- * The current environment variable values can be overridden using
- * the override map argument.
- * </p>
- *
- * @param bundle the bundle in which to search
- * @param path file path relative to plug-in installation location
- * @param override map of override substitution arguments to be used for
- * any $arg$ path elements. The map keys correspond to the substitution
- * arguments (eg. "$nl$" or "$os$"). The resulting
- * values must be of type java.lang.String. If the map is <code>null</code>,
- * or does not contain the required substitution argument, the default
- * is used.
- * @return a URL for the given path or <code>null</code>. The actual form
- * of the returned URL is not specified.
- * @see #resolve(URL)
- * @see #asLocalURL(URL)
- * @since 3.0
- * @deprecated use {@link FileLocator#find(Bundle, IPath, Map)} instead
- */
- public static URL find(Bundle bundle, IPath path, Map override) {
- return FileLocator.find(bundle, path, override);
- }
-
- /**
- * Returns the location in the local file system of the
- * plug-in state area for the given bundle.
- * If the plug-in state area did not exist prior to this call,
- * it is created.
- * <p>
- * The plug-in state area is a file directory within the
- * platform's metadata area where a plug-in is free to create files.
- * The content and structure of this area is defined by the plug-in,
- * and the particular plug-in is solely responsible for any files
- * it puts there. It is recommended for plug-in preference settings and
- * other configuration parameters.
- * </p>
- *
- * @param bundle the bundle whose state location if returned
- * @return a local file system path
- * @since 3.0
- * XXX Investigate the usage of a service factory
- */
- public static IPath getStateLocation(Bundle bundle) {
- return InternalPlatform.getDefault().getStateLocation(bundle);
- }
-
- /**
- * Returns a number that changes whenever the set of installed plug-ins
- * changes. This can be used for invalidating caches that are based on
- * the set of currently installed plug-ins. (e.g. extensions)
- * <p>
- * Clients are also able to acquire the {@link PlatformAdmin} service
- * and get the timestamp from its state object.
- * </p>
- * @return a number related to the set of installed plug-ins
- * @since 3.1
- */
- public static long getStateStamp() {
- return InternalPlatform.getDefault().getStateTimeStamp();
- }
-
- /**
- * Returns the log for the given bundle. If no such log exists, one is created.
- *
- * @param bundle the bundle whose log is returned
- * @return the log for the given bundle
- * @since 3.0
- * XXX change this into a LogMgr service that would keep track of the map. See if it can be a service factory.
- * It would contain all the methods that are here.
- * Relate to RuntimeLog if appropriate.
- * The system log listener needs to be optional: turned on or off. What about a system property? :-)
- */
- public static ILog getLog(Bundle bundle) {
- return InternalPlatform.getDefault().getLog(bundle);
- }
-
- /**
- * Returns the given bundle's resource bundle for the current locale.
- * <p>
- * This resource bundle is typically stored as the plugin.properties file
- * in the plug-in itself, and contains any translatable strings used in the
- * plug-in manifest file (plugin.xml).
- * </p>
- * <p>
- * This mechanism is intended only for
- * externalizing strings found in the plug-in manifest file. Using this
- * method for externalizing strings in your code may result in degraded
- * memory performance.
- * </p>
- *
- * @param bundle the bundle whose resource bundle is being queried
- * @return the resource bundle
- * @exception MissingResourceException if the resource bundle was not found
- * @since 3.0
- * XXX this is deprecated. use NLS or BundleFinder.find()
- */
- public static ResourceBundle getResourceBundle(Bundle bundle) throws MissingResourceException {
- return InternalPlatform.getDefault().getResourceBundle(bundle);
- }
-
- /**
- * Returns a resource string corresponding to the given argument value.
- * If the argument value specifies a resource key, the string
- * is looked up in the default resource bundle for the given runtime bundle. If the argument does not
- * specify a valid key, the argument itself is returned as the
- * resource string. The key lookup is performed in the
- * file referenced in the Bundle-Localization header of the bundle manifest. If a resource string
- * corresponding to the key is not found in the resource bundle
- * the key value, or any default text following the key in the
- * argument value is returned as the resource string.
- * A key is identified as a string beginning with the "%" character.
- * Note, that the "%" character is stripped off prior to lookup
- * in the resource bundle.
- * <p>
- * Equivalent to <code>getResourceString(bundle, value, getResourceBundle())</code>
- * </p>
- *
- * @param bundle the bundle whose resource bundle is being queried
- * @param value the value to look for
- * @return the resource string
- * @see #getResourceBundle(Bundle)
- * @since 3.0
- * XXX this is deprecated. use NLS or BundleFinder.find()
- */
- public static String getResourceString(Bundle bundle, String value) {
- return InternalPlatform.getDefault().getResourceString(bundle, value);
- }
-
- /**
- * Returns a resource string corresponding to the given argument
- * value and resource bundle in the given runtime bundle.
- * If the argument value specifies a resource key, the string
- * is looked up in the given resource bundle. If the argument does not
- * specify a valid key, the argument itself is returned as the
- * resource string. The key lookup is performed against the
- * specified resource bundle. If a resource string
- * corresponding to the key is not found in the resource bundle
- * the key value, or any default text following the key in the
- * argument value is returned as the resource string.
- * A key is identified as a string beginning with the "%" character.
- * Note that the "%" character is stripped off prior to lookup
- * in the resource bundle.
- * <p>
- * For example, assume resource bundle plugin.properties contains
- * name = Project Name
- * <pre>
- * getResourceString("Hello World") returns "Hello World"</li>
- * getResourceString("%name") returns "Project Name"</li>
- * getResourceString("%name Hello World") returns "Project Name"</li>
- * getResourceString("%abcd Hello World") returns "Hello World"</li>
- * getResourceString("%abcd") returns "%abcd"</li>
- * getResourceString("%%name") returns "%name"</li>
- * </pre>
- * </p>
- *
- * @param bundle the bundle whose resource bundle is being queried
- * @param value the value
- * @param resourceBundle the resource bundle to query
- * @return the resource string
- * @see #getResourceBundle(Bundle)
- * @since 3.0
- * XXX this is deprecated. use NLS or BundleFinder.find()
- */
- public static String getResourceString(Bundle bundle, String value, ResourceBundle resourceBundle) {
- return InternalPlatform.getDefault().getResourceString(bundle, value, resourceBundle);
- }
-
- /**
- * Returns the string name of the current system architecture.
- * The value is a user-defined string if the architecture is
- * specified on the command line, otherwise it is the value
- * returned by <code>java.lang.System.getProperty("os.arch")</code>.
- * <p>
- * Clients are also able to acquire the {@link EnvironmentInfo} service and query it for
- * the operating-system architecture.
- * </p>
- * @return the string name of the current system architecture
- * @since 3.0
- */
- public static String getOSArch() {
- return InternalPlatform.getDefault().getOSArch();
- }
-
- /**
- * Returns the string name of the current locale for use in finding files
- * whose path starts with <code>$nl$</code>.
- * <p>
- * Clients are also able to acquire the {@link EnvironmentInfo} service and query it for
- * the NL.
- * </p>
- * @return the string name of the current locale
- * @since 3.0
- */
- public static String getNL() {
- return InternalPlatform.getDefault().getNL();
- }
-
- /**
- * Returns the string name of the current operating system for use in finding
- * files whose path starts with <code>$os$</code>. <code>OS_UNKNOWN</code> is
- * returned if the operating system cannot be determined.
- * The value may indicate one of the operating systems known to the platform
- * (as specified in <code>knownOSValues</code>) or a user-defined string if
- * the operating system name is specified on the command line.
- * <p>
- * Clients are also able to acquire the {@link EnvironmentInfo} service and query it for
- * the operating-system.
- * </p>
- * @return the string name of the current operating system
- * @since 3.0
- */
- public static String getOS() {
- return InternalPlatform.getDefault().getOS();
- }
-
- /**
- * Returns the string name of the current window system for use in finding files
- * whose path starts with <code>$ws$</code>. <code>null</code> is returned
- * if the window system cannot be determined.
- * <p>
- * Clients are also able to acquire the {@link EnvironmentInfo} service and query it for
- * the windowing system.
- * </p>
- * @return the string name of the current window system or <code>null</code>
- * @since 3.0
- */
- public static String getWS() {
- return InternalPlatform.getDefault().getWS();
- }
-
- /**
- * Returns the arguments not consumed by the framework implementation itself. Which
- * arguments are consumed is implementation specific. These arguments are available
- * for use by the application.
- *
- * @return the array of command line arguments not consumed by the framework.
- * @since 3.0
- * XXX Use the Environment info service. Need to see how to set the value of the app args.
- */
- public static String[] getApplicationArgs() {
- return InternalPlatform.getDefault().getApplicationArgs();
- }
-
- /**
- * Returns the platform administrator for this running Eclipse.
- * <p>
- * Note: This is an internal method and <em>must not</em>
- * be used by clients which are not part of the Eclipse Platform.
- * This method allows access to classes which are not Eclipse
- * Platform API but are part of the OSGi runtime that the Eclipse
- * Platform is built on. Even as the Eclipse Platform evolves
- * in compatible ways from release to release, the details of
- * the OSGi implementation might not.
- * </p><p>
- * Clients can also acquire the {@link PlatformAdmin} service
- * to retrieve this object.
- * </p>
- * @return the platform admin for this instance of Eclipse
- * @since 3.0
- */
- public static PlatformAdmin getPlatformAdmin() {
- return InternalPlatform.getDefault().getPlatformAdmin();
- }
-
- /**
- * Returns the location of the platform's working directory (also known as the instance data area).
- * <code>null</code> is returned if the platform is running without an instance location.
- * <p>
- * This method is equivalent to acquiring the <code>org.eclipse.osgi.service.datalocation.Location</code>
- * service with the property "type" equal to {@link Location#INSTANCE_FILTER}.
- *</p>
- * @return the location of the platform's instance data area or <code>null</code> if none
- * @since 3.0
- * @see Location#INSTANCE_FILTER
- */
- public static Location getInstanceLocation() {
- return InternalPlatform.getDefault().getInstanceLocation();
- }
-
- /**
- * Returns the currently registered bundle group providers.
- * <p>
- * Clients are also able to acquire the {@link IBundleGroupProvider} service and query it for
- * the registered bundle group providers.
- * </p>
- * @return the currently registered bundle group providers
- * @since 3.0
- */
- public static IBundleGroupProvider[] getBundleGroupProviders() {
- return InternalPlatform.getDefault().getBundleGroupProviders();
- }
-
- /**
- * Return the interface into the preference mechanism. The returned
- * object can be used for such operations as searching for preference
- * values across multiple scopes and preference import/export.
- * <p>
- * Clients are also able to acquire the {@link IPreferencesService} service via
- * OSGi mechanisms and use it for preference functions.
- * </p>
- * @return an object to interface into the preference mechanism
- * @since 3.0
- */
- public static IPreferencesService getPreferencesService() {
- return InternalPlatform.getDefault().getPreferencesService();
- }
-
- /**
- * Returns the product which was selected when running this Eclipse instance
- * or <code>null</code> if none
- * @return the current product or <code>null</code> if none
- * @since 3.0
- * XXX move this into the app model.
- */
- public static IProduct getProduct() {
- return InternalPlatform.getDefault().getProduct();
- }
-
- /**
- * Registers the given bundle group provider with the platform.
- * <p>
- * Clients are also able to use the {@link IBundleGroupProvider} service to
- * register themselves as a bundle group provider.
- * </p>
- * @param provider a provider to register
- * @since 3.0
- */
- public static void registerBundleGroupProvider(IBundleGroupProvider provider) {
- InternalPlatform.getDefault().registerBundleGroupProvider(provider);
- }
-
- /**
- * De-registers the given bundle group provider with the platform.
- * <p>
- * Clients are also able to use the {@link IBundleGroupProvider} service mechanism
- * for unregistering themselves.
- * </p>
- * @param provider a provider to de-register
- * @since 3.0
- * @see #registerBundleGroupProvider(IBundleGroupProvider)
- */
- public static void unregisterBundleGroupProvider(IBundleGroupProvider provider) {
- InternalPlatform.getDefault().unregisterBundleGroupProvider(provider);
- }
-
- /**
- * Returns the location of the configuration information
- * used to run this instance of Eclipse. The configuration area typically
- * contains the list of plug-ins available for use, various settings
- * (those shared across different instances of the same configuration)
- * and any other such data needed by plug-ins.
- * <code>null</code> is returned if the platform is running without a configuration location.
- * <p>
- * This method is equivalent to acquiring the <code>org.eclipse.osgi.service.datalocation.Location</code>
- * service with the property "type" equal to {@link Location#CONFIGURATION_FILTER}.
- *</p>
- * @return the location of the platform's configuration data area or <code>null</code> if none
- * @since 3.0
- * @see Location#CONFIGURATION_FILTER
- */
- public static Location getConfigurationLocation() {
- return InternalPlatform.getDefault().getConfigurationLocation();
- }
-
- /**
- * Returns the location of the platform's user data area. The user data area is a location on the system
- * which is specific to the system's current user. By default it is located relative to the
- * location given by the System property "user.home".
- * <code>null</code> is returned if the platform is running without an user location.
- * <p>
- * This method is equivalent to acquiring the <code>org.eclipse.osgi.service.datalocation.Location</code>
- * service with the property "type" equal to {@link Location#USER_FILTER}.
- *</p>
- * @return the location of the platform's user data area or <code>null</code> if none
- * @since 3.0
- * @see Location#USER_FILTER
- */
- public static Location getUserLocation() {
- return InternalPlatform.getDefault().getUserLocation();
- }
-
- /**
- * Returns the location of the base installation for the running platform
- * <code>null</code> is returned if the platform is running without a configuration location.
- * <p>
- * This method is equivalent to acquiring the <code>org.eclipse.osgi.service.datalocation.Location</code>
- * service with the property "type" equal to {@link Location#INSTALL_FILTER}.
- *</p>
- * @return the location of the platform's installation area or <code>null</code> if none
- * @since 3.0
- * @see Location#INSTALL_FILTER
- */
- public static Location getInstallLocation() {
- return InternalPlatform.getDefault().getInstallLocation();
- }
-
- /**
- * Checks if the specified bundle is a fragment bundle.
- * <p>
- * Clients are also able to acquire the {@link PackageAdmin} service
- * to query if the given bundle is a fragment by asking for the bundle type
- * and checking against constants on the service interface.
- * </p>
- * @param bundle the bundle to query
- * @return true if the specified bundle is a fragment bundle; otherwise false is returned.
- * @since 3.0
- */
- public static boolean isFragment(Bundle bundle) {
- return InternalPlatform.getDefault().isFragment(bundle);
- }
-
- /**
- * Returns an array of attached fragment bundles for the specified bundle. If the
- * specified bundle is a fragment then <tt>null</tt> is returned. If no fragments are
- * attached to the specified bundle then <tt>null</tt> is returned.
- * <p>
- * Clients are also able to acquire the {@link PackageAdmin} service and query
- * it for the fragments of the given bundle.
- * </p>
- * @param bundle the bundle to get the attached fragment bundles for.
- * @return an array of fragment bundles or <tt>null</tt> if the bundle does not
- * have any attached fragment bundles.
- * @since 3.0
- */
- public static Bundle[] getFragments(Bundle bundle) {
- return InternalPlatform.getDefault().getFragments(bundle);
- }
-
- /**
- * Returns the resolved bundle with the specified symbolic name that has the
- * highest version. If no resolved bundles are installed that have the
- * specified symbolic name then null is returned.
- * <p>
- * Clients are also able to acquire the {@link PackageAdmin} service and query
- * it for the bundle with the specified symbolic name. Clients can ask the
- * service for all bundles with that particular name and then determine the
- * one with the highest version. Note that clients may want to filter
- * the results based on the state of the bundles.
- * </p>
- * @param symbolicName the symbolic name of the bundle to be returned.
- * @return the bundle that has the specified symbolic name with the
- * highest version, or <tt>null</tt> if no bundle is found.
- * @since 3.0
- */
- public static Bundle getBundle(String symbolicName) {
- return InternalPlatform.getDefault().getBundle(symbolicName);
- }
-
- /**
- * Returns all bundles with the specified symbolic name. If no resolved bundles
- * with the specified symbolic name can be found, <tt>null</tt> is returned.
- * If the version argument is not null then only the Bundles that have
- * the specified symbolic name and a version greater than or equal to the
- * specified version are returned. The returned bundles are ordered in
- * descending bundle version order.
- * <p>
- * Clients are also able to acquire the {@link PackageAdmin} service and query
- * it for all bundle versions with the given symbolic name, after turning the
- * specific version into a version range. Note that clients may want to filter
- * the results based on the state of the bundles.
- * </p>
- * @param symbolicName the symbolic name of the bundles that are to be returned.
- * @param version the version that the return bundle versions must match,
- * or <tt>null</tt> if no version matching is to be done.
- * @return the array of Bundles with the specified name that match the
- * specified version and match rule, or <tt>null</tt> if no bundles are found.
- */
- public static Bundle[] getBundles(String symbolicName, String version) {
- return InternalPlatform.getDefault().getBundles(symbolicName, version);
- }
-
- /**
- * Returns an array of host bundles that the specified fragment bundle is
- * attached to or <tt>null</tt> if the specified bundle is not attached to a host.
- * If the bundle is not a fragment bundle then <tt>null</tt> is returned.
- * <p>
- * Clients are also able to acquire the {@link PackageAdmin} service and query
- * it for the hosts for the given bundle.
- * </p>
- * @param bundle the bundle to get the host bundles for.
- * @return an array of host bundles or null if the bundle does not have any
- * host bundles.
- * @since 3.0
- */
- public static Bundle[] getHosts(Bundle bundle) {
- return InternalPlatform.getDefault().getHosts(bundle);
- }
-
- /**
- * Returns whether the platform is running.
- *
- * @return <code>true</code> if the platform is running,
- * and <code>false</code> otherwise
- *@since 3.0
- *XXX do what you want to do. track osgi, track runtime, or whatever.
- */
- public static boolean isRunning() {
- return InternalPlatform.getDefault().isRunning();
- }
-
- /**
- * Returns a list of known system architectures.
- * <p>
- * Note that this list is not authoritative; there may be legal values
- * not included in this list. Indeed, the value returned by
- * <code>getOSArch</code> may not be in this list. Also, this list may
- * change over time as Eclipse comes to run on more operating environments.
- * </p>
- *
- * @return the list of system architectures known to the system
- * @see #getOSArch()
- * @since 3.0
- * XXX This is useless
- */
- public static String[] knownOSArchValues() {
- return InternalPlatform.getDefault().knownOSArchValues();
- }
-
- /**
- * Returns a list of known operating system names.
- * <p>
- * Note that this list is not authoritative; there may be legal values
- * not included in this list. Indeed, the value returned by
- * <code>getOS</code> may not be in this list. Also, this list may
- * change over time as Eclipse comes to run on more operating environments.
- * </p>
- *
- * @return the list of operating systems known to the system
- * @see #getOS()
- * @since 3.0
- * XXX This is useless
- */
- public static String[] knownOSValues() {
- return InternalPlatform.getDefault().knownOSValues();
- }
-
- /**
- * Returns a map of known platform line separators. The keys are
- * translated names of platforms and the values are their associated
- * line separator strings.
- *
- * @return a map of platform to their line separator string
- * @since 3.1
- */
- public static Map knownPlatformLineSeparators() {
- Map result = new HashMap();
- result.put(LINE_SEPARATOR_KEY_MAC_OS_9, LINE_SEPARATOR_VALUE_CR);
- result.put(LINE_SEPARATOR_KEY_UNIX, LINE_SEPARATOR_VALUE_LF);
- result.put(LINE_SEPARATOR_KEY_WINDOWS, LINE_SEPARATOR_VALUE_CRLF);
- return result;
- }
-
- /**
- * Returns a list of known windowing system names.
- * <p>
- * Note that this list is not authoritative; there may be legal values
- * not included in this list. Indeed, the value returned by
- * <code>getWS</code> may not be in this list. Also, this list may
- * change over time as Eclipse comes to run on more operating environments.
- * </p>
- *
- * @return the list of window systems known to the system
- * @see #getWS()
- * @since 3.0
- * XXX This is useless
- */
- public static String[] knownWSValues() {
- return InternalPlatform.getDefault().knownWSValues();
- }
-
- /**
- * Returns <code>true</code> if the platform is currently running in
- * debug mode. The platform is typically put in debug mode using the
- * "-debug" command line argument.
- * <p>
- * Clients are also able to acquire the {@link EnvironmentInfo} service and query it
- * to see if they are in debug mode.
- * </p>
- * @return whether or not the platform is running in debug mode
- * @since 3.0
- */
- public static boolean inDebugMode() {
- return PlatformActivator.getContext().getProperty("osgi.debug") != null; //$NON-NLS-1$
- }
-
- /**
- * Returns <code>true</code> if the platform is currently running in
- * development mode. That is, if special procedures are to be
- * taken when defining plug-in class paths. The platform is typically put in
- * development mode using the "-dev" command line argument.
- * <p>
- * Clients are also able to acquire the {@link EnvironmentInfo} service and query it
- * to see if they are in development mode.
- * </p>
- * @return whether or not the platform is running in development mode
- * @since 3.0
- */
- public static boolean inDevelopmentMode() {
- return PlatformActivator.getContext().getProperty("osgi.dev") != null; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Plugin.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Plugin.java
deleted file mode 100644
index 1db3d68..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Plugin.java
+++ /dev/null
@@ -1,764 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.Map;
-import org.eclipse.core.internal.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.*;
-
-/**
- * The abstract superclass of all plug-in runtime class
- * implementations. A plug-in subclasses this class and overrides
- * the appropriate life cycle methods in order to react to the life cycle
- * requests automatically issued by the platform.
- * For compatibility reasons, the methods called for those life cycle events
- * vary, please see the "Constructors and life cycle methods" section below.
- *
- * <p>
- * Conceptually, the plug-in runtime class represents the entire plug-in
- * rather than an implementation of any one particular extension the
- * plug-in declares. A plug-in is not required to explicitly
- * specify a plug-in runtime class; if none is specified, the plug-in
- * will be given a default plug-in runtime object that ignores all life
- * cycle requests (it still provides access to the corresponding
- * plug-in descriptor).
- * </p>
- * <p>
- * In the case of more complex plug-ins, it may be desirable
- * to define a concrete subclass of <code>Plugin</code>.
- * However, just subclassing <code>Plugin</code> is not
- * sufficient. The name of the class must be explicitly configured
- * in the plug-in's manifest (<code>plugin.xml</code>) file
- * with the class attribute of the <code><plugin></code> element markup.
- * </p>
- * <p>
- * Instances of plug-in runtime classes are automatically created
- * by the platform in the course of plug-in activation. For compatibility reasons,
- * the constructor used to create plug-in instances varies, please see the "Constructors
- * and life cycle methods" section below.
- * </p><p>
- * The concept of bundles underlies plug-ins. However it is safe to regard plug-ins
- * and bundles as synonyms.
- * </p>
- * <p>
- * <b>Clients must never explicitly instantiate a plug-in runtime class</b>.
- * </p>
- * <p>
- * A typical implementation pattern for plug-in runtime classes is to
- * provide a static convenience method to gain access to a plug-in's
- * runtime object. This way, code in other parts of the plug-in
- * implementation without direct access to the plug-in runtime object
- * can easily obtain a reference to it, and thence to any plug-in-wide
- * resources recorded on it. An example for Eclipse 3.0 follows:
- * <pre>
- * package myplugin;
- * public class MyPluginClass extends Plugin {
- * private static MyPluginClass instance;
- *
- * public static MyPluginClass getInstance() { return instance; }
- *
- * public void MyPluginClass() {
- * super();
- * instance = this;
- * // ... other initialization
- * }
- * // ... other methods
- * }
- * </pre>
- * In the above example, a call to <code>MyPluginClass.getInstance()</code>
- * will always return an initialized instance of <code>MyPluginClass</code>.
- * </p>
- * <p>
- * <b>Constructors and life cycle methods</b>
- * </p><p>
- * If the plugin.xml of a plug-in indicates <?eclipse version="3.0"?> and its prerequisite
- * list includes <code>org.eclipse.core.runtime</code>, the default constructor of the plug-in
- * class is used and {@link #start(BundleContext)} and {@link #stop(BundleContext)} are
- * called as life cycle methods.
- * </p><p>
- * If the plugin.xml of a plug-in indicates <?eclipse version="3.0"?> and its prerequisite list includes
- * <code>org.eclipse.core.runtime.compatibility</code>, the {@link #Plugin(IPluginDescriptor)}
- * constructor is used and {@link #startup()} and {@link #shutdown()} are called as life cycle methods.
- * Note that in this situation, start() is called before startup() and stop() is called
- * after shutdown.
- * </p><p>
- * If the plugin.xml of your plug-in does <b>not</b> indicate <?eclipse version="3.0"?> it is therefore
- * not a 3.0 plug-in. Consequently the {@link #Plugin(IPluginDescriptor)} is used and {@link #startup()} and
- * {@link #shutdown()} are called as life cycle methods.
- * </p><p>
- * Since Eclipse 3.0 APIs of the Plugin class can be called only when the Plugin is in an active state, i.e.,
- * after it was started up and before it is shutdown. In particular, it means that Plugin APIs should not
- * be called from overrides of {@link #Plugin()}.
- * </p>
- */
-public abstract class Plugin implements BundleActivator {
-
- /**
- * String constant used for the default scope name for legacy
- * Eclipse plug-in preferences. The value of <code>PLUGIN_PREFERENCE_SCOPE</code> should
- * match the InstanceScope's variable SCOPE from org.eclipse.core.runtime.preferences.
- * The value is copied in this file to prevent unnecessary activation of
- * the Preferences plugin on startup.
- *
- * @since 3.0
- */
- public static final String PLUGIN_PREFERENCE_SCOPE = "instance"; //$NON-NLS-1$
-
- /**
- * The bundle associated this plug-in
- */
- private Bundle bundle;
-
- /**
- * The debug flag for this plug-in. The flag is false by default.
- * It can be set to true either by the plug-in itself or in the platform
- * debug options.
- */
- private boolean debug = false;
-
- /** The plug-in descriptor.
- * @deprecated Marked as deprecated to suppress deprecation warnings.
- */
- private IPluginDescriptor descriptor;
-
- /**
- * The base name (value <code>"preferences"</code>) for the file which is used for
- * overriding default preference values.
- *
- * @since 2.0
- * @see #PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME
- */
- public static final String PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME = "preferences"; //$NON-NLS-1$
-
- /**
- * The name of the file (value <code>"preferences.ini"</code>) in a
- * plug-in's (read-only) directory that, when present, contains values that
- * override the normal default values for this plug-in's preferences.
- * <p>
- * The format of the file is as per <code>java.io.Properties</code> where
- * the keys are property names and values are strings.
- * </p>
- *
- * @since 2.0
- */
- public static final String PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME = PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME + ".ini"; //$NON-NLS-1$
-
- /**
- * The preference object for this plug-in; initially <code>null</code>
- * meaning not yet created and initialized.
- *
- * @since 2.0
- */
- private Preferences preferences = null;
-
- /**
- * Creates a new plug-in runtime object. This method is called by the platform
- * if this class is used as a <code>BundleActivator</code>. This method is not
- * needed/used if this plug-in requires the org.eclipse.core.runtime.compatibility plug-in.
- * Subclasses of <code>Plugin</code>
- * must call this method first in their constructors.
- *
- * The resultant instance is not managed by the runtime and
- * so should be remembered by the client (typically using a Singleton pattern).
- * <b>Clients must never explicitly call this method.</b>
- * </p>
- * <p>
- * Note: The class loader typically has monitors acquired during invocation of this method. It is
- * strongly recommended that this method avoid synchronized blocks or other thread locking mechanisms,
- * as this would lead to deadlock vulnerability.
- * </p>
- *
- * @since 3.0
- */
- public Plugin() {
- super();
- }
-
- /**
- * Creates a new plug-in runtime object for the given plug-in descriptor.
- * <p>
- * Instances of plug-in runtime classes are automatically created
- * by the platform in the course of plug-in activation.
- * <b>Clients must never explicitly call this method.</b>
- * </p>
- * <p>
- * Note: The class loader typically has monitors acquired during invocation of this method. It is
- * strongly recommended that this method avoid synchronized blocks or other thread locking mechanisms,
- * as this would lead to deadlock vulnerability.
- * </p>
- *
- * @param descriptor the plug-in descriptor
- * @see #getDescriptor()
- * @deprecated
- * In Eclipse 3.0 this constructor has been replaced by {@link #Plugin()}.
- * Implementations of <code>MyPlugin(IPluginDescriptor descriptor)</code> should be changed to
- * <code>MyPlugin()</code> and call <code>super()</code> instead of <code>super(descriptor)</code>.
- * The <code>MyPlugin(IPluginDescriptor descriptor)</code> constructor is called only for plug-ins
- * which explicitly require the org.eclipse.core.runtime.compatibility plug-in.
- */
- public Plugin(IPluginDescriptor descriptor) {
- Assert.isNotNull(descriptor);
- Assert.isTrue(!CompatibilityHelper.hasPluginObject(descriptor), NLS.bind(Messages.plugin_deactivatedLoad, this.getClass().getName(), descriptor.getUniqueIdentifier() + " is not activated")); //$NON-NLS-1$
- this.descriptor = descriptor;
-
- // on plugin start, find and start the corresponding bundle.
- bundle = InternalPlatform.getDefault().getBundle(descriptor.getUniqueIdentifier());
- try {
- InternalPlatform.start(bundle);
- } catch (BundleException e) {
- String message = NLS.bind(Messages.plugin_startupProblems, descriptor.getUniqueIdentifier());
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, message, e);
- InternalPlatform.getDefault().log(status);
- }
- }
-
- /**
- * Returns a URL for the given path. Returns <code>null</code> if the URL
- * could not be computed or created.
- *
- * @param path path relative to plug-in installation location
- * @return a URL for the given path or <code>null</code>
- * @deprecated use {@link FileLocator#find(Bundle, IPath, Map)}
- */
- public final URL find(IPath path) {
- return FileLocator.find(bundle, path, null);
- }
-
- /**
- * Returns a URL for the given path. Returns <code>null</code> if the URL
- * could not be computed or created.
- *
- * @param path file path relative to plug-in installation location
- * @param override map of override substitution arguments to be used for
- * any $arg$ path elements. The map keys correspond to the substitution
- * arguments (eg. "$nl$" or "$os$"). The resulting
- * values must be of type java.lang.String. If the map is <code>null</code>,
- * or does not contain the required substitution argument, the default
- * is used.
- * @return a URL for the given path or <code>null</code>
- * @deprecated use {@link FileLocator#find(Bundle, IPath, Map)}
- */
- public final URL find(IPath path, Map override) {
- return FileLocator.find(bundle, path, override);
- }
-
- /**
- * Returns the plug-in descriptor for this plug-in runtime object.
- *
- * @return the plug-in descriptor for this plug-in runtime object
- * @deprecated
- * <code>IPluginDescriptor</code> was refactored in Eclipse 3.0.
- * The <code>getDescriptor()</code> method may only be called by plug-ins
- * which explicitly require the org.eclipse.core.runtime.compatibility plug-in.
- * See the comments on {@link IPluginDescriptor} and its methods for details.
- */
- public final IPluginDescriptor getDescriptor() {
- if (descriptor != null)
- return descriptor;
-
- return initializeDescriptor(bundle.getSymbolicName());
- }
-
- /**
- * Returns the log for this plug-in. If no such log exists, one is created.
- *
- * @return the log for this plug-in
- * XXX change this into a LogMgr service that would keep track of the map. See if it can be a service factory.
- */
- public final ILog getLog() {
- return InternalPlatform.getDefault().getLog(bundle);
- }
-
- /**
- * Returns the location in the local file system of the
- * plug-in state area for this plug-in.
- * If the plug-in state area did not exist prior to this call,
- * it is created.
- * <p>
- * The plug-in state area is a file directory within the
- * platform's metadata area where a plug-in is free to create files.
- * The content and structure of this area is defined by the plug-in,
- * and the particular plug-in is solely responsible for any files
- * it puts there. It is recommended for plug-in preference settings and
- * other configuration parameters.
- * </p>
- * @throws IllegalStateException, when the system is running with no data area (-data @none),
- * or when a data area has not been set yet.
- * @return a local file system path
- * XXX Investigate the usage of a service factory (see also platform.getStateLocation)
- */
- public final IPath getStateLocation() throws IllegalStateException {
- return InternalPlatform.getDefault().getStateLocation(bundle, true);
- }
-
- /**
- * Returns the preference store for this plug-in.
- * <p>
- * Note that if an error occurs reading the preference store from disk, an empty
- * preference store is quietly created, initialized with defaults, and returned.
- * </p>
- * <p>
- * Calling this method may cause the preference store to be created and
- * initialized. Subclasses which reimplement the
- * <code>initializeDefaultPluginPreferences</code> method have this opportunity
- * to initialize preference default values, just prior to processing override
- * default values imposed externally to this plug-in (specified for the product,
- * or at platform start up).
- * </p>
- * <p>
- * After settings in the preference store are changed (for example, with
- * <code>Preferences.setValue</code> or <code>setToDefault</code>),
- * <code>savePluginPreferences</code> should be called to store the changed
- * values back to disk. Otherwise the changes will be lost on plug-in
- * shutdown.
- * </p>
- *
- * @return the preference store
- * @see #savePluginPreferences()
- * @see Preferences#setValue(String, String)
- * @see Preferences#setToDefault(String)
- * @since 2.0
- * XXX deprecate since this does not leverage the config, project scopes, etc...
- */
- public final Preferences getPluginPreferences() {
- if (preferences != null) {
- if (InternalPlatform.DEBUG_PLUGIN_PREFERENCES)
- InternalPlatform.message("Plugin preferences already loaded for: " + bundle.getSymbolicName()); //$NON-NLS-1$
- return preferences;
- }
-
- if (InternalPlatform.DEBUG_PLUGIN_PREFERENCES)
- InternalPlatform.message("Loading preferences for plugin: " + bundle.getSymbolicName()); //$NON-NLS-1$
-
- // Performance: isolate PreferenceForwarder into an inner class so that it mere presence
- // won't force the PreferenceForwarder class to be loaded (which triggers Preferences plugin
- // activation).
- final Bundle bundleCopy = bundle;
- final Preferences[] preferencesCopy = new Preferences[1];
- Runnable innerCall = new Runnable() {
- public void run() {
- preferencesCopy[0] = new org.eclipse.core.internal.preferences.legacy.PreferenceForwarder(this, bundleCopy.getSymbolicName());
- }
- };
- innerCall.run();
- preferences = preferencesCopy[0];
- return preferences;
- }
-
- /**
- * Saves preferences settings for this plug-in. Does nothing if the preference
- * store does not need saving.
- * <p>
- * Plug-in preferences are <b>not</b> saved automatically on plug-in shutdown.
- * </p>
- *
- * @see Preferences#store(OutputStream, String)
- * @see Preferences#needsSaving()
- * @since 2.0
- * XXX deprecate call flush on the node for this bundle on the instance scope
- */
- public final void savePluginPreferences() {
- // populate the "preferences" instvar. We still might
- // need to save them because someone else might have
- // made changes via the OSGi APIs.
- getPluginPreferences();
-
- // Performance: isolate PreferenceForwarder and BackingStoreException into
- // an inner class to avoid class loading (and then activation of the Preferences plugin)
- // as the Plugin class is loaded.
- final Preferences preferencesCopy = preferences;
- Runnable innerCall = new Runnable() {
- public void run() {
- try {
- ((org.eclipse.core.internal.preferences.legacy.PreferenceForwarder) preferencesCopy).flush();
- } catch (org.osgi.service.prefs.BackingStoreException e) {
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, Messages.preferences_saveProblems, e);
- InternalPlatform.getDefault().log(status);
- }
- }
- };
- innerCall.run();
- }
-
- /**
- * Initializes the default preferences settings for this plug-in.
- * <p>
- * This method is called sometime after the preference store for this
- * plug-in is created. Default values are never stored in preference
- * stores; they must be filled in each time. This method provides the
- * opportunity to initialize the default values.
- * </p>
- * <p>
- * The default implementation of this method does nothing. A subclass that needs
- * to set default values for its preferences must reimplement this method.
- * Default values set at a later point will override any default override
- * settings supplied from outside the plug-in (product configuration or
- * platform start up).
- * </p>
- * @since 2.0
- * @deprecated
- * This method has been refactored in the new preference mechanism
- * to handle the case where the runtime compatibility layer does not exist. The
- * contents of this method should be moved to the method named
- * <code>initializeDefaultPreferences</code> in a separate subclass of
- * {@link org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer}.
- * This class should be contributed via the
- * <code>org.eclipse.core.runtime.preferences</code> extension point.
- * <pre>
- * <extension point=&quo;org.eclipse.core.runtime.preferences&quo;>
- * <initializer class=&quo;com.example.MyPreferenceInitializer&quo;/>
- * </extension>
- * ...
- * package com.example;
- * public class MyPreferenceInitializer extends AbstractPreferenceInitializer {
- * public MyPreferenceInitializer() {
- * super();
- * }
- * public void initializeDefaultPreferences() {
- * Preferences node = new DefaultScope().getNode("my.plugin.id");
- * node.put(key, value);
- * }
- * }
- * </pre>
- */
- protected void initializeDefaultPluginPreferences() {
- // default implementation of this method - spec'd to do nothing
- }
-
- /**
- * Internal method. This method is a hook for
- * initialization of default preference values.
- * It should not be called by clients.
- *
- * @since 3.0
- */
- public final void internalInitializeDefaultPluginPreferences() {
- initializeDefaultPluginPreferences();
- }
-
- /**
- * Returns whether this plug-in is in debug mode.
- * By default plug-ins are not in debug mode. A plug-in can put itself
- * into debug mode or the user can set an execution option to do so.
- * <p>
- * Note that the plug-in's debug flag is initialized when the
- * plug-in is started. The result of calling this method before the plug-in
- * has started is unspecified.
- * </p>
- *
- * @return whether this plug-in is in debug mode
- * XXX deprecate use the service and cache as needed
- */
- public boolean isDebugging() {
- return debug;
- }
-
- /**
- * Returns an input stream for the specified file. The file path
- * must be specified relative this the plug-in's installation location.
- *
- * @param file path relative to plug-in installation location
- * @return an input stream
- * @exception IOException if the given path cannot be found in this plug-in
- *
- * @see #openStream(IPath,boolean)
- * @deprecated use {@link FileLocator#openStream(Bundle, IPath, boolean)}
- */
- public final InputStream openStream(IPath file) throws IOException {
- return FileLocator.openStream(bundle, file, false);
- }
-
- /**
- * Returns an input stream for the specified file. The file path
- * must be specified relative to this plug-in's installation location.
- * Optionally, the path specified may contain $arg$ path elements that can
- * be used as substitution arguments. If this option is used then the $arg$
- * path elements are processed in the same way as {@link #find(IPath, Map)}.
- * <p>
- * The caller must close the returned stream when done.
- * </p>
- *
- * @param file path relative to plug-in installation location
- * @param substituteArgs <code>true</code> to process substitution arguments,
- * and <code>false</code> for the file exactly as specified without processing any
- * substitution arguments.
- * @return an input stream
- * @exception IOException if the given path cannot be found in this plug-in
- * @deprecated use {@link FileLocator#openStream(Bundle, IPath, boolean)}
- */
- public final InputStream openStream(IPath file, boolean substituteArgs) throws IOException {
- return FileLocator.openStream(bundle, file, substituteArgs);
- }
-
- /**
- * Sets whether this plug-in is in debug mode.
- * By default plug-ins are not in debug mode. A plug-in can put itself
- * into debug mode or the user can set a debug option to do so.
- * <p>
- * Note that the plug-in's debug flag is initialized when the
- * plug-in is started. The result of calling this method before the plug-in
- * has started is unspecified.
- * </p>
- *
- * @param value whether or not this plug-in is in debug mode
- * XXX deprecate use the service and cache as needed
- */
- public void setDebugging(boolean value) {
- debug = value;
- }
-
- /**
- * Shuts down this plug-in and discards all plug-in state.
- * <p>
- * This method should be re-implemented in subclasses that need to do something
- * when the plug-in is shut down. Implementors should call the inherited method
- * to ensure that any system requirements can be met.
- * </p>
- * <p>
- * Plug-in shutdown code should be robust. In particular, this method
- * should always make an effort to shut down the plug-in. Furthermore,
- * the code should not assume that the plug-in was started successfully,
- * as this method will be invoked in the event of a failure during startup.
- * </p>
- * <p>
- * Note 1: If a plug-in has been started, this method will be automatically
- * invoked by the platform when the platform is shut down.
- * </p>
- * <p>
- * Note 2: This method is intended to perform simple termination
- * of the plug-in environment. The platform may terminate invocations
- * that do not complete in a timely fashion.
- * </p>
- * <b>Clients must never explicitly call this method.</b>
- * <p>
- *
- * @exception CoreException if this method fails to shut down
- * this plug-in
- * @deprecated
- * In Eclipse 3.0 this method has been replaced by {@link Plugin#stop(BundleContext context)}.
- * Implementations of <code>shutdown()</code> should be changed to override
- * <code>stop(BundleContext context)</code> and call <code>super.stop(context)</code>
- * instead of <code>super.shutdown()</code>.
- * The <code>shutdown()</code> method is called only for plug-ins which explicitly require the
- * org.eclipse.core.runtime.compatibility plug-in.
- */
- public void shutdown() throws CoreException {
- if (CompatibilityHelper.initializeCompatibility() == null)
- return;
- Throwable exception = null;
- Method m;
- try {
- m = descriptor.getClass().getMethod("doPluginDeactivation", new Class[0]); //$NON-NLS-1$
- m.invoke(descriptor, null);
- } catch (SecurityException e) {
- exception = e;
- } catch (NoSuchMethodException e) {
- exception = e;
- } catch (IllegalArgumentException e) {
- exception = e;
- } catch (IllegalAccessException e) {
- exception = e;
- } catch (InvocationTargetException e) {
- exception = e;
- }
- if (exception == null)
- return;
- String message = NLS.bind(Messages.plugin_shutdownProblems, descriptor.getUniqueIdentifier());
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, message, exception);
- InternalPlatform.getDefault().log(status);
- }
-
- /**
- * Starts up this plug-in.
- * <p>
- * This method should be overridden in subclasses that need to do something
- * when this plug-in is started. Implementors should call the inherited method
- * to ensure that any system requirements can be met.
- * </p>
- * <p>
- * If this method throws an exception, it is taken as an indication that
- * plug-in initialization has failed; as a result, the plug-in will not
- * be activated; moreover, the plug-in will be marked as disabled and
- * ineligible for activation for the duration.
- * </p>
- * <p>
- * Plug-in startup code should be robust. In the event of a startup failure,
- * the plug-in's <code>shutdown</code> method will be invoked automatically,
- * in an attempt to close open files, etc.
- * </p>
- * <p>
- * Note 1: This method is automatically invoked by the platform
- * the first time any code in the plug-in is executed.
- * </p>
- * <p>
- * Note 2: This method is intended to perform simple initialization
- * of the plug-in environment. The platform may terminate initializers
- * that do not complete in a timely fashion.
- * </p>
- * <p>
- * Note 3: The class loader typically has monitors acquired during invocation of this method. It is
- * strongly recommended that this method avoid synchronized blocks or other thread locking mechanisms,
- * as this would lead to deadlock vulnerability.
- * </p>
- * <b>Clients must never explicitly call this method.</b>
- * <p>
- *
- * @exception CoreException if this plug-in did not start up properly
- * @deprecated
- * In Eclipse 3.0 this method has been replaced by {@link Plugin#start(BundleContext context)}.
- * Implementations of <code>startup()</code> should be changed to extend
- * <code>start(BundleContext context)</code> and call <code>super.start(context)</code>
- * instead of <code>super.startup()</code>.
- * The <code>startup()</code> method is called only for plug-ins which explicitly require the
- * org.eclipse.core.runtime.compatibility plug-in.
- */
- public void startup() throws CoreException {
- }
-
- /**
- * Returns a string representation of the plug-in, suitable
- * for debugging purposes only.
- */
- public String toString() {
- String name = bundle.getSymbolicName();
- return name == null ? new Long(bundle.getBundleId()).toString() : name;
- }
-
- /**
- * Starts up this plug-in.
- * <p>
- * This method should be overridden in subclasses that need to do something
- * when this plug-in is started. Implementors should call the inherited method
- * at the first possible point to ensure that any system requirements can be met.
- * </p>
- * <p>
- * If this method throws an exception, it is taken as an indication that
- * plug-in initialization has failed; as a result, the plug-in will not
- * be activated; moreover, the plug-in will be marked as disabled and
- * ineligible for activation for the duration.
- * </p>
- * <p>
- * Note 1: This method is automatically invoked by the platform
- * the first time any code in the plug-in is executed.
- * </p>
- * <p>
- * Note 2: This method is intended to perform simple initialization
- * of the plug-in environment. The platform may terminate initializers
- * that do not complete in a timely fashion.
- * </p>
- * <p>
- * Note 3: The class loader typically has monitors acquired during invocation of this method. It is
- * strongly recommended that this method avoid synchronized blocks or other thread locking mechanisms,
- * as this would lead to deadlock vulnerability.
- * </p>
- * <p>
- * Note 4: The supplied bundle context represents the plug-in to the OSGi framework.
- * For security reasons, it is strongly recommended that this object should not be divulged.
- * </p>
- * <p>
- * Note 5: This method and the {@link #stop(BundleContext)} may be called from separate threads,
- * but the OSGi framework ensures that both methods will not be called simultaneously.
- * </p>
- * <b>Clients must never explicitly call this method.</b>
- *
- * @param context the bundle context for this plug-in
- * @exception Exception if this plug-in did not start up properly
- * @since 3.0
- */
- public void start(BundleContext context) throws Exception {
- bundle = context.getBundle();
-
- String symbolicName = bundle.getSymbolicName();
- if (symbolicName != null) {
- String key = symbolicName + "/debug"; //$NON-NLS-1$
- String value = InternalPlatform.getDefault().getOption(key);
- this.debug = value == null ? false : value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
-
- initializeDescriptor(symbolicName);
- }
-
- /**
- * @deprecated Marked as deprecated to suppress deprecation warnings.
- */
- private IPluginDescriptor initializeDescriptor(String symbolicName) {
- if (CompatibilityHelper.initializeCompatibility() == null)
- return null;
-
- //This associate a descriptor to any real bundle that uses this to start
- if (symbolicName == null)
- return null;
-
- IPluginDescriptor tmp = CompatibilityHelper.getPluginDescriptor(symbolicName);
-
- //Runtime descriptor is never set to support dynamic re-installation of compatibility
- if (!symbolicName.equals(Platform.PI_RUNTIME))
- descriptor = tmp;
-
- CompatibilityHelper.setPlugin(tmp, this);
- CompatibilityHelper.setActive(tmp);
- return tmp;
- }
-
- /**
- * Stops this plug-in.
- * <p>
- * This method should be re-implemented in subclasses that need to do something
- * when the plug-in is shut down. Implementors should call the inherited method
- * as late as possible to ensure that any system requirements can be met.
- * </p>
- * <p>
- * Plug-in shutdown code should be robust. In particular, this method
- * should always make an effort to shut down the plug-in. Furthermore,
- * the code should not assume that the plug-in was started successfully.
- * </p>
- * <p>
- * Note 1: If a plug-in has been automatically started, this method will be automatically
- * invoked by the platform when the platform is shut down.
- * </p>
- * <p>
- * Note 2: This method is intended to perform simple termination
- * of the plug-in environment. The platform may terminate invocations
- * that do not complete in a timely fashion.
- * </p>
- * <p>
- * Note 3: The supplied bundle context represents the plug-in to the OSGi framework.
- * For security reasons, it is strongly recommended that this object should not be divulged.
- * </p>
- * <p>
- * Note 4: This method and the {@link #start(BundleContext)} may be called from separate threads,
- * but the OSGi framework ensures that both methods will not be called simultaneously.
- * </p>
- * <b>Clients must never explicitly call this method.</b>
- *
- * @param context the bundle context for this plug-in
- * @exception Exception if this method fails to shut down this plug-in
- * @since 3.0
- */
- public void stop(BundleContext context) throws Exception {
- // sub-classes to override
- }
-
- /**
- * Returns the bundle associated with this plug-in.
- *
- * @return the associated bundle
- * @since 3.0
- */
- public final Bundle getBundle() {
- return bundle;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Preferences.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Preferences.java
deleted file mode 100644
index a76ee92..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Preferences.java
+++ /dev/null
@@ -1,1270 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import java.io.*;
-import java.util.*;
-import org.eclipse.core.internal.preferences.PreferencesService;
-import org.eclipse.core.internal.preferences.PrefsMessages;
-import org.eclipse.core.runtime.preferences.*;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * A table of preference settings, mapping named properties to values. Property
- * names are non-empty strings; property values can be either booleans,
- * non-null strings, or values of one of the primitive number types.
- * The table consists of two, sparse, layers: the lower layer holds default values
- * for properties, and the upper layer holds explicitly set values for properties.
- * Normal retrieval looks for an explicitly set value for the given property in
- * the upper layer; if there is nothing for that property in the upper layer, it
- * next looks for a default value for the given property in the lower layer; if
- * there is nothing for that property in the lower layer, it returns a standard
- * default-default value. The default-default values for the primitive types are
- * as follows:
- * <ul>
- * <li><code>boolean</code> = <code>false</code></li>
- * <li><code>double</code> = <code>0.0</code></li>
- * <li><code>float</code> = <code>0.0f</code></li>
- * <li><code>int</code> = <code>0</code></li>
- * <li><code>long</code> = <code>0L</code></li>
- * <li><code>String</code> = <code>""</code> (the empty string)</li>
- * </ul>
- * <p>
- * Internally, all properties values (in both layers) are stored as strings.
- * Standard conversions to and from numeric and boolean types are performed on
- * demand.
- * </p>
- * <p>
- * The typical usage is to establish the defaults for all known properties
- * and then restore previously stored values for properties whose values
- * were explicitly set. The existing settings can be changed and new properties
- * can be set (<code>setValue</code>). If the values specified is the same as
- * the default value, the explicit setting is deleted from the top layer.
- * It is also possible to reset a property value back to the default value
- * using <code>setToDefault</code>. After the properties have been modified,
- * the properties with explicit settings are written to disk. The default values
- * are never saved. This two-tiered approach
- * to saving and restoring property setting minimizes the number of properties
- * that need to be persisted; indeed, the normal starting state does not require
- * storing any properties at all. It also makes it easy to use different
- * default settings in different environments while maintaining just those
- * property settings the user has adjusted.
- * </p>
- * <p>
- * A property change event is reported whenever a property's value actually
- * changes (either through <code>setValue</code>, <code>setToDefault</code>).
- * Note, however, that manipulating default values (with <code>setDefault</code>)
- * does not cause any events to be reported.
- * </p>
- * <p>
- * Clients may instantiate this class. This class was not designed to be
- * subclassed.
- * </p>
- * <p>
- * The implementation is based on a pair of internal
- * <code>java.util.Properties</code> objects, one holding explicitly set values
- * (set using <code>setValue</code>), the other holding the default values
- * (set using <code>setDefaultValue</code>). The <code>load</code> and
- * <code>store</code> methods persist the non-default property values to
- * streams (the default values are not saved).
- * </p>
- * <p>
- * If a client sets a default value to be equivalent to the default-default for that
- * type, the value is still known to the preference store as having a default value.
- * That is, the name will still be returned in the result of the <code>defaultPropertyNames</code>
- * and <code>contains</code> methods.
- * </p>
- *
- * @since 2.0
- */
-public class Preferences {
-
- /**
- * The default-default value for boolean properties (<code>false</code>).
- */
- public static final boolean BOOLEAN_DEFAULT_DEFAULT = false;
-
- /**
- * The default-default value for double properties (<code>0.0</code>).
- */
- public static final double DOUBLE_DEFAULT_DEFAULT = 0.0;
-
- /**
- * The default-default value for float properties (<code>0.0f</code>).
- */
- public static final float FLOAT_DEFAULT_DEFAULT = 0.0f;
-
- /**
- * The default-default value for int properties (<code>0</code>).
- */
- public static final int INT_DEFAULT_DEFAULT = 0;
-
- /**
- * The default-default value for long properties (<code>0L</code>).
- */
- public static final long LONG_DEFAULT_DEFAULT = 0L;
-
- /**
- * The default-default value for String properties (<code>""</code>).
- */
- public static final String STRING_DEFAULT_DEFAULT = ""; //$NON-NLS-1$
-
- /**
- * The string representation used for <code>true</code>
- * (<code>"true"</code>).
- */
- protected static final String TRUE = "true"; //$NON-NLS-1$
-
- /**
- * The string representation used for <code>false</code>
- * (<code>"false"</code>).
- */
- protected static final String FALSE = "false"; //$NON-NLS-1$
-
- /**
- * Singleton empty string array (optimization)
- */
- private static final String[] EMPTY_STRING_ARRAY = new String[0];
-
- /**
- * The simple identifier constant (value "<code>preferences</code>") of
- * the extension point of the Core Runtime plug-in where plug-ins declare
- * extensions to the preference facility. A plug-in may define any number
- * of preference extensions.
- *
- * @since 3.2
- */
- public static final String PT_PREFERENCES = "preferences"; //$NON-NLS-1$
-
- /**
- * An event object describing a change to a named property.
- * <p>
- * The preferences object reports property change events for internal state
- * changes that may be of interest to external parties. A special listener
- * interface (<code>Preferences.IPropertyChangeListener</code>) is
- * defined for this purpose. Listeners are registered via the
- * <code>Preferences.addPropertyChangeListener</code> method.
- * </p>
- * <p>
- * Clients cannot instantiate or subclass this class.
- * </p>
- *
- * @see Preferences#addPropertyChangeListener(Preferences.IPropertyChangeListener)
- * @see Preferences.IPropertyChangeListener
- */
- public static class PropertyChangeEvent extends EventObject {
- /**
- * All serializable objects should have a stable serialVersionUID
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * The name of the changed property.
- */
- private String propertyName;
-
- /**
- * The old value of the changed property, or <code>null</code> if
- * not known or not relevant.
- */
- private Object oldValue;
-
- /**
- * The new value of the changed property, or <code>null</code> if
- * not known or not relevant.
- */
- private Object newValue;
-
- /**
- * Creates a new property change event.
- *
- * @param source the object whose property has changed
- * @param property the property that has changed (must not be
- * <code>null</code>)
- * @param oldValue the old value of the property, or
- * <code>null</code> if none
- * @param newValue the new value of the property, or
- * <code>null</code> if none
- */
- protected PropertyChangeEvent(Object source, String property, Object oldValue, Object newValue) {
-
- super(source);
- if (property == null) {
- throw new IllegalArgumentException();
- }
- this.propertyName = property;
- this.oldValue = oldValue;
- this.newValue = newValue;
- }
-
- /**
- * Returns the name of the property that changed.
- * <p>
- * Warning: there is no guarantee that the property name returned
- * is a constant string. Callers must compare property names using
- * <code>equals</code>, not ==.
- *</p>
- *
- * @return the name of the property that changed
- */
- public String getProperty() {
- return propertyName;
- }
-
- /**
- * Returns the new value of the property.
- *
- * @return the new value, or <code>null</code> if not known
- * or not relevant
- */
- public Object getNewValue() {
- return newValue;
- }
-
- /**
- * Returns the old value of the property.
- *
- * @return the old value, or <code>null</code> if not known
- * or not relevant
- */
- public Object getOldValue() {
- return oldValue;
- }
- }
-
- /**
- * Listener for property changes.
- * <p>
- * Usage:
- * <pre>
- * Preferences.IPropertyChangeListener listener =
- * new Preferences.IPropertyChangeListener() {
- * public void propertyChange(Preferences.PropertyChangeEvent event) {
- * ... // code to deal with occurrence of property change
- * }
- * };
- * emitter.addPropertyChangeListener(listener);
- * ...
- * emitter.removePropertyChangeListener(listener);
- * </pre>
- * </p>
- * <p>
- * <em>Note:</em> Depending on the means in which the property
- * values changed, the old and new values for the property can
- * be either typed, a string representation of the value, or <code>null</code>.
- * Clients who wish to behave properly in all cases should all
- * three cases in their implementation of the property change listener.
- * </p>
- */
- public interface IPropertyChangeListener extends EventListener {
-
- /**
- * Notification that a property has changed.
- * <p>
- * This method gets called when the observed object fires a property
- * change event.
- * </p>
- *
- * @param event the property change event object describing which
- * property changed and how
- */
- public void propertyChange(Preferences.PropertyChangeEvent event);
- }
-
- /**
- * List of registered listeners (element type:
- * <code>IPropertyChangeListener</code>).
- * These listeners are to be informed when the current value of a property
- * changes.
- */
- protected ListenerList listeners = new ListenerList();
-
- /**
- * The mapping from property name to
- * property value (represented as strings).
- */
- private Properties properties;
-
- /**
- * The mapping from property name to
- * default property value (represented as strings);
- * <code>null</code> if none.
- */
- private Properties defaultProperties;
-
- /**
- * Indicates whether a value has been changed by <code>setToDefault</code>
- * or <code>setValue</code>; initially <code>false</code>.
- */
- protected boolean dirty = false;
-
- /**
- * Exports all non-default-valued preferences for all installed plugins to the
- * provided file. If a file already exists at the given location, it will be deleted.
- * If there are no preferences to export, no file will be written.
- * <p>
- * The file that is written can be read later using the importPreferences method.
- * </p>
- * @param path The absolute file system path of the file to export preferences to.
- * @exception CoreException if this method fails. Reasons include:
- * <ul>
- * <li> The file could not be written.</li>
- * </ul>
- * @see #importPreferences(IPath)
- * @see #validatePreferenceVersions(IPath)
- */
- public static void exportPreferences(IPath path) throws CoreException {
- File file = path.toFile();
- if (file.exists())
- file.delete();
- file.getParentFile().mkdirs();
- IPreferencesService service = PreferencesService.getDefault();
- OutputStream output = null;
- FileOutputStream fos = null;
- try {
- fos = new FileOutputStream(file);
- output = new BufferedOutputStream(fos);
- IEclipsePreferences node = (IEclipsePreferences) service.getRootNode().node(InstanceScope.SCOPE);
- service.exportPreferences(node, output, (String[]) null);
- output.flush();
- fos.getFD().sync();
- } catch (IOException e) {
- String message = NLS.bind(PrefsMessages.preferences_errorWriting, file, e.getMessage());
- IStatus status = new Status(IStatus.ERROR, PrefsMessages.OWNER_NAME, IStatus.ERROR, message, e);
- throw new CoreException(status);
- } finally {
- if (output != null)
- try {
- output.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
-
- /**
- * Loads the plugin preferences from the given file, and replaces all
- * non-default-valued preferences for all plugins with the values from this file.
- * <p>
- * If the file contains preferences for plug-ins that don't exist in the current
- * install, they are ignored. This method does not validate if the plug-in
- * versions in the preference file match the currently installed plug-ins.
- * Clients should first call validatePreferenceVersions on the file to ensure
- * that the versions are compatible.
- * </p>
- * <p>
- * The file must have been written by the exportPreferences method.
- * </p>
- * @param path The absolute file system path of the file to import preferences from.
- * @exception CoreException if this method fails. Reasons include:
- * <ul>
- * <li> The file does not exist.</li>
- * <li> The file could not be read.</li>
- * </ul>
- * @see #exportPreferences(IPath)
- * @see #validatePreferenceVersions(IPath)
- */
- public static void importPreferences(IPath path) throws CoreException {
- if (!path.toFile().exists()) {
- String msg = NLS.bind(PrefsMessages.preferences_fileNotFound, path.toOSString());
- throw new CoreException(new Status(IStatus.ERROR, PrefsMessages.OWNER_NAME, 1, msg, null));
- }
- IPreferencesService service = PreferencesService.getDefault();
- InputStream input = null;
- try {
- input = new BufferedInputStream(new FileInputStream(path.toFile()));
- service.importPreferences(input);
- } catch (FileNotFoundException e) {
- String msg = NLS.bind(PrefsMessages.preferences_fileNotFound, path.toOSString());
- throw new CoreException(new Status(IStatus.ERROR, PrefsMessages.OWNER_NAME, 1, msg, e));
- } finally {
- if (input != null)
- try {
- input.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
-
- /**
- * Validates that the preference versions in the given file match the versions
- * of the currently installed plugins. Returns an OK status if all preferences match
- * the currently installed plugins, otherwise a MultiStatus describing what
- * plugins have preferences that don't match.
- * <p>
- * If the returned status has a <code>IStatus.WARNING</code> severity,
- * it means that some preferences may not be applicable but for the most
- * part they will be compatible. If the returned status has a
- * <code>IStatus.ERROR</code> severity, it means that the preferences
- * will probably not be compatible.
- * <p>
- * If the file contains preferences for plug-ins that don't exist in the current
- * install, they are ignored.
- * </p>
- * <p>
- * The file must have been written by the exportPreferences method.
- * </p>
- * @param file The absolute file system path of the preference file to validate.
- * @see #exportPreferences(IPath)
- * @see #importPreferences(IPath)
- */
- public static IStatus validatePreferenceVersions(IPath file) {
- PreferencesService service = PreferencesService.getDefault();
- return service.validateVersions(file);
- }
-
- /**
- * Creates an empty preference table.
- * <p>
- * Use the methods <code>load(InputStream)</code> and
- * <code>store(InputStream)</code> to load and store these preferences.
- * </p>
- * @see #load(InputStream)
- * @see #store(OutputStream, String)
- */
- public Preferences() {
- defaultProperties = new Properties();
- properties = new Properties(defaultProperties);
- }
-
- /**
- * Adds a property change listener to this preference object.
- * Has no affect if the identical listener is already registered.
- * <p>
- * <em>Note:</em> Depending on the means in which the property
- * values changed, the old and new values for the property can
- * be either typed, a string representation of the value, or <code>null</code>.
- * Clients who wish to behave properly in all cases should all
- * three cases in their implementation of the property change listener.
- * </p>
- * @param listener a property change listener
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- listeners.add(listener);
- }
-
- /**
- * Removes the given listener from this preference object.
- * Has no affect if the listener is not registered.
- *
- * @param listener a property change listener
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * Returns whether the given property is known to this preference object,
- * either by having an explicit setting or by having a default
- * setting. Returns <code>false</code> if the given name is <code>null</code>.
- *
- * @param name the name of the property, or <code>null</code>
- * @return <code>true</code> if either a current value or a default
- * value is known for the named property, and <code>false</code>otherwise
- */
- public boolean contains(String name) {
- return (properties.containsKey(name) || defaultProperties.containsKey(name));
- }
-
- /**
- * Fires a property change event corresponding to a change to the
- * current value of the property with the given name.
- *
- * @param name the name of the property, to be used as the property
- * in the event object
- * @param oldValue the old value, or <code>null</code> if not known or not
- * relevant
- * @param newValue the new value, or <code>null</code> if not known or not
- * relevant
- */
- protected void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
- if (name == null)
- throw new IllegalArgumentException();
- Object[] changeListeners = this.listeners.getListeners();
- // Do we even need to fire an event?
- if (changeListeners.length == 0)
- return;
- final PropertyChangeEvent pe = new PropertyChangeEvent(this, name, oldValue, newValue);
- for (int i = 0; i < changeListeners.length; ++i) {
- final IPropertyChangeListener l = (IPropertyChangeListener) changeListeners[i];
- ISafeRunnable job = new ISafeRunnable() {
- public void handleException(Throwable exception) {
- // already being logged in SafeRunner#run()
- }
-
- public void run() throws Exception {
- l.propertyChange(pe);
- }
- };
- SafeRunner.run(job);
- }
- }
-
- /**
- * Returns the current value of the boolean-valued property with the
- * given name.
- * Returns the default-default value (<code>false</code>) if there
- * is no property with the given name, or if the current value
- * cannot be treated as a boolean.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the boolean-valued property
- */
- public boolean getBoolean(String name) {
- String value = properties.getProperty(name);
- if (value == null) {
- return BOOLEAN_DEFAULT_DEFAULT;
- }
- return value.equals(Preferences.TRUE);
- }
-
- /**
- * Sets the current value of the boolean-valued property with the
- * given name. The given name must not be <code>null</code>.
- * <p>
- * A property change event is reported if the current value of the
- * property actually changes from its previous value. In the event
- * object, the property name is the name of the property, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * If the given value is the same as the corresponding default value
- * for the given property, the explicit setting is deleted.
- * Note that the recommended way of re-initializing a property to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the property
- * @param value the new current value of the property
- */
- public void setValue(String name, boolean value) {
- boolean defaultValue = getDefaultBoolean(name);
- boolean oldValue = getBoolean(name);
- if (value == defaultValue) {
- Object removed = properties.remove(name);
- if (removed != null) {
- // removed an explicit setting
- dirty = true;
- }
- } else {
- properties.put(name, value ? Preferences.TRUE : Preferences.FALSE);
- }
- if (oldValue != value) {
- // mark as dirty since value did really change
- dirty = true;
- // report property change if getValue now returns different value
- firePropertyChangeEvent(name, oldValue ? Boolean.TRUE : Boolean.FALSE, value ? Boolean.TRUE : Boolean.FALSE);
- }
- }
-
- /**
- * Returns the default value for the boolean-valued property
- * with the given name.
- * Returns the default-default value (<code>false</code>) if there
- * is no default property with the given name, or if the default
- * value cannot be treated as a boolean.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the default value of the named property
- */
- public boolean getDefaultBoolean(String name) {
- String value = defaultProperties.getProperty(name);
- if (value == null) {
- return BOOLEAN_DEFAULT_DEFAULT;
- }
- return value.equals(Preferences.TRUE);
- }
-
- /**
- * Sets the default value for the boolean-valued property with the
- * given name. The given name must not be <code>null</code>.
- * <p>
- * Note that the current value of the property is affected if
- * the property's current value was its old default value, in which
- * case it changes to the new default value. If the property's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the property
- * @param value the new default value for the property
- */
- public void setDefault(String name, boolean value) {
- defaultProperties.put(name, value ? Preferences.TRUE : Preferences.FALSE);
- }
-
- /**
- * Returns the current value of the double-valued property with the
- * given name.
- * Returns the default-default value (<code>0.0</code>) if there
- * is no property with the given name, or if the current value
- * cannot be treated as a double.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the double-valued property
- */
- public double getDouble(String name) {
- return convertToDouble(properties.getProperty(name), DOUBLE_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the current value of the double-valued property with the
- * given name. The given name must not be <code>null</code>.
- * <p>
- * A property change event is reported if the current value of the
- * property actually changes from its previous value. In the event
- * object, the property name is the name of the property, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * If the given value is the same as the corresponding default value
- * for the given property, the explicit setting is deleted.
- * Note that the recommended way of re-initializing a property to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the property
- * @param value the new current value of the property; must be
- * a number (not a NaN)
- */
- public void setValue(String name, double value) {
- if (Double.isNaN(value)) {
- throw new IllegalArgumentException();
- }
- double defaultValue = getDefaultDouble(name);
- double oldValue = getDouble(name);
- if (value == defaultValue) {
- Object removed = properties.remove(name);
- if (removed != null) {
- // removed an explicit setting
- dirty = true;
- }
- } else {
- properties.put(name, Double.toString(value));
- }
- if (oldValue != value) {
- // mark as dirty since value did really change
- dirty = true;
- // report property change if getValue now returns different value
- firePropertyChangeEvent(name, new Double(oldValue), new Double(value));
- }
- }
-
- /**
- * Returns the default value for the double-valued property
- * with the given name.
- * Returns the default-default value (<code>0.0</code>) if there
- * is no default property with the given name, or if the default
- * value cannot be treated as a double.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the default value of the named property
- */
- public double getDefaultDouble(String name) {
- return convertToDouble(defaultProperties.getProperty(name), DOUBLE_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the default value for the double-valued property with the
- * given name. The given name must not be <code>null</code>.
- * <p>
- * Note that the current value of the property is affected if
- * the property's current value was its old default value, in which
- * case it changes to the new default value. If the property's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the property
- * @param value the new default value for the property; must be
- * a number (not a NaN)
- */
- public void setDefault(String name, double value) {
- if (Double.isNaN(value)) {
- throw new IllegalArgumentException();
- }
- defaultProperties.put(name, Double.toString(value));
- }
-
- /**
- * Converts the given raw property value string to a double.
- *
- * @param rawPropertyValue the raw property value, or <code>null</code>
- * if none
- * @param defaultValue the default value
- * @return the raw value converted to a double, or the given
- * <code>defaultValue</code> if the raw value is <code>null</code> or
- * cannot be parsed as a double
- */
- private double convertToDouble(String rawPropertyValue, double defaultValue) {
- double result = defaultValue;
- if (rawPropertyValue != null) {
- try {
- result = Double.parseDouble(rawPropertyValue);
- } catch (NumberFormatException e) {
- // raw value cannot be treated as one of these
- }
- }
- return result;
- }
-
- /**
- * Returns the current value of the float-valued property with the
- * given name.
- * Returns the default-default value (<code>0.0f</code>) if there
- * is no property with the given name, or if the current value
- * cannot be treated as a float.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the float-valued property
- */
- public float getFloat(String name) {
- return convertToFloat(properties.getProperty(name), FLOAT_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the current value of the float-valued property with the
- * given name. The given name must not be <code>null</code>.
- * <p>
- * A property change event is reported if the current value of the
- * property actually changes from its previous value. In the event
- * object, the property name is the name of the property, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * If the given value is the same as the corresponding default value
- * for the given property, the explicit setting is deleted.
- * Note that the recommended way of re-initializing a property to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the property
- * @param value the new current value of the property; must be
- * a number (not a NaN)
- */
- public void setValue(String name, float value) {
- if (Float.isNaN(value)) {
- throw new IllegalArgumentException();
- }
- float defaultValue = getDefaultFloat(name);
- float oldValue = getFloat(name);
- if (value == defaultValue) {
- Object removed = properties.remove(name);
- if (removed != null) {
- // removed an explicit setting
- dirty = true;
- }
- } else {
- properties.put(name, Float.toString(value));
- }
- if (oldValue != value) {
- // mark as dirty since value did really change
- dirty = true;
- // report property change if getValue now returns different value
- firePropertyChangeEvent(name, new Float(oldValue), new Float(value));
- }
- }
-
- /**
- * Returns the default value for the float-valued property
- * with the given name.
- * Returns the default-default value (<code>0.0f</code>) if there
- * is no default property with the given name, or if the default
- * value cannot be treated as a float.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the default value of the named property
- */
- public float getDefaultFloat(String name) {
- return convertToFloat(defaultProperties.getProperty(name), FLOAT_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the default value for the float-valued property with the
- * given name. The given name must not be <code>null</code>.
- * <p>
- * Note that the current value of the property is affected if
- * the property's current value was its old default value, in which
- * case it changes to the new default value. If the property's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the property
- * @param value the new default value for the property; must be
- * a number (not a NaN)
- */
- public void setDefault(String name, float value) {
- if (Float.isNaN(value)) {
- throw new IllegalArgumentException();
- }
- defaultProperties.put(name, Float.toString(value));
- }
-
- /**
- * Converts the given raw property value string to a float.
- *
- * @param rawPropertyValue the raw property value, or <code>null</code>
- * if none
- * @param defaultValue the default value
- * @return the raw value converted to a float, or the given
- * <code>defaultValue</code> if the raw value is <code>null</code> or
- * cannot be parsed as a float
- */
- private float convertToFloat(String rawPropertyValue, float defaultValue) {
- float result = defaultValue;
- if (rawPropertyValue != null) {
- try {
- result = Float.parseFloat(rawPropertyValue);
- } catch (NumberFormatException e) {
- // raw value cannot be treated as one of these
- }
- }
- return result;
- }
-
- /**
- * Returns the current value of the integer-valued property with the
- * given name.
- * Returns the default-default value (<code>0</code>) if there
- * is no property with the given name, or if the current value
- * cannot be treated as an integer.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the int-valued property
- */
- public int getInt(String name) {
- return convertToInt(properties.getProperty(name), INT_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the current value of the integer-valued property with the
- * given name. The given name must not be <code>null</code>.
- * <p>
- * A property change event is reported if the current value of the
- * property actually changes from its previous value. In the event
- * object, the property name is the name of the property, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * If the given value is the same as the corresponding default value
- * for the given property, the explicit setting is deleted.
- * Note that the recommended way of re-initializing a property to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the property
- * @param value the new current value of the property
- */
- public void setValue(String name, int value) {
- int defaultValue = getDefaultInt(name);
- int oldValue = getInt(name);
- if (value == defaultValue) {
- Object removed = properties.remove(name);
- if (removed != null) {
- // removed an explicit setting
- dirty = true;
- }
- } else {
- properties.put(name, Integer.toString(value));
- }
- if (oldValue != value) {
- // mark as dirty since value did really change
- dirty = true;
- // report property change if getValue now returns different value
- firePropertyChangeEvent(name, new Integer(oldValue), new Integer(value));
- }
- }
-
- /**
- * Returns the default value for the integer-valued property
- * with the given name.
- * Returns the default-default value (<code>0</code>) if there
- * is no default property with the given name, or if the default
- * value cannot be treated as an integer.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the default value of the named property
- */
- public int getDefaultInt(String name) {
- return convertToInt(defaultProperties.getProperty(name), INT_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the default value for the integer-valued property with the
- * given name. The given name must not be <code>null</code>.
- * <p>
- * Note that the current value of the property is affected if
- * the property's current value was its old default value, in which
- * case it changes to the new default value. If the property's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the property
- * @param value the new default value for the property
- */
- public void setDefault(String name, int value) {
- defaultProperties.put(name, Integer.toString(value));
- }
-
- /**
- * Converts the given raw property value string to an int.
- *
- * @param rawPropertyValue the raw property value, or <code>null</code>
- * if none
- * @param defaultValue the default value
- * @return the raw value converted to an int, or the given
- * <code>defaultValue</code> if the raw value is <code>null</code> or
- * cannot be parsed as an int
- */
- private int convertToInt(String rawPropertyValue, int defaultValue) {
- int result = defaultValue;
- if (rawPropertyValue != null) {
- try {
- result = Integer.parseInt(rawPropertyValue);
- } catch (NumberFormatException e) {
- // raw value cannot be treated as one of these
- }
- }
- return result;
- }
-
- /**
- * Returns the current value of the long-valued property with the
- * given name.
- * Returns the default-default value (<code>0L</code>) if there
- * is no property with the given name, or if the current value
- * cannot be treated as a long.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the long-valued property
- */
- public long getLong(String name) {
- return convertToLong(properties.getProperty(name), LONG_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the current value of the long-valued property with the
- * given name. The given name must not be <code>null</code>.
- * <p>
- * A property change event is reported if the current value of the
- * property actually changes from its previous value. In the event
- * object, the property name is the name of the property, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * If the given value is the same as the corresponding default value
- * for the given property, the explicit setting is deleted.
- * Note that the recommended way of re-initializing a property to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the property
- * @param value the new current value of the property
- */
- public void setValue(String name, long value) {
- long defaultValue = getDefaultLong(name);
- long oldValue = getLong(name);
- if (value == defaultValue) {
- Object removed = properties.remove(name);
- if (removed != null) {
- // removed an explicit setting
- dirty = true;
- }
- } else {
- properties.put(name, Long.toString(value));
- }
- if (oldValue != value) {
- // mark as dirty since value did really change
- dirty = true;
- // report property change if getValue now returns different value
- firePropertyChangeEvent(name, new Long(oldValue), new Long(value));
- }
- }
-
- /**
- * Returns the default value for the long-valued property
- * with the given name.
- * Returns the default-default value (<code>0L</code>) if there
- * is no default property with the given name, or if the default
- * value cannot be treated as a long.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the default value of the named property
- */
- public long getDefaultLong(String name) {
- return convertToLong(defaultProperties.getProperty(name), LONG_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the default value for the long-valued property with the
- * given name. The given name must not be <code>null</code>.
- * <p>
- * Note that the current value of the property is affected if
- * the property's current value was its old default value, in which
- * case it changes to the new default value. If the property's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the property
- * @param value the new default value for the property
- */
- public void setDefault(String name, long value) {
- defaultProperties.put(name, Long.toString(value));
- }
-
- /**
- * Converts the given raw property value string to a long.
- *
- * @param rawPropertyValue the raw property value, or <code>null</code>
- * if none
- * @param defaultValue the default value
- * @return the raw value converted to a long, or the given
- * <code>defaultValue</code> if the raw value is <code>null</code> or
- * cannot be parsed as a long
- */
- private long convertToLong(String rawPropertyValue, long defaultValue) {
- long result = defaultValue;
- if (rawPropertyValue != null) {
- try {
- result = Long.parseLong(rawPropertyValue);
- } catch (NumberFormatException e) {
- // raw value cannot be treated as one of these
- }
- }
- return result;
- }
-
- /**
- * Returns the current value of the string-valued property with the
- * given name.
- * Returns the default-default value (the empty string <code>""</code>)
- * if there is no property with the given name.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the string-valued property
- */
- public String getString(String name) {
- String value = properties.getProperty(name);
- return (value != null ? value : STRING_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the current value of the string-valued property with the
- * given name. The given name must not be <code>null</code>.
- * <p>
- * A property change event is reported if the current value of the
- * property actually changes from its previous value. In the event
- * object, the property name is the name of the property, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * If the given value is the same as the corresponding default value
- * for the given property, the explicit setting is deleted.
- * Note that the recommended way of re-initializing a property to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the property
- * @param value the new current value of the property
- */
- public void setValue(String name, String value) {
- if (value == null) {
- throw new IllegalArgumentException();
- }
- String defaultValue = getDefaultString(name);
- String oldValue = getString(name);
- if (value.equals(defaultValue)) {
- Object removed = properties.remove(name);
- if (removed != null) {
- // removed an explicit setting
- dirty = true;
- }
- } else {
- properties.put(name, value);
- }
- if (!oldValue.equals(value)) {
- // mark as dirty since value did really change
- dirty = true;
- // report property change if getValue now returns different value
- firePropertyChangeEvent(name, oldValue, value);
- }
- }
-
- /**
- * Returns the default value for the string-valued property
- * with the given name.
- * Returns the default-default value (the empty string <code>""</code>)
- * is no default property with the given name, or if the default
- * value cannot be treated as a string.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the default value of the named property
- */
- public String getDefaultString(String name) {
- String value = defaultProperties.getProperty(name);
- return (value != null ? value : STRING_DEFAULT_DEFAULT);
- }
-
- /**
- * Sets the default value for the string-valued property with the
- * given name. The given name must not be <code>null</code>.
- * <p>
- * Note that the current value of the property is affected if
- * the property's current value was its old default value, in which
- * case it changes to the new default value. If the property's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the property
- * @param value the new default value for the property
- */
- public void setDefault(String name, String value) {
- if (value == null) {
- throw new IllegalArgumentException();
- }
- defaultProperties.put(name, value);
- }
-
- /**
- * Returns whether the property with the given name has the default value in
- * virtue of having no explicitly set value.
- * Returns <code>false</code> if the given name is <code>null</code>.
- *
- * @param name the name of the property, or <code>null</code>
- * @return <code>true</code> if the property has no explicitly set value,
- * and <code>false</code> otherwise (including the case where the property
- * is unknown to this object)
- */
- public boolean isDefault(String name) {
- return !properties.containsKey(name);
- }
-
- /**
- * Sets the current value of the property with the given name back
- * to its default value. Has no effect if the property does not have
- * its own current value. The given name must not be <code>null</code>.
- * <p>
- * Note that the recommended way of re-initializing a property to the
- * appropriate default value is to call <code>setToDefault</code>.
- * This is implemented by removing the named value from the object,
- * thereby exposing the default value.
- * </p>
- * <p>
- * A property change event is always reported. In the event
- * object, the property name is the name of the property, and the
- * old and new values are either strings, or <code>null</code>
- * indicating the default-default value.
- * </p>
- *
- * @param name the name of the property
- */
- public void setToDefault(String name) {
- Object oldPropertyValue = properties.remove(name);
- if (oldPropertyValue != null) {
- dirty = true;
- }
- String newValue = defaultProperties.getProperty(name, null);
- // n.b. newValue == null if there is no default value
- // can't determine correct default-default without knowing type
- firePropertyChangeEvent(name, oldPropertyValue, newValue);
- }
-
- /**
- * Returns a list of all properties known to this preference object which
- * have current values other than their default value.
- *
- * @return an array of property names
- */
- public String[] propertyNames() {
- return (String[]) properties.keySet().toArray(EMPTY_STRING_ARRAY);
- }
-
- /**
- * Returns a list of all properties known to this preference object which
- * have an explicit default value set.
- *
- * @return an array of property names
- */
- public String[] defaultPropertyNames() {
- return (String[]) defaultProperties.keySet().toArray(EMPTY_STRING_ARRAY);
- }
-
- /**
- * Returns whether the current values in this preference object
- * require saving.
- *
- * @return <code>true</code> if at least one of the properties
- * known to this preference object has a current value different from its
- * default value, and <code>false</code> otherwise
- */
- public boolean needsSaving() {
- return dirty;
- }
-
- /**
- * Saves the non-default-valued properties known to this preference object to
- * the given output stream using
- * <code>Properties.store(OutputStream,String)</code>.
- * <p>
- * Note that the output is unconditionally written, even when
- * <code>needsSaving</code> is <code>false</code>.
- * </p>
- *
- * @param out the output stream
- * @param header a comment to be included in the output, or
- * <code>null</code> if none
- * @exception IOException if there is a problem saving this preference object
- * @see Properties#store(OutputStream,String)
- */
- public void store(OutputStream out, String header) throws IOException {
- properties.store(out, header);
- dirty = false;
- }
-
- /**
- * Loads the non-default-valued properties for this preference object from the
- * given input stream using
- * <code>java.util.Properties.load(InputStream)</code>. Default property
- * values are not affected.
- *
- * @param in the input stream
- * @exception IOException if there is a problem loading this preference
- * object
- * @see java.util.Properties#load(InputStream)
- */
- public void load(InputStream in) throws IOException {
- properties.load(in);
- dirty = false;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/package.html b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/package.html
deleted file mode 100644
index d81771f..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/package.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides support for the runtime platform, core utility methods and the extension registry.
-<h2>
-Package Specification</h2>
-This package contains three components:<ul>
-<li>APIs related to the runtime platform itself (provided by the <tt>org.eclipse.core.runtime</tt> plug-in)</li>
-<li>Various utility types such as <tt>Path</tt>, <tt>IPath</tt> and various flavours of progress monitors (provided by the <tt>org.eclipse.equinox.common</tt> plug-in)</li>
-<li>Extension registry mechanism (provided by the <tt>org.eclipse.equinox.registry</tt> plug-in)</li>
-</ul>
-</body>
-</html>
diff --git a/bundles/org.eclipse.core.tools/.classpath b/bundles/org.eclipse.core.tools/.classpath
deleted file mode 100644
index 751c8f2..0000000
--- a/bundles/org.eclipse.core.tools/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.core.tools/.cvsignore b/bundles/org.eclipse.core.tools/.cvsignore
deleted file mode 100644
index 3aa6193..0000000
--- a/bundles/org.eclipse.core.tools/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-bin
-coretools.jar
diff --git a/bundles/org.eclipse.core.tools/.options b/bundles/org.eclipse.core.tools/.options
deleted file mode 100644
index c6784d9..0000000
--- a/bundles/org.eclipse.core.tools/.options
+++ /dev/null
@@ -1,28 +0,0 @@
-#### Monitoring settings
-# monitor class loading
-org.eclipse.osgi/monitor/classes=false
-
-# monitor bundle activation
-org.eclipse.osgi/monitor/activation=false
-
-# monitor resource bundle (*.properties) loading
-org.eclipse.osgi/monitor/resources=false
-
-
-#### Trace settings
-# trace class loading - snapshot the execution stack when a class is loaded
-org.eclipse.osgi/trace/classLoading=false
-
-# trace location - file in which execution traces are written
-org.eclipse.osgi/trace/filename=runtime.traces
-
-# trace filters - Java properties file defining which classes should
-# be traced (if trace/classLoading is true)
-# File format:
-# plugins=<comma separated list of plugins whose classes to trace>
-# packages=<comma separated list of package prefixes of classes to trace>
-# Note that there may be many 'plugins' and 'packages' lines in one file.
-org.eclipse.osgi/trace/filters=trace.properties
-
-# trace bundle activation - snapshot the execution stack when a bundle is activated
-org.eclipse.osgi/trace/activation=false
diff --git a/bundles/org.eclipse.core.tools/.project b/bundles/org.eclipse.core.tools/.project
deleted file mode 100644
index 6f6fe68..0000000
--- a/bundles/org.eclipse.core.tools/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.tools</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.core.tools/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.core.tools/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index f3ab745..0000000
--- a/bundles/org.eclipse.core.tools/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Thu May 27 16:37:13 EDT 2004
-encoding/<project>=ISO-8859-1
-eclipse.preferences.version=1
diff --git a/bundles/org.eclipse.core.tools/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.tools/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index da038ca..0000000
--- a/bundles/org.eclipse.core.tools/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,305 +0,0 @@
-#Fri Feb 23 16:59:40 EST 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=false
-org.eclipse.jdt.core.formatter.comment.format_comments=false
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=80
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=800
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/bundles/org.eclipse.core.tools/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.core.tools/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 9f52b6c..0000000
--- a/bundles/org.eclipse.core.tools/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,9 +0,0 @@
-#Fri Feb 23 16:59:33 EST 2007
-eclipse.preferences.version=1
-formatter_profile=_core
-formatter_settings_version=11
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=;
-org.eclipse.jdt.ui.ondemandthreshold=3
-org.eclipse.jdt.ui.staticondemandthreshold=99
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return Returns the ${bare_field_name}.\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} The ${bare_field_name} to set.\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Copyright (c) ${year} IBM Corporation and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n ******************************************************************************/\r\n</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @since 3.2\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="New classes and interfaces" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} IBM Corporation and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n *******************************************************************************/\r\n${filecomment}\r\n${package_declaration}\r\n\r\n/**\r\n * \r\n */\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block&\#13;\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/bundles/org.eclipse.core.tools/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.tools/META-INF/MANIFEST.MF
deleted file mode 100644
index 7b4c0c5..0000000
--- a/bundles/org.eclipse.core.tools/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,23 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: Core Tools
-Bundle-SymbolicName: org.eclipse.core.tools; singleton=true
-Bundle-Version: 1.4.0.qualifier
-Bundle-Activator: org.eclipse.core.tools.CoreToolsPlugin
-Bundle-Vendor: Eclipse.org
-Bundle-Localization: plugin
-Provide-Package: org.eclipse.core.tools,
- org.eclipse.core.tools.runtime,
- org.eclipse.core.tools.metadata
-Require-Bundle: org.eclipse.core.resources;bundle-version="[3.1.0,4.0.0)";optional=true,
- org.eclipse.core.runtime;bundle-version="[3.1.0,4.0.0)",
- org.eclipse.jface.text,
- org.eclipse.ui,
- org.eclipse.ui.workbench.texteditor,
- org.eclipse.ui.views,
- org.eclipse.jdt.core,
- org.eclipse.jdt.ui;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.ltk.core.refactoring,
- org.eclipse.core.filebuffers,
- org.eclipse.ui.ide,
- org.eclipse.search
-Eclipse-LazyStart: true
diff --git a/bundles/org.eclipse.core.tools/about.html b/bundles/org.eclipse.core.tools/about.html
deleted file mode 100644
index 4602330..0000000
--- a/bundles/org.eclipse.core.tools/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.tools/about.ini b/bundles/org.eclipse.core.tools/about.ini
deleted file mode 100644
index f893efd..0000000
--- a/bundles/org.eclipse.core.tools/about.ini
+++ /dev/null
@@ -1,27 +0,0 @@
-# about.ini
-# contains information about a feature
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# "%key" are externalized strings defined in about.properties
-# This file does not need to be translated.
-
-# Property "aboutText" contains blurb for "About" dialog (translated)
-aboutText=%blurb
-
-# Property "windowImage" contains path to window icon (16x16)
-# needed for primary features only
-
-# Property "featureImage" contains path to feature image (32x32)
-featureImage=eclipse32.gif
-
-# Property "aboutImage" contains path to product image (500x330 or 115x164)
-# needed for primary features only
-
-# Property "appName" contains name of the application (translated)
-# needed for primary features only
-
-# Property "welcomePage" contains path to welcome page (special XML-based format)
-#welcomePage=$nl$/welcome.xml
-
-# Property "welcomePerspective" contains the id of the perspective in which the
-# welcome page is to be opened.
-# optional
diff --git a/bundles/org.eclipse.core.tools/about.mappings b/bundles/org.eclipse.core.tools/about.mappings
deleted file mode 100644
index bddaab4..0000000
--- a/bundles/org.eclipse.core.tools/about.mappings
+++ /dev/null
@@ -1,6 +0,0 @@
-# about.mappings
-# contains fill-ins for about.properties
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file does not need to be translated.
-
-0=@build@
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.tools/about.properties b/bundles/org.eclipse.core.tools/about.properties
deleted file mode 100644
index 20f4023..0000000
--- a/bundles/org.eclipse.core.tools/about.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-###############################################################################
-# Copyright (c) 2004, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-# about.properties
-# contains externalized strings for about.ini
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# fill-ins are supplied by about.mappings
-# This file should be translated.
-
-blurb=Eclipse Core Tools\n\
-\n\
-Version: 1.0.0\n\
-Build id: {0}\n\
-\n\
-(c) Copyright IBM Corp. and others 2000, 2006. All rights reserved.\n\
-Visit http://eclipse.org/eclipse/development/performance
-
diff --git a/bundles/org.eclipse.core.tools/build.properties b/bundles/org.eclipse.core.tools/build.properties
deleted file mode 100644
index 5963247..0000000
--- a/bundles/org.eclipse.core.tools/build.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-###############################################################################
-# Copyright (c) 2004, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.. = src/
-src.includes=*.html
-bin.includes=plugin.xml,icons/,doc/,*.html,.options, META-INF/,.
-qualifier=context
diff --git a/bundles/org.eclipse.core.tools/cpl-v10.html b/bundles/org.eclipse.core.tools/cpl-v10.html
deleted file mode 100644
index 36aa208..0000000
--- a/bundles/org.eclipse.core.tools/cpl-v10.html
+++ /dev/null
@@ -1,125 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-<HEAD>
-<TITLE>Common Public License - v 1.0</TITLE>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</HEAD>
-
-<BODY BGCOLOR="#FFFFFF" VLINK="#800000">
-
-
-<P ALIGN="CENTER"><B>Common Public License - v 1.0</B>
-<P><B></B><FONT SIZE="3"></FONT>
-<P><FONT SIZE="3"></FONT><FONT SIZE="2">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.</FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"><B>1. DEFINITIONS</B></FONT>
-<P><FONT SIZE="2">"Contribution" means:</FONT>
-
-<UL><FONT SIZE="2">a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and<BR CLEAR="LEFT">
-b) in the case of each subsequent Contributor:</FONT></UL>
-
-
-<UL><FONT SIZE="2">i) changes to the Program, and</FONT></UL>
-
-
-<UL><FONT SIZE="2">ii) additions to the Program;</FONT></UL>
-
-
-<UL><FONT SIZE="2">where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. </FONT><FONT SIZE="2">A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. </FONT><FONT SIZE="2">Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. </FONT></UL>
-
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">"Contributor" means any person or entity that distributes the Program.</FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. </FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2">"Program" means the Contributions distributed in accordance with this Agreement.</FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.</FONT>
-<P><FONT SIZE="2"><B></B></FONT>
-<P><FONT SIZE="2"><B>2. GRANT OF RIGHTS</B></FONT>
-
-<UL><FONT SIZE="2"></FONT><FONT SIZE="2">a) </FONT><FONT SIZE="2">Subject to the terms of this Agreement, each Contributor hereby grants</FONT><FONT SIZE="2"> Recipient a non-exclusive, worldwide, royalty-free copyright license to</FONT><FONT SIZE="2" COLOR="#FF0000"> </FONT><FONT SIZE="2">reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.</FONT></UL>
-
-
-<UL><FONT SIZE="2"></FONT></UL>
-
-
-<UL><FONT SIZE="2"></FONT><FONT SIZE="2">b) Subject to the terms of this Agreement, each Contributor hereby grants </FONT><FONT SIZE="2">Recipient a non-exclusive, worldwide,</FONT><FONT SIZE="2" COLOR="#008000"> </FONT><FONT SIZE="2">royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. </FONT></UL>
-
-
-<UL><FONT SIZE="2"></FONT></UL>
-
-
-<UL><FONT SIZE="2">c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.</FONT></UL>
-
-
-<UL><FONT SIZE="2"></FONT></UL>
-
-
-<UL><FONT SIZE="2">d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. </FONT></UL>
-
-
-<UL><FONT SIZE="2"></FONT></UL>
-
-<P><FONT SIZE="2"><B>3. REQUIREMENTS</B></FONT>
-<P><FONT SIZE="2"><B></B>A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:</FONT>
-
-<UL><FONT SIZE="2">a) it complies with the terms and conditions of this Agreement; and</FONT></UL>
-
-
-<UL><FONT SIZE="2">b) its license agreement:</FONT></UL>
-
-
-<UL><FONT SIZE="2">i) effectively disclaims</FONT><FONT SIZE="2"> on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; </FONT></UL>
-
-
-<UL><FONT SIZE="2">ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; </FONT></UL>
-
-
-<UL><FONT SIZE="2">iii)</FONT><FONT SIZE="2"> states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and</FONT></UL>
-
-
-<UL><FONT SIZE="2">iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.</FONT><FONT SIZE="2" COLOR="#0000FF"> </FONT><FONT SIZE="2" COLOR="#FF0000"></FONT></UL>
-
-
-<UL><FONT SIZE="2" COLOR="#FF0000"></FONT><FONT SIZE="2"></FONT></UL>
-
-<P><FONT SIZE="2">When the Program is made available in source code form:</FONT>
-
-<UL><FONT SIZE="2">a) it must be made available under this Agreement; and </FONT></UL>
-
-
-<UL><FONT SIZE="2">b) a copy of this Agreement must be included with each copy of the Program. </FONT></UL>
-
-<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT>
-<P><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT><FONT SIZE="2">Contributors may not remove or alter any copyright notices contained within the Program. </FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. </FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"><B>4. COMMERCIAL DISTRIBUTION</B></FONT>
-<P><FONT SIZE="2">Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.</FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.</FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"></FONT>
-<P><FONT SIZE="2" COLOR="#0000FF"></FONT><FONT SIZE="2"><B>5. NO WARRANTY</B></FONT>
-<P><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is</FONT><FONT SIZE="2"> solely responsible for determining the appropriateness of using and distributing </FONT><FONT SIZE="2">the Program</FONT><FONT SIZE="2"> and assumes all risks associated with its exercise of rights under this Agreement</FONT><FONT SIZE="2">, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, </FONT><FONT SIZE="2">programs or equipment, and unavailability or interruption of operations</FONT><FONT SIZE="2">. </FONT><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2"><B>6. DISCLAIMER OF LIABILITY</B></FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES </FONT><FONT SIZE="2">(INCLUDING WITHOUT LIMITATION LOST PROFITS),</FONT><FONT SIZE="2"> HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"><B>7. GENERAL</B></FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2">If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.</FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. </FONT><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. </FONT><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2">Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to </FONT><FONT SIZE="2">publish new versions (including revisions) of this Agreement from time to </FONT><FONT SIZE="2">time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. </FONT><FONT SIZE="2">Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new </FONT><FONT SIZE="2">version. </FONT><FONT SIZE="2">Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, </FONT><FONT SIZE="2">by implication, estoppel or otherwise</FONT><FONT SIZE="2">.</FONT><FONT SIZE="2"> All rights in the Program not expressly granted under this Agreement are reserved.</FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.</FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"></FONT>
-
-</BODY>
-
-</HTML>
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.tools/doc/hglegal2002.htm b/bundles/org.eclipse.core.tools/doc/hglegal2002.htm
deleted file mode 100644
index 5df454d..0000000
--- a/bundles/org.eclipse.core.tools/doc/hglegal2002.htm
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2002. All Rights Reserved.
-</body>
-</html>
diff --git a/bundles/org.eclipse.core.tools/doc/ngibmcpy2002.gif b/bundles/org.eclipse.core.tools/doc/ngibmcpy2002.gif
deleted file mode 100644
index 61cef48..0000000
--- a/bundles/org.eclipse.core.tools/doc/ngibmcpy2002.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.core.tools/doc/readme.html b/bundles/org.eclipse.core.tools/doc/readme.html
deleted file mode 100644
index bd66ee6..0000000
--- a/bundles/org.eclipse.core.tools/doc/readme.html
+++ /dev/null
@@ -1,246 +0,0 @@
-<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Core Tools Readme</title>
-</head>
-
-<body>
-<h2 align="center">Core Tools</h2>
-<h3>Introduction</h3>
-
-
-<p>Core Tools is a set of views and perspectives useful for people writing Eclipse
- plugins or just wanting to know what is going on under the covers. Roughly speaking
- there are three kinds of tools:</p>
-<dl>
- <dt><b>Runtime tools</b></dt>
- <dd>The runtime tools expose the internal behaviour of the Platform runtime
- as well as certain aspects of plugins (activation ordering, classes loaded,
- relation to other plugins, ...) and classes (load order, load nesting, ...).
- Plugin developers can use this information to ensure that their plugins/classes
- are being activated/loaded as expected, and that they are not taking more
- time/space than is warranted.</dd>
- <dt><b>Resources tools</b></dt>
- <dd>The resources tools expose the behaviour/performance of installed builders
- and listeners as well as the structure of the workspace, resources and resource
- deltas.</dd>
- <dt><b>Metadata tools</b></dt>
- <dd>The metadata tools enable users to investigate the metadata files used in
- Eclipse. Point these tools at a metadata location and browse...</dd>
-</dl>
-
-
-<h3>Installing and Running Core Tools</h3>
-
-<h4>Installing Core Tools</h4>
-<p>If you are running on Eclipse 3.*, get org.eclipse.core.tools.zip and extract
- all files into the <eclipse install>/plugins directory. This will a add
- the Core Tools plugins and fragments to your install. Use Core Tools version
- 1.1.0 for Eclipse 3.0.*, and Core Tools 1.2 for Eclipse 3.1 from M5a on.</p>
-<p>For running on Eclipse 2.1.* or earlier, the Core Tools comes in two parts;
- the tools themselves and some patches for the boot, runtime and resources plugins.
- To install:</p>
-<ol>
- <li>To install the Core Tools, get org.eclipse.core.tools.zip and extract all
- files into the <eclipse install>/plugins directory. This will a add
- the Core Tools plugins and fragments to your install.
- Use Core Tools version 1.0.0 for Eclipse builds prior to I20030128, and
- Core Tools 1.0.1 for all builds after that (including the 2.1 release).</li>
- <li>If you are running an Eclipse build from before I20021127 (this includes
- 2.0.*) you will need to get the patched versions of the boot, runtime and
- resources plugins. Get core-tools-patches.zip and extract all files into your
- <eclipse install>/plugins directory. This will overwrite boot.jar, runtime.jar
- and resources.jar. Note that if your install has version numbers in the plug-in
- directory names, you have to manually copy/extract the patch files into the
- corresponding versioned plug-in directory in your install.</li>
-</ol>
-<h4>Running Core Tools</h4>
-<p>After installing the Core Tools, you must enable them. The tools are enabled
- using Eclipse's debug options mechanism. To run Eclipse in "debug"
- mode, use the -debug command line option. If nothing else is said, Eclipse will
- look for the file <eclipse install>/.options. This is a Java properties
- file detailing which debug options should be enabled etc. See the Eclipse runtime
- documentation for more details. </p>
-<p>The org.eclipse.core.tools plugin contains an example .options file which enables
- all options (except class load trace filters). To run Eclipse with the Core
- Tools, either copy this file to your <eclipse install> directory or identify
- it on the command line after -debug. For example, </p>
-<pre> eclipse -debug file:d:/.options</pre>
-<p>Note that not all tools require enablement. You need only enable the debug
- options required by the tools you choose to use. See the tool descriptions for
- details.</p>
-<p>If you are using PDE's runtime workbench then you can enable tracing and set
- the appropriate options for the target workspace. See PDE Guide -> Running
- a plug-in -> Running with tracing found in the standard Eclipse documentation
- set for more information.</p>
-<p>Once you are running with the Core Tools installed, there are a number of new
- perspectives and views. These are accessed by opening a new perspective or using
- the Window->Show View functions in the workbench.</p>
-<h3>Runtime Tools</h3>
-
-
-<p>The runtime tooling contributes a Runtime Spy and Plugin Dependency perspectives.
- Note that in some cases the views can be combined or used in other contexts.
- The individual views are accessed via the Workspace->Show View->Runtime
- Tools menu.</p>
-<h4>Runtime Spy Perspective</h4>
-<p>The Runtime Spy perspective shows information about the plugin activation,
- class loading, resource bundles etc. It is extremely useful when trying to track
- down why plugins are being activated or classes loaded as well as getting a
- handle on how much code is loaded. This tool contains four views: </p>
-<dl>
- <dt><b>Activated Plugins</b> </dt>
- <dd>This is the list of plugins which have been activated since the start of
- this Eclipse session. Included is total code footprint, startup time, activation
- order as well as the number of classes loaded for each plugin.<br>
- When plugins are activated a snapshot of the execution stack is taken. This
- stack trace can be viewed by selecting plugin and clicking on the stack trace
- 'T' button on the title bar or in the context menu.<br>
- The classes loaded by the selected plugins is shown in the Loaded Classes
- view when the "Classes" button ('C') on the menu bar or context
- menu is used.<br>
- Note that this list is not automatically updated when a new plugin is activated
- so users should use the refresh button on the view title bar or in the context
- menu.</dd>
- <dt><b>Loaded Classes</b> </dt>
- <dd>This view is populated with classes loaded by plugins selected in the Activated
- Plugins view. For each class data such as load order and memory footprint
- are listed. If the appropriate filtering is enabled when the platform is started
- (see below), stack snapshots taken at class loading time are available by
- selecting a class and using the Stack Trace menu entry or title bar button.</dd>
- <dt><b>Plugin Datasheet</b> </dt>
- <dd>Shows a summary of the currently selected plugin.</dd>
- <dt><b>Stack Trace</b> </dt>
- <dd>Shows a snapshot of the execution stack at the time of some event (e.g.,
- plugin activation, class loading).</dd>
-</dl>
-<p>The following debug options control what data is available in Runtime Spy perspective
- views.</p>
-<dl>
- <dt>org.eclipse.osgi/monitor/classes=<boolean></dt>
- <dd>Whether or not to monitor which classes are loaded.</dd>
- <dt>org.eclipse.osgi/monitor/activation=<boolean></dt>
- <dd>Whether or not to monitor which plugins are activated.</dd>
- <dt>org.eclipse.osgi/monitor/resources=<boolean></dt>
- <dd>Whether or not to monitor which resource bundles (i.e., *.properties files
- ) are loaded</dd>
- <dt>org.eclipse.osgi/trace/classLoading=<boolean></dt>
- <dd>Whether or not to snapshot the execution stack when a class is loaded</dd>
- <dt>org.eclipse.osgi/trace/filename=<file location></dt>
- <dd>The file in which execution traces are written</dd>
- <dt>org.eclipse.osgi/trace/filters=<properties file></dt>
- <dd>The location of a Java properties file identifying the classes which should
- be traced (if trace/classLoading is true). The File format is: <br>
- plugins=<comma separated list of plugins whose classes to trace><br>
- packages=<comma separated list of package prefixes of classes to trace><br>
- Note that there may be many 'plugins' and 'packages' lines in one file.</dd>
- <dt>org.eclipse.osgi/trace/activation=<boolean></dt>
- <dd>Whether or not to snapshot the execution stack when a plugin is activated.<br>
- </dd>
-</dl>
-<h4>Plug-In Dependency Perspective</h4>
-<p>This perspective includes 2 views: a plug-in list view listing all the plug-ins
- available in the workspace and a plug-in dependency view. The plug-in ids in
- the list view are given in alphabetical order (according to their plug-in id).
- Select a plug-in in the list view and the dependency view is updated to show
- all plug-ins that the selected plug-in requires as well as all plug-ins that
- require this selected plug-in. This information is currently only presented
- in a text format.</p>
-<h3>Resources Tools</h3>
-<p>The Resources tooling consists of a number of views described below. These
- are accessed via the Workspace->Show View->Resources Tools menu and can
- be used independently or together to as desired. </p>
-<h4>Resource Spy view</h4>
-This view shows detailed public/internal information about the resource currently
-selected in any Eclipse view (e.g. Resource Navigator, Package Explorer, etc).
-It shows details about: flags, markers, synchronization information, session/persistent
-properties, content type).
-<h4>Delta Spy View</h4>
-The Delta Spy listens for any resource changes, echoing the resource delta for
-each change event listened. For each affected resource (and its child resources),
-it shows the following information:
-<ul>
- <li>the resource's full path;</li>
- <li>the kind of change (between brackets): addition (+), phantom addition (>),
- removal (-), phantom removal (<), change (*), no change (~), and unknown
- (?);</li>
- <li>the change flags (between curly braces): CONTENT, MOVED_FROM, MOVED_TO,
- OPEN, TYPE, SYNC, MARKERS, REPLACED, DESCRIPTION;</li>
- <li>in the case it is a marker change, it will show (between brackets) for each
- marker changed:
- <ul>
- <li>the kind of marker change: addition (+), removal (-), change (*);</li>
- <li>the marker's id;</li>
- </ul>
- </li>
- <li>if it is a team private change, a "(team private)" tag.</li>
-</ul>
-<h4>Graphical Delta Spy View</h4>
-<p>The Graphical Delta Spy is similar to the Delta Spy describe above, but it
- shows the resource delta tree using a tree widget instead of indented text.
- This view can only show the resource delta tree for the last resource change
- event only. However, it is easier to visualize a resource delta tree due to
- its graphical nature.</p>
-<p>The Graphical Delta Spy view provides a pull-down menu that allows the user
- to select which types of events to listen to (PRE_BUILD, POST_BUILD, POST_CHANGE)
- and whether phantom resources should be taken into account..</p>
-<h4>Builders/Listeners Spy</h4>
-<p>The Builders/Listeners Spy view displays statistical information about the
- behaviour and performance of installed builders and resource change listeners.
- The information includes:</p>
-<ul>
- <li>the name of builder/listener (listeners do not technically have names so
- their toString() is used)</li>
- <li>the project related to the builder (blank for listeners)</li>
- <li>the number of events (builds or resource changed) processed by the builder/listener</li>
- <li>the amount of time spent processing these events</li>
- <li>the number of core exceptions encountered</li>
-</ul>
-<p>For more informatioin on listeners see the Eclipse article "How You've
- Changed! Responding to resource changes in the Eclipse workspace" by John
- Arthorne (OTI) August 23, 2002. Documentation on builders can be found in the
- Platform Plug-in Developer Guide included with the Eclipse documentation.</p>
-<p>The following debug options control what data is available in Builder/Listener
- Spy view.</p>
-<dl>
- <dt>org.eclipse.core.resources/monitor/builders=<boolean></dt>
- <dd>Whether or not to monitor which builders.</dd>
- <dt>org.eclipse.core.resources/monitor/listeners=<boolean></dt>
- <dd>Whether or not to monitor which listeners.</dd>
-</dl>
-<h3>Metadata Tools</h3>
-<p>The metadata tooling contributes a Metadata perspective. The individual views
- are not particularly useful on their own but are accessed via the Window->Show
- View->Metadata Tools menu.</p>
-<h4>The Metadata Perspective</h4>
-This perspective contains three views which allows the user to select a directory,
-browse any metadata found in it and see contents and integrity status of supported
-files.
-<dl>
- <dt><b>Metadata Spy</b></dt>
- <dd>This view allows the user to select a given metadata directory and uses
- a tree view to show a directory hierarchy containing all known metadata files
- as leaf nodes. If the user double-clicks one of these leaf nodes, the Dump
- Contents view will be opened having this file as its current selected file.
- </dd>
- <dt><b>Dump Contents</b></dt>
- <dd>This view presents to the user the contents of a selected metadata file
- in a human-readable format. It provides an action for selecting a new file
- to dump. The contents layout will depend on what kind of file is being dumped.
- This view has a sub-view called "Dump Summary" that shows whether
- the file read was ok or not. </dd>
- <dt><b>Dump Summary</b></dt>
- <dd>This view presents to the user the results of a file dumped using the Dump
- Contents view. In the case of a error during the dumping process (because
- the metadata file being dumped was corrupted), the reason will be shown here,
- along with the number of bytes read. This view will only be updated if it
- is open when a file is being dumped. </dd>
-</dl>
-<p>Note: the dumping functionality is also available as a headless Eclipse application:
- <tt>org.eclipse.core.tools.dumptool</tt>. To run it, you need to pass the file
- to be dumped using the <tt>dump.file</tt> system property. For instance:</p>
-<pre>eclipse -application org.eclipse.core.tools.dumptool -vmargs -Ddump.file=d:\eclipse\configuration\org.eclipse.osgi\.state</pre>
-<h4><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation and others 2000, 2002. All Rights Reserved." BORDER=0 height=14 width=324></a></h4>
- </body>
-</html>
diff --git a/bundles/org.eclipse.core.tools/icons/classes.gif b/bundles/org.eclipse.core.tools/icons/classes.gif
deleted file mode 100644
index 4fa0940..0000000
--- a/bundles/org.eclipse.core.tools/icons/classes.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.core.tools/icons/clear.gif b/bundles/org.eclipse.core.tools/icons/clear.gif
deleted file mode 100644
index 2558326..0000000
--- a/bundles/org.eclipse.core.tools/icons/clear.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.core.tools/icons/collapseall.gif b/bundles/org.eclipse.core.tools/icons/collapseall.gif
deleted file mode 100644
index 0bae56c..0000000
--- a/bundles/org.eclipse.core.tools/icons/collapseall.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.core.tools/icons/datasheet.gif b/bundles/org.eclipse.core.tools/icons/datasheet.gif
deleted file mode 100644
index ec0cba1..0000000
--- a/bundles/org.eclipse.core.tools/icons/datasheet.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.core.tools/icons/plugin.gif b/bundles/org.eclipse.core.tools/icons/plugin.gif
deleted file mode 100644
index 8a87648..0000000
--- a/bundles/org.eclipse.core.tools/icons/plugin.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.core.tools/icons/refresh.gif b/bundles/org.eclipse.core.tools/icons/refresh.gif
deleted file mode 100644
index a063c23..0000000
--- a/bundles/org.eclipse.core.tools/icons/refresh.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.core.tools/icons/req_plugins_obj.gif b/bundles/org.eclipse.core.tools/icons/req_plugins_obj.gif
deleted file mode 100644
index 689f522..0000000
--- a/bundles/org.eclipse.core.tools/icons/req_plugins_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.core.tools/icons/reset.gif b/bundles/org.eclipse.core.tools/icons/reset.gif
deleted file mode 100644
index 8d50500..0000000
--- a/bundles/org.eclipse.core.tools/icons/reset.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.core.tools/icons/spy.gif b/bundles/org.eclipse.core.tools/icons/spy.gif
deleted file mode 100644
index ce3fc51..0000000
--- a/bundles/org.eclipse.core.tools/icons/spy.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.core.tools/icons/trace.gif b/bundles/org.eclipse.core.tools/icons/trace.gif
deleted file mode 100644
index 34027a5..0000000
--- a/bundles/org.eclipse.core.tools/icons/trace.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.core.tools/icons/zoom.gif b/bundles/org.eclipse.core.tools/icons/zoom.gif
deleted file mode 100644
index 3c10582..0000000
--- a/bundles/org.eclipse.core.tools/icons/zoom.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.core.tools/plugin.xml b/bundles/org.eclipse.core.tools/plugin.xml
deleted file mode 100644
index e2e4aa5..0000000
--- a/bundles/org.eclipse.core.tools/plugin.xml
+++ /dev/null
@@ -1,198 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
-
- <extension-point id="metadataDumpers" name="Metadata Dumpers"/>
-
-<!-- Metadata dumpers -->
- <extension point="org.eclipse.core.tools.metadataDumpers">
- <dumper file-name=".state" class="org.eclipse.core.tools.metadata.StateDumper"/>
- </extension>
-
-<!-- The DumpTool headless application -->
- <extension point="org.eclipse.core.runtime.applications" id="dumptool">
- <application>
- <run class="org.eclipse.core.tools.metadata.DumpTool"/>
- </application>
- </extension>
-
-
-<!-- Perspectives -->
- <extension
- point="org.eclipse.ui.perspectives">
- <perspective
- name="Plug-in Dependency"
- icon="icons/req_plugins_obj.gif"
- class="org.eclipse.core.tools.runtime.PluginDependencyPerspective"
- id="org.eclipse.core.tools.runtime.PluginDependencyPerspective">
- </perspective>
- </extension>
- <extension
- point="org.eclipse.ui.perspectives">
- <perspective
- name="Runtime Spy"
- icon="icons/zoom.gif"
- class="org.eclipse.core.tools.runtime.RuntimeSpyPerspective"
- id="org.eclipse.core.tools.runtime.RuntimeSpyPerspective">
- </perspective>
- </extension>
-<!-- Metadata Perspective -->
- <extension
- point="org.eclipse.ui.perspectives">
- <perspective
- name="Metadata"
- icon="icons/spy.gif"
- class="org.eclipse.core.tools.metadata.MetadataPerspective"
- id="org.eclipse.core.tools.metadata.MetadataPerspective">
- </perspective>
- </extension>
-<!-- Metadata Views -->
- <extension
- point="org.eclipse.ui.views">
- <category
- name="Metadata Tools"
- id="org.eclipse.core.tools.metadata">
- </category>
- <view
- name="Dump Contents"
- icon="icons/spy.gif"
- category="org.eclipse.core.tools.metadata"
- class="org.eclipse.core.tools.metadata.DumpContentsView"
- id="org.eclipse.core.tools.metadata.DumpContentsView">
- </view>
- <view
- name="Dump Summary"
- icon="icons/spy.gif"
- category="org.eclipse.core.tools.metadata"
- class="org.eclipse.core.tools.metadata.DumpSummaryView"
- id="org.eclipse.core.tools.metadata.DumpSummaryView">
- </view>
- <view
- name="Metadata Spy"
- icon="icons/spy.gif"
- category="org.eclipse.core.tools.metadata"
- class="org.eclipse.core.tools.metadata.MetadataTreeView"
- id="org.eclipse.core.tools.metadata.MetadataTreeView">
- </view>
- </extension>
-<!-- Runtime Views -->
- <extension point="org.eclipse.ui.views">
- <category name="Runtime Tools" id="org.eclipse.core.tools.runtime"/>
- <view
- name="Activated Plug-ins"
- icon="icons/plugin.gif"
- category="org.eclipse.core.tools.runtime"
- class="org.eclipse.core.tools.runtime.ActivePluginsView"
- id="org.eclipse.core.tools.runtime.ActivePluginsView"/>
- <view
- name="Loaded Classes"
- icon="icons/classes.gif"
- category="org.eclipse.core.tools.runtime"
- class="org.eclipse.core.tools.runtime.LoadedClassesView"
- id="org.eclipse.core.tools.runtime.LoadedClassesView"/>
- <view
- name="Plug-in Datasheet"
- icon="icons/datasheet.gif"
- category="org.eclipse.core.tools.runtime"
- class="org.eclipse.core.tools.runtime.PluginDataSheetView"
- id="org.eclipse.core.tools.runtime.PluginDataSheetView"/>
- <view
- name="Stack Trace"
- icon="icons/trace.gif"
- category="org.eclipse.core.tools.runtime"
- class="org.eclipse.core.tools.runtime.StackTraceView"
- id="org.eclipse.core.tools.runtime.StackTraceView"/>
- <view
- name="Plug-in Dependency Spy"
- icon="icons/spy.gif"
- category="org.eclipse.core.tools.runtime"
- class="org.eclipse.core.tools.runtime.PluginDependencyView"
- id="org.eclipse.core.tools.runtime.PluginDependencyView"/>
- <view
- name="Plug-in List Spy"
- icon="icons/spy.gif"
- category="org.eclipse.core.tools.runtime"
- class="org.eclipse.core.tools.runtime.PluginListView"
- id="org.eclipse.core.tools.runtime.PluginListView"/>
- <view
- name="Preferences Spy"
- icon="icons/spy.gif"
- category="org.eclipse.core.tools.runtime"
- class="org.eclipse.core.tools.runtime.EclipsePreferencesView"
- id="org.eclipse.core.tools.runtime.EclipsePreferencesView"/>
- <view
- name="Preference Stats Spy"
- icon="icons/spy.gif"
- category="org.eclipse.core.tools.runtime"
- class="org.eclipse.core.tools.runtime.PreferenceStatsView"
- id="org.eclipse.core.tools.runtime.PreferenceStatsView"/>
- <view
- name="Content Types"
- icon="icons/spy.gif"
- category="org.eclipse.core.tools.runtime"
- class="org.eclipse.core.tools.runtime.ContentTypeView"
- id="org.eclipse.core.tools.runtime.ContentTypeView"/>
- <view
- name="Event Spy"
- icon="icons/spy.gif"
- category="org.eclipse.core.tools.runtime"
- class="org.eclipse.core.tools.runtime.EventsView"
- id="org.eclipse.core.tools.runtime.EventsView"/>
- </extension>
- <extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- adaptable="true"
- id="org.eclipse.core.tools.nls.testing.contribution"
- objectClass="org.eclipse.jdt.core.ICompilationUnit">
- <action
- label="Convert to NLS Messages"
- class="org.eclipse.core.tools.nls.ConvertMessageBundleAction"
- menubarPath="additions"
- enablesFor="1"
- id="org.eclipse.core.tools.nls.ConvertMessageBundleAction">
- </action>
- <action
- label="Remove Unused Messages"
- class="org.eclipse.core.tools.nls.RemoveUnusedMessagesAction"
- menubarPath="additions"
- enablesFor="1"
- id="org.eclipse.core.tools.nls.RemoveUnusedMessagesAction">
- </action>
- </objectContribution>
- <objectContribution
- adaptable="true"
- id="org.eclipse.core.tools.contribution2"
- objectClass="org.eclipse.jdt.core.IJavaElement">
- <action
- label="Find Unreferenced Members"
- class="org.eclipse.core.tools.search.FindUnusedMembersAction"
- menubarPath="additions"
- enablesFor="*"
- id="org.eclipse.core.tools.search.FindUnusedMembersAction">
- </action>
- </objectContribution>
- <objectContribution
- adaptable="true"
- id="org.eclipse.core.tools.contribution3"
- objectClass="org.eclipse.core.resources.IResource">
- <action
- label="Find Unreferenced Files"
- class="org.eclipse.core.tools.search.FindUnreferencedFilesAction"
- menubarPath="additions"
- enablesFor="*"
- id="org.eclipse.core.tools.search.FindUnreferencedFiles">
- </action>
- </objectContribution>
- </extension>
- <extension
- id="UnusedMembersResultPage"
- point="org.eclipse.search.searchResultViewPages">
- <viewPage
- id="org.eclipse.core.tools.UnusedMembersResultPage"
- searchResultClass="org.eclipse.core.tools.search.FindUnusedSearchResult"
- class="org.eclipse.core.tools.search.FindUnusedSearchResultPage">
- </viewPage>
- </extension>
-
-</plugin>
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/AbstractCopySelectionAction.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/AbstractCopySelectionAction.java
deleted file mode 100644
index 1847747..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/AbstractCopySelectionAction.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.actions.ActionFactory;
-
-/**
- * A base abstract implementation for "copy selection" actions.
- */
-
-public abstract class AbstractCopySelectionAction extends GlobalAction {
-
- /**
- * The selection provider.
- */
- protected ISelectionProvider selectionProvider;
-
- /**
- * Sets action's text and tool tip text.
- *
- * @param selectionProvider the selection provider
- */
- public AbstractCopySelectionAction(ISelectionProvider selectionProvider) {
- super("&Copy"); //$NON-NLS-1$
- this.selectionProvider = selectionProvider;
- }
-
- /**
- * Copies the currently selected contents to the clipboard. The meaning of the
- * currently selected contents is defined by overriding the getContents()
- * method.
- *
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- // puts that content in the clipboard
- Clipboard clipboard = new Clipboard(Display.getCurrent());
- clipboard.setContents(new Object[] {getContents()}, new Transfer[] {TextTransfer.getInstance()});
- clipboard.dispose();
- }
-
- /**
- * Registers this action as a global action handler.
- *
- * @param actionBars the action bars where this action will be registered.
- * @see org.eclipse.core.tools.GlobalAction#registerAsGlobalAction(
- * org.eclipse.ui.IActionBars)
- */
- public void registerAsGlobalAction(IActionBars actionBars) {
- actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), this);
- }
-
- /**
- * Returns the currently selected contents as a String object.
- *
- * @return the selected contents as string.
- */
- protected abstract String getContents();
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/AbstractTreeContentProvider.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/AbstractTreeContentProvider.java
deleted file mode 100644
index 7cd9555..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/AbstractTreeContentProvider.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * An abstract base class for hierarchical content providers. Uses
- * <code>TreeContentProviderNode</code> objects to keep a hierarchical
- * data model. Subclasses must provide an implementation for the
- * <code>#rebuild(Object)</code> operation in order to define how the data model
- * will be built upon a given input provided by the viewer.
- */
-
-public abstract class AbstractTreeContentProvider implements ITreeContentProvider {
-
- /**
- * Flag for omitting the root or not when providing the contents.
- */
- private boolean omitRoot;
-
- /**
- * The root node.
- */
- private TreeContentProviderNode rootNode;
-
- /**
- * Constructs a AbstractTreeContentProvider.
- *
- * @param omitRoot if true, the root node will be omitted when providing
- * contents.
- */
- protected AbstractTreeContentProvider(boolean omitRoot) {
- this.omitRoot = omitRoot;
- }
-
- /**
- * Constructs a AbstractTreeContentProvider that will omit the root node when
- * providing contents.
- *
- * @see #AbstractTreeContentProvider(boolean)
- */
- protected AbstractTreeContentProvider() {
- this(true);
- }
-
- /**
- * Returns the child elements of the given parent element.
- *
- * @return an array containing <code>parentElement</code>'s children.
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(
- * java.lang.Object)
- * @see org.eclipse.core.tools.TreeContentProviderNode#getChildren()
- */
- public Object[] getChildren(Object parentElement) {
- if (!(parentElement instanceof TreeContentProviderNode))
- return null;
-
- TreeContentProviderNode treeNode = (TreeContentProviderNode) parentElement;
- return treeNode.getChildren();
- }
-
- /**
- * Returns the parent for the given element, or <code>null</code>
- * indicating that the parent can't be computed.
- *
- * @return <coded>element</code>'s parent node or null, if it is a root node
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(
- * java.lang.Object)
- * @see org.eclipse.core.tools.TreeContentProviderNode#getParent()
- */
- public Object getParent(Object element) {
- if (!(element instanceof TreeContentProviderNode))
- return null;
-
- TreeContentProviderNode treeNode = (TreeContentProviderNode) element;
- return treeNode.getParent();
- }
-
- /**
- * Returns whether the given element has children.
- *
- * @return true, if <code>element</code> has children, false otherwise
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(
- * java.lang.Object)
- * @see org.eclipse.core.tools.TreeContentProviderNode#hasChildren() *
- */
- public boolean hasChildren(Object element) {
- return element instanceof TreeContentProviderNode && ((TreeContentProviderNode) element).hasChildren();
- }
-
- /**
- * Returns the elements to display in the viewer
- * when its input is set to the given element.
- *
- * @return this content provider root element's children
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(
- * java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- if (rootNode == null)
- return new Object[0];
-
- return omitRoot ? rootNode.getChildren() : new Object[] {rootNode};
- }
-
- /**
- * Disposes of this content provider.
- * This is called by the viewer when it is disposed.
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- rootNode = null;
- }
-
- /**
- * Helper method that creates a root node given a node name and value.
- *
- * @param name the name of the node
- * @param value the value of the node. May be null.
- * @return the tree node created
- * @see TreeContentProviderNode#TreeContentProviderNode(String, Object)
- */
- protected TreeContentProviderNode createNode(String name, Object value) {
- return new TreeContentProviderNode(name, value);
- }
-
- /**
- * Helper method that creates a root node given a node name and no value.
- *
- * @param name the name of the node
- * @return the tree node created
- * @see TreeContentProviderNode#TreeContentProviderNode(String)
- */
- protected TreeContentProviderNode createNode(String name) {
- return new TreeContentProviderNode(name);
- }
-
- /**
- * Notifies this content provider that the given viewer's input
- * has been switched to a different element.
- * Rebuilds this content provider's state from a given resource.
- *
- * @param viewer the viewer
- * @param oldInput ignored
- * @param input the new input. If null, clears this content provider. If not,
- * is passed in a call to <code>rebuild(Object)</code>.
- * @see
- * org.eclipse.jface.viewers.IContentProvider#inputChanged(
- * org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- * @see #rebuild(Viewer, Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, final Object input) {
- if (input == null) {
- rootNode = createNode("root"); //$NON-NLS-1$
- return;
- }
-
- if (!acceptInput(input))
- return;
-
- rootNode = createNode("root"); //$NON-NLS-1$
- rebuild(viewer, input);
- }
-
- /**
- * Reconstructs this content provider data model upon the provided input object.
- *
- * @param input the new input object - must not be null
- * @param viewer the corresponding viewer
- */
- protected abstract void rebuild(Viewer viewer, Object input);
-
- /**
- * Returns true if the provided input is accepted by this content provider.
- *
- * @param input an input object
- * @return boolean true if the provided object is accepted, false otherwise
- */
- protected abstract boolean acceptInput(Object input);
-
- /**
- * Returns the rootNode.
- *
- * @return this content provider root node
- */
- protected TreeContentProviderNode getRootNode() {
- return rootNode;
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/BaseTextView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/BaseTextView.java
deleted file mode 100644
index 792c89e..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/BaseTextView.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.part.ViewPart;
-
-public class BaseTextView extends ViewPart {
- protected TextViewer viewer;
-
- public BaseTextView() {
- super();
- }
-
- public void createPartControl(Composite parent) {
- viewer = new TextViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY);
- viewer.setDocument(new Document());
-
- IActionBars bars = getViewSite().getActionBars();
-
- GlobalAction selectAllAction = new SelectAllAction(viewer);
- selectAllAction.registerAsGlobalAction(bars);
-
- GlobalAction copyAction = new CopyTextSelectionAction(viewer);
- copyAction.registerAsGlobalAction(bars);
-
- bars.updateActionBars();
-
- // creates a context menu with actions and adds it to the viewer control
- MenuManager menuMgr = new MenuManager();
- menuMgr.add(copyAction);
- menuMgr.add(selectAllAction);
- Menu menu = menuMgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- }
-
- public void setFocus() {
- // do nothing
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ByteUtil.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ByteUtil.java
deleted file mode 100644
index a8e9353..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ByteUtil.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-/**
- * A set of utility methods for dealing with byte arrays.
- */
-public class ByteUtil {
-
- /**
- * Helper method that creates a string representation for a byte array.
- *
- * @param byteArray a byte array to be represented as string
- * @param max a maximum number of bytes to be considered - if zero, there is
- * no maximum.
- * @return a byte array string representation
- */
- public static String byteArrayToString(byte[] byteArray, int max) {
- StringBuffer result = new StringBuffer(byteArray.length * 2 + 2);
- int bytesToBeShown = (max > 0) ? (Math.min(max, byteArray.length)) : byteArray.length;
- result.append('[');
- for (int i = 0; i < bytesToBeShown; i++) {
- result.append(byteArray[i]);
- result.append(',');
- }
- // adds an ellipsis if there is too much bytes to show
- if (max > 0 && max < byteArray.length)
- result.append("..."); //$NON-NLS-1$
- // or remove the trailing comma
- else
- result.deleteCharAt(result.length() - 1);
- result.append(']');
- return result.toString();
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ClearTextAction.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ClearTextAction.java
deleted file mode 100644
index bcf973f..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ClearTextAction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-
-/**
- * Generic "clear contents" action. Sets action's text, tool tip text and icon.
- */
-
-public class ClearTextAction extends GlobalAction {
-
- /**
- * The document on which this action performs its duty.
- */
- private IDocument document;
-
- /**
- * Constructs a ClearTextAction action with the provided document.
- *
- * @param document the document to be cleared when this action is run.
- */
- public ClearTextAction(IDocument document) {
- super("Cle&ar Contents"); //$NON-NLS-1$
- this.setToolTipText("Clear contents"); //$NON-NLS-1$
- this.document = document;
- // the delete key is not captured by the workbench
- // then we need to provide an action definition id
- // so clients can register this action in their key binding services
- this.setActionDefinitionId(IWorkbenchActionDefinitionIds.DELETE);
- this.setImageDescriptor(CoreToolsPlugin.createImageDescriptor("clear.gif")); //$NON-NLS-1$
- }
-
- /**
- * Executes this action (clears associated document's contents).
- */
- public void run() {
- document.set(""); //$NON-NLS-1$
- }
-
- /**
- * Registers this action as a global action handler.
- *
- * @param actionBars the action bars where this action will be registered.
- * @see GlobalAction#registerAsGlobalAction(org.eclipse.ui.IActionBars)
- */
- public void registerAsGlobalAction(IActionBars actionBars) {
- actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), this);
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CollapseAllAction.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CollapseAllAction.java
deleted file mode 100644
index 7c119e0..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CollapseAllAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.TreeViewer;
-
-/**
- * @since 3.0
- */
-public class CollapseAllAction extends Action implements IAction {
-
- private static final String label = "Collapse All"; //$NON-NLS-1$
- private static final String imageName = "collapseall.gif"; //$NON-NLS-1$
- private TreeViewer viewer;
-
- public CollapseAllAction(TreeViewer viewer) {
- super(label);
- this.setToolTipText(label);
- this.viewer = viewer;
- this.setImageDescriptor(CoreToolsPlugin.createImageDescriptor(imageName));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- viewer.collapseAll();
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CopyStructuredSelectionAction.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CopyStructuredSelectionAction.java
deleted file mode 100644
index 4177449..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CopyStructuredSelectionAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import java.util.Iterator;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-/**
- * A concrete implementation for <code>AbstractCopySelectionAction</code> that
- * supports structured selections.
- *
- * @see org.eclipse.jface.viewers.IStructuredSelection
- */
-public class CopyStructuredSelectionAction extends AbstractCopySelectionAction {
-
- /**
- * @see org.eclipse.core.tools.AbstractCopySelectionAction#AbstractCopySelectionAction(ISelectionProvider)
- */
- public CopyStructuredSelectionAction(ISelectionProvider selectionProvider) {
- super(selectionProvider);
- }
-
- /**
- * Returns the current structured selection as a string object where each
- * node is followed by a line terminator char. This method depends on the
- * toString() method of each node to define a reasonably formatted string
- * for display.
- *
- * @return a string containing the currently selected elements separated by
- * line terminators
- * @see org.eclipse.core.tools.AbstractCopySelectionAction#getContents()
- */
- public String getContents() {
- // retrieves the selected contents from the selection provider
- IStructuredSelection selection = (IStructuredSelection) selectionProvider.getSelection();
- StringBuffer content = new StringBuffer();
- for (Iterator selectionIter = selection.iterator(); selectionIter.hasNext();) {
- content.append(selectionIter.next());
- content.append('\n');
- }
- return content.toString();
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CopyTextSelectionAction.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CopyTextSelectionAction.java
deleted file mode 100644
index d3ac9fe..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CopyTextSelectionAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-/**
- * A concrete implementation for <code>AbstractCopySelectionAction</code> that
- * supports text selections.
- *
- * @see org.eclipse.jface.text.ITextSelection
- */
-public class CopyTextSelectionAction extends AbstractCopySelectionAction {
-
- /**
- * @see AbstractCopySelectionAction#AbstractCopySelectionAction
- * (ISelectionProvider)
- */
- public CopyTextSelectionAction(ISelectionProvider selectionProvider) {
- super(selectionProvider);
- }
-
- /**
- * Returns the current text selection.
- *
- * @return a string containing the currently selected text
- * @see org.eclipse.core.tools.AbstractCopySelectionAction#getContents()
- */
- protected String getContents() {
- return ((ITextSelection) selectionProvider.getSelection()).getText();
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CoreToolsPlugin.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CoreToolsPlugin.java
deleted file mode 100644
index 8f07235..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CoreToolsPlugin.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import java.net.URL;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.internal.stats.ClassloaderStats;
-import org.eclipse.core.runtime.internal.stats.StatsManager;
-import org.eclipse.core.tools.runtime.VMClassInfo;
-import org.eclipse.core.tools.runtime.VMClassloaderInfo;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-public class CoreToolsPlugin extends AbstractUIPlugin {
- private static CoreToolsPlugin instance;
- public static String PI_TOOLS = "org.eclipse.core.tools"; //$NON-NLS-1$
- private BundleContext context;
-
- static {
- if (StatsManager.MONITOR_ACTIVATION)
- initializeBootClasses();
- }
-
- public static CoreToolsPlugin getDefault() {
- return instance;
- }
-
- private static void initializeBootClasses() {
- if (!VMClassloaderInfo.hasNatives)
- return;
- ClassloaderStats loader = ClassloaderStats.getLoader("org.eclipse.osgi"); //$NON-NLS-1$
- //class loading trace option not enabled
- if (loader == null)
- return;
- VMClassInfo[] classes = VMClassloaderInfo.getBaseClasses();
- String[] names = new String[classes.length];
- for (int i = 0; i < classes.length; i++)
- names[i] = classes[i].getName();
- loader.addBaseClasses(names);
- }
-
- /**
- * find an icon - caller must dispose of it
- */
- public static ImageDescriptor createImageDescriptor(String imageName) {
- URL url = getDefault().getBundle().getEntry("icons/" + imageName); //$NON-NLS-1$
- if (url != null)
- return ImageDescriptor.createFromURL(url);
- return ImageDescriptor.getMissingImageDescriptor();
- }
-
- public CoreToolsPlugin() {
- super();
- instance = this;
- }
-
- public void start(BundleContext bundleContext) throws Exception {
- super.start(bundleContext);
- this.context = bundleContext;
- }
-
- public BundleContext getContext() {
- return context;
- }
-
- public void log(String message, Throwable exception) {
- getLog().log(new Status(IStatus.ERROR, PI_TOOLS, 0, message, exception));
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/DeepSize.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/DeepSize.java
deleted file mode 100644
index 062944e..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/DeepSize.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.*;
-
-/**
- * How to use DeepSize:
- * DeepSize result= DeepSize.deepSize(anObject);
- * int size= result.getSize(); // accumulated size of transitive closure of anObject
- * Hashtable sizes= result.getSizes(); // hashtable of internal results: class name-> sum of shallowsize of instances of class
- * Hashtable counts= result.getCounts(); // hashtable of internal results: class name -> instances of class
- * Additional function
- * DeepSize d= new DeepSize();
- * d.setIgnoreTypeNames(aSet); // don't consider instances of classes named in aSet as part of the size
- * d.ignore(anObject); // don't consider anObject as part of the size
- * d.deepCompute(anObject); // advanced compute method - computes the size given the additional ignore configuration
- */
-public class DeepSize {
- /**
- * Used as keys to track sets of non-identical objects.
- */
- public static class ObjectWrapper {
- private Object object;
-
- public ObjectWrapper(Object object) {
- this.object = object;
- }
-
- public boolean equals(Object o) {
- if (o.getClass() != ObjectWrapper.class)
- return false;
- return object == ((ObjectWrapper) o).object;
- }
-
- public int hashCode() {
- return object == null ? 1 : object.hashCode();
- }
-
- public String toString() {
- return "ObjectWrapper(" + object + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- public static final int ARRAY_HEADER_SIZE = 12;
-
- public static final int HEADER_SIZE = 8;
- static final HashSet ignoreSet = new HashSet();
- public static final int OBJECT_HEADER_SIZE = HEADER_SIZE;
- public static final int POINTER_SIZE = 4;
- int byteSize;
- final Map counts = new HashMap();
-
- Set ignoreTypeNames = null;
- final Map sizes = new HashMap();
-
- /**
- * Adds an object to the ignore set. Returns true if the object
- * has already been ignored previously, and false otherwise.
- */
- public static boolean ignore(Object o) {
- return !ignoreSet.add(new ObjectWrapper(o));
- }
-
- public static void reset() {
- ignoreSet.clear();
- }
-
- private void count(Class c, int size) {
- Object accumulatedSizes = sizes.get(c);
- int existingSize = (accumulatedSizes == null) ? 0 : ((Integer) accumulatedSizes).intValue();
- sizes.put(c, new Integer(existingSize + size));
-
- Object accumulatedCounts = counts.get(c);
- int existingCount = (accumulatedCounts == null) ? 0 : ((Integer) accumulatedCounts).intValue();
- counts.put(c, new Integer(existingCount + 1));
- }
-
- public void deepSize(Object o) {
- byteSize += sizeOf(o);
- }
-
- public Map getCounts() {
- return counts;
- }
-
- Set getDefaultIgnoreTypeNames() {
- Set ignored = new HashSet();
- String[] ignore = {"org.eclipse.core.runtime.Plugin", "java.lang.ClassLoader", "org.eclipse.team.internal.ccvs.core.CVSTeamProvider", "org.eclipse.core.internal.events.BuilderPersistentInfo", "org.eclipse.core.internal.resources.Workspace", "org.eclipse.core.internal.events.EventStats"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-6$
- for (int i = 0; i < ignore.length; i++) {
- ignored.add(ignore[i]);
- }
- return ignored;
- }
-
- private Object getFieldObject(Field f, Object o) {
- try {
- f.setAccessible(true);
- return f.get(o);
- } catch (IllegalAccessException e) {
- throw new Error(e.toString());
- }
- }
-
- public int getSize() {
- return byteSize;
- }
-
- public Map getSizes() {
- return sizes;
- }
-
- private boolean isStaticField(Field f) {
- return (Modifier.STATIC & f.getModifiers()) != 0;
- }
-
- /**
- * Prints a detailed report of memory usage by type to standard output
- */
- public void printSizeReport() {
- System.out.println("*** Begin DeepSize report ***"); //$NON-NLS-1$
- for (Iterator it = sizes.keySet().iterator(); it.hasNext();) {
- Class clazz = (Class) it.next();
- int size = ((Integer) sizes.get(clazz)).intValue();
- System.out.println('\t' + clazz.getName() + " size: " + size); //$NON-NLS-1$
- System.out.println("Total size of all objects: " + getSize()); //$NON-NLS-1$
- }
- System.out.println("*** End DeepSize report ***"); //$NON-NLS-1$
- }
-
- void setIgnoreTypeNames(Set ignore) {
- ignoreTypeNames = ignore;
- }
-
- private boolean shouldIgnoreType(Class clazz) {
- if (ignoreTypeNames == null) {
- ignoreTypeNames = getDefaultIgnoreTypeNames();
- }
- while (clazz != null) {
- if (ignoreTypeNames.contains(clazz.getName()))
- return true;
- clazz = clazz.getSuperclass();
- }
- return false;
- }
-
- private int sizeOf(Object o) {
- if (o == null)
- return 0;
- if (ignore(o))
- return 0;
- Class clazz = o.getClass();
- if (shouldIgnoreType(clazz))
- return 0;
- return clazz.isArray() ? sizeOfArray(clazz, o) : sizeOfObject(clazz, o);
- }
-
- private int sizeOfArray(Class type, Object array) {
-
- int size = ARRAY_HEADER_SIZE;
- Class componentType = type.getComponentType();
- if (componentType.isPrimitive()) {
-
- if (componentType == char.class) {
- char[] a = (char[]) array;
- size += a.length * 2;
- } else if (componentType == int.class) {
- int[] a = (int[]) array;
- size += a.length * 4;
- } else if (componentType == byte.class) {
- byte[] a = (byte[]) array;
- size += a.length;
- } else if (componentType == short.class) {
- short[] a = (short[]) array;
- size += a.length * 2;
- } else if (componentType == long.class) {
- long[] a = (long[]) array;
- size += a.length * 8;
- } else {
- //TODO: primitive arrays
- System.out.println(componentType);
- }
- count(type, size);
- return size;
- }
- Object[] a = (Object[]) array;
- for (int i = 0; i < a.length; i++) {
- size += POINTER_SIZE + sizeOf(a[i]);
- }
- count(type, ARRAY_HEADER_SIZE + POINTER_SIZE * a.length);
- return size;
-
- }
-
- private int sizeOfObject(Class type, Object o) {
-
- int internalSize = 0; // size of referenced objects
- int shallowSize = OBJECT_HEADER_SIZE;
- Class clazz = type;
- while (clazz != null) {
- Field[] fields = clazz.getDeclaredFields();
- for (int i = 0; i < fields.length; i++) {
- Field f = fields[i];
- if (!isStaticField(f)) {
- Class fieldType = f.getType();
- if (fieldType.isPrimitive()) {
- shallowSize += sizeOfPrimitiveField(fieldType);
- } else {
- shallowSize += POINTER_SIZE;
- internalSize += sizeOf(getFieldObject(f, o));
- }
- }
- }
- clazz = clazz.getSuperclass();
- }
- count(type, shallowSize);
- return shallowSize + internalSize;
-
- }
-
- private int sizeOfPrimitiveField(Class type) {
- if (type == long.class || type == double.class)
- return 8;
- return 4;
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ErrorUtil.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ErrorUtil.java
deleted file mode 100644
index 0dc496e..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ErrorUtil.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * A helper class that supports error report and logging for
- * Spy plug-in classes.
- */
-public class ErrorUtil {
-
- /**
- * Logs the provided exception and user message in Spy plug-in's log.
- *
- * @param exception the exception to be logged
- * @param userMessage an optional higher-level explanation for the exception
- */
- public static void logException(Exception exception, String userMessage) {
- String pluginID = CoreToolsPlugin.PI_TOOLS;
- if (userMessage == null)
- userMessage = exception.getMessage();
- IStatus status = new Status(IStatus.ERROR, pluginID, -1, userMessage, exception);
- CoreToolsPlugin.getDefault().getLog().log(status);
- }
-
- /**
- * Shows the provided message using a MessageDialog.
- *
- * @param message
- * @param title
- * @see org.eclipse.jface.dialogs.MessageDialog#openError(Shell,String,String)
- */
- public static void showErrorMessage(String message, String title) {
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- if (title == null)
- title = "Error in Spy plug-in"; //$NON-NLS-1$
- MessageDialog.openError(shell, title, message);
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/GlobalAction.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/GlobalAction.java
deleted file mode 100644
index 09c18cd..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/GlobalAction.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.IActionBars;
-
-/**
- * An abstract base class for global actions. Global actions
- * are able to register themselves in a view's action bars.
- */
-public abstract class GlobalAction extends Action {
- /**
- * Constructs an action.
- *
- * @param text the action description
- */
- GlobalAction(String text) {
- super(text);
- setToolTipText(text);
- }
-
- /**
- * Registers this action as a global action handler.
- *
- * @param actionBars the action bars where this action will be registered.
- * @see IActionBars#updateActionBars()
- */
- public abstract void registerAsGlobalAction(IActionBars actionBars);
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/IFlattable.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/IFlattable.java
deleted file mode 100644
index dc071ce..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/IFlattable.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-/**
- * Interface indicating if a view (normally a tree) support a flat display
- */
-public interface IFlattable {
- public void setFlat(boolean mode);
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ISorter.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ISorter.java
deleted file mode 100644
index 11d57f9..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ISorter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-public interface ISorter {
- public boolean isReversed();
-
- public void setReversed(boolean value);
-
- public int getColumnNumber();
-
- public int states();
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ITreeNodeVisitor.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ITreeNodeVisitor.java
deleted file mode 100644
index 6be51cc..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ITreeNodeVisitor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-/**
- * This interface is implemented by objects that visit trees made of
- * <code>TreeContentProviderNode</code> objects.
- *
- * @see org.eclipse.core.tools.TreeContentProviderNode#accept(ITreeNodeVisitor)
- */
-public interface ITreeNodeVisitor {
- /**
- * Visits the given node.
- *
- * @param node the node to visit
- * @return <code>true</code> if the node's child nodes should be visited;
- * <code>false</code> if they should be skipped
- */
- public boolean visit(TreeContentProviderNode node);
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/Messages.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/Messages.java
deleted file mode 100644
index eefda62..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/Messages.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.core.tools;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.core.tools.messages";//$NON-NLS-1$
-
- // Stats View
- public static String stats_eventHeader;
- public static String stats_blameHeader;
- public static String stats_contextHeader;
- public static String stats_countHeader;
- public static String stats_timeHeader;
-
- public static String stats_badStat;
- public static String stats_badColumn;
- public static String stats_pluginid;
-
- // Resource Spy
- public static String resource_error_unknown_resource_impl;
-
- public static String resource_file;
- public static String resource_folder;
- public static String resource_project;
- public static String resource_root;
- public static String resource_full_path;
- public static String resource_content_id;
- public static String resource_type;
- public static String resource_node_id;
- public static String resource_local_sync_info;
-
- public static String resource_persistent_properties;
- public static String resource_error_stored_properties;
-
- public static String resource_session_properties;
-
- public static String resource_flags;
- public static String resource_open;
- public static String resource_local_exists;
- public static String resource_phantom;
- public static String resource_used;
- public static String resource_derived;
- public static String resource_team_private;
- public static String resource_hidden;
- public static String resource_markers_snap_dirty;
- public static String resource_sync_info_snap_dirty;
- public static String resource_no_content_description;
- public static String resource_default_content_description;
-
- public static String resource_content_description;
- public static String resource_error_content_description;
- public static String resource_content_description_from_cache;
-
- public static String resource_markers;
- public static String resource_error_marker;
-
- public static String resource_sync_info;
-
- public static String depend_noInformation;
- public static String depend_noParentPlugins;
- public static String depend_requiredBy;
- public static String depend_noChildrenPlugins;
- public static String depend_requires;
- public static String depend_badPluginId;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/SelectAllAction.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/SelectAllAction.java
deleted file mode 100644
index a53328d..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/SelectAllAction.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.actions.ActionFactory;
-
-public class SelectAllAction extends GlobalAction {
-
- private ITextOperationTarget target;
-
- public SelectAllAction(ITextOperationTarget target) {
- super("Select &All"); //$NON-NLS-1$
- this.target = target;
- }
-
- /**
- * Registers this action as a global action handler.
- *
- * @param actionBars the action bars where this action will be registered.
- * @see org.eclipse.core.tools.GlobalAction#registerAsGlobalAction(org.eclipse.ui.IActionBars)
- */
- public void registerAsGlobalAction(IActionBars actionBars) {
- actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), this);
- }
-
- /**
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- target.doOperation(ITextOperationTarget.SELECT_ALL);
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/SpyView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/SpyView.java
deleted file mode 100644
index 98b02c8..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/SpyView.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * A common base class for all Spy Plug-in views
- */
-public abstract class SpyView extends ViewPart {
- /**
- * SpyView constructor comment.
- */
- public SpyView() {
- super();
- }
-
- /**
- * Asks this part to take focus within the workbench. Does nothing.
- */
- public void setFocus() {
- // do nothing
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TableSelectionProviderDecorator.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TableSelectionProviderDecorator.java
deleted file mode 100644
index aab013f..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TableSelectionProviderDecorator.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import java.util.Iterator;
-import org.eclipse.core.runtime.PerformanceStats;
-import org.eclipse.jface.viewers.*;
-
-/**
- * This class provides a decorator for ISelectionProviders that use
- * TableViewer as their viewer and PluginStats as the basis for their data
- * model. The only affected method is <code>getSelection()</code>, which will
- * return a string that closely resembles the table view of this object.
- *
- */
-public class TableSelectionProviderDecorator implements ISelectionProvider {
-
- /** The decorated selection provider. */
- private ISelectionProvider selectionProvider;
-
- /**
- * Constructs a <code>TableSelectionProviderDecorator</code> having
- * the given selection provider as its decorated object.
- *
- * @param selectionProvider the selection provider to be decorated
- */
- public TableSelectionProviderDecorator(ISelectionProvider selectionProvider) {
- this.selectionProvider = selectionProvider;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- selectionProvider.addSelectionChangedListener(listener);
- }
-
- /**
- * Returns the current selection for this provider. If the selection is a
- * structured selection made of <code>PluginStats</code> elements, this method
- * will return a structured selection of strings that resemble the table view
- * of this data.
- *
- * @return the current selection, printed in table view format
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
- */
- public ISelection getSelection() {
- // gets the original selection object
- ISelection selection = selectionProvider.getSelection();
-
- // in these cases the original selection will be returned
- if (selection == null || selection.isEmpty() || !(selection instanceof IStructuredSelection))
- return selection;
-
- // constructs a list with the selected elements
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
-
- StringBuffer copyText = new StringBuffer();
- copyText.append(headerPluginStats());
- copyText.append('\n');
- for (Iterator selectionIter = structuredSelection.iterator(); selectionIter.hasNext();) {
- Object obj = selectionIter.next();
- if (obj instanceof PerformanceStats) {
- copyText.append(prettyPluginStats((PerformanceStats) obj));
- copyText.append('\n');
- }
- }
- return new StructuredSelection(copyText);
-
- }
-
- private String headerPluginStats() {
- String retString = ""; //$NON-NLS-1$
- retString += Messages.stats_eventHeader + "\t"; //$NON-NLS-1$
- retString += Messages.stats_blameHeader + "\t"; //$NON-NLS-1$
- retString += Messages.stats_contextHeader + "\t"; //$NON-NLS-1$
- retString += Messages.stats_countHeader + "\t"; //$NON-NLS-1$
- retString += Messages.stats_timeHeader + "\t"; //$NON-NLS-1$
- return retString;
- }
-
- private String prettyPluginStats(PerformanceStats stats) {
- String retString = ""; //$NON-NLS-1$
- retString += stats.getEvent() + "\t\t"; //$NON-NLS-1$
- retString += stats.getBlameString() + "\t\t"; //$NON-NLS-1$
- retString += stats.getContext() + "\t\t"; //$NON-NLS-1$
- retString += stats.getRunCount() + "\t"; //$NON-NLS-1$
- retString += stats.getRunningTime() + "\t"; //$NON-NLS-1$
- return retString;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- selectionProvider.removeSelectionChangedListener(listener);
- }
-
- /**
- * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
- */
- public void setSelection(ISelection selection) {
- selectionProvider.setSelection(selection);
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TableWithTotalView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TableWithTotalView.java
deleted file mode 100644
index c61aeab..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TableWithTotalView.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import java.util.Iterator;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.TableTree;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * Abstract class representing a view made of two tables.
- * The first one is used to display data and the second to display totals of the
- * data showed in the first table.
- */
-public abstract class TableWithTotalView extends ViewPart implements ISelectionProvider {
- protected TableTreeViewer viewer; // Table tree viewer used to contain all the data but the total
- protected TableTree tableTree; // The table tree that will populate the viewer
- protected Table totalTable; // The table used to display the totals
- protected boolean flat; // Flag indicating the view mode
- protected Clipboard clipboard;
- protected Action copyAction;
- protected Action selectAllAction;
-
- abstract protected String[] getColumnHeaders();
-
- abstract protected ColumnLayoutData[] getColumnLayout();
-
- abstract protected void createActions();
-
- abstract protected void createToolbar();
-
- abstract protected void createContextMenu();
-
- private SelectionListener getColumnListener() {
- return new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent event) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent event) {
- // column selected - need to sort
- int column = viewer.getTableTree().getTable().indexOf((TableColumn) event.widget);
-
- ISorter oldSorter = (ISorter) viewer.getSorter();
- boolean threeState = oldSorter.states() == 3;
- ISelection selection = viewer.getSelection();
-
- // first check to see if we are changing sort columns.
- // If so, set flatness and get a new sorter
- if (oldSorter == null || !threeState || column != oldSorter.getColumnNumber()) {
- flat = column != 0; // default for column 0 is NOT flat
- viewer.setSorter(getSorter(column));
- } else {
- // Not changing sorters so we have to cycle through states for the columns
- // Three state sort for column 0. !flat/!reverse -> flat/!reverse -> flat/reverse
- if (column == 0) {
- if (flat) {
- if (oldSorter.isReversed())
- flat = false;
- oldSorter.setReversed(!oldSorter.isReversed());
- } else {
- flat = true;
- oldSorter.setReversed(false);
- }
- } else { // for all other columns flatten and simply reverse
- flat = true;
- oldSorter.setReversed(!oldSorter.isReversed());
- }
- }
- if (viewer.getContentProvider() instanceof IFlattable)
- ((IFlattable) viewer.getContentProvider()).setFlat(flat);
- viewer.refresh();
- viewer.setSelection(selection);
- }
- };
- }
-
- protected ControlListener getColumnResizeListener() {
- return new ControlListener() {
- public void controlMoved(ControlEvent event) {
- // do nothing
- }
-
- public void controlResized(ControlEvent event) {
- TableColumn column = (TableColumn) event.widget;
- int columnNumber = viewer.getTableTree().getTable().indexOf(column);
- totalTable.getColumn(columnNumber).setWidth(column.getWidth());
- }
- };
- }
-
- private void createTables(Composite parent) {
- // create a first table, that will display all the data
- tableTree = new TableTree(parent, SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
- tableTree.setLayoutData(new GridData(GridData.FILL_BOTH));
- Table table = tableTree.getTable();
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- TableLayout tableLayout = new TableLayout();
- table.setLayout(tableLayout);
-
- SelectionListener headerListener = getColumnListener();
-
- // create a second table for totals
- totalTable = new Table(parent, 0);
- GridData gridInfo = new GridData(GridData.FILL_HORIZONTAL);
- gridInfo.heightHint = totalTable.getItemHeight();
- totalTable.setLayoutData(gridInfo);
- totalTable.setHeaderVisible(false);
- totalTable.setLinesVisible(true);
- TableLayout totalLayout = new TableLayout();
- totalTable.setLayout(totalLayout);
-
- ControlListener columnResizeListener = getColumnResizeListener();
- //create the columns for the two tables
- ColumnLayoutData[] columnLayout = getColumnLayout();
- String[] headers = getColumnHeaders();
- for (int i = 0; i < getColumnHeaders().length; i++) {
- // column for the first table
- tableLayout.addColumnData(columnLayout[i]);
- TableColumn column = new TableColumn(table, SWT.NONE, i);
- column.setResizable(true);
- column.setText(headers[i]);
- column.addSelectionListener(headerListener);
- // "connect" the two tables so the width of their column evolve simultaneously
- // more precisely here, only the resize of the first table will trigger a resize of the second one
- column.addControlListener(columnResizeListener);
-
- // column for the second table
- totalLayout.addColumnData(columnLayout[i]);
- column = new TableColumn(totalTable, SWT.NONE, i);
- column.setResizable(true);
- }
- }
-
- protected abstract ITreeContentProvider getContentProvider();
-
- protected abstract ITableLabelProvider getLabelProvider();
-
- protected abstract ViewerSorter getSorter(int column);
-
- protected abstract String getStatusLineMessage(Object element);
-
- public void createPartControl(Composite parent) {
- Composite composite = new Composite(parent, 0);
- // crete a grid layout of one column
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- composite.setLayout(layout);
-
- createTables(composite);
-
- clipboard = new Clipboard(parent.getDisplay());
- //create the viewer
- viewer = new TableTreeViewer(tableTree);
- viewer.setContentProvider(getContentProvider());
- viewer.setLabelProvider(getLabelProvider());
- viewer.setSorter(getSorter(0));
- viewer.addSelectionChangedListener(getTableListener());
-
- createCommonActions();
- createActions();
- createToolbar();
- createContextMenu();
- }
-
- abstract protected String[] computeTotalLine(Iterator elements);
-
- private void createCommonActions() {
- copyAction = new Action() {
- public void run() {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- String result = ""; //$NON-NLS-1$
- String[] columnHeaders = getColumnHeaders();
- for (int i = 0; i < columnHeaders.length; i++)
- result += columnHeaders[i] + ","; //$NON-NLS-1$
- result += "\n\n"; //$NON-NLS-1$
-
- ITableLabelProvider labelProvider = (ITableLabelProvider) viewer.getLabelProvider();
- for (Iterator iterator = selection.iterator(); iterator.hasNext();) {
- Object selectedItem = iterator.next();
- for (int i = 0; i < columnHeaders.length; i++)
- result += labelProvider.getColumnText(selectedItem, i) + ","; //$NON-NLS-1$
- result += "\n"; //$NON-NLS-1$
- }
- clipboard.setContents(new Object[] {result}, new Transfer[] {TextTransfer.getInstance()});
- }
- };
- IActionBars actionBars = getViewSite().getActionBars();
- actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction);
-
- selectAllAction = new Action() {
- public void run() {
- tableTree.selectAll();
- // force viewer selection change
- viewer.setSelection(viewer.getSelection());
- }
- };
- actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectAllAction);
- }
-
- protected ISelectionChangedListener getTableListener() {
- return new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- IStructuredSelection selection = (IStructuredSelection) e.getSelection();
- copyAction.setEnabled(!selection.isEmpty());
- if (selection.size() == 1) {
- String message = getStatusLineMessage(selection.getFirstElement());
- getViewSite().getActionBars().getStatusLineManager().setMessage(message);
- }
- totalTable.removeAll();
- updateTotals();
- }
- };
- }
-
- public void updateTotals() {
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- TableItem item = new TableItem(totalTable, 0);
- item.setText(computeTotalLine(selection.iterator()));
- }
-
- public ISelection getSelection() {
- return viewer.getSelection();
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- // do nothing
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- // do nothing
- }
-
- public void setSelection(ISelection selection) {
- // do nothing
- }
-
- public void setFocus() {
- if (tableTree != null)
- tableTree.setFocus();
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TreeContentProviderNode.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TreeContentProviderNode.java
deleted file mode 100644
index 13f5a21..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TreeContentProviderNode.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import java.util.*;
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * Represents a node (possibly containing children) in a tree content
- * provider model. Every node has a name and optionally a value.
- */
-public class TreeContentProviderNode implements Comparable, IAdaptable {
-
- /**
- * A list containing this node's children.
- */
- private List children;
-
- /**
- * This node's name (may be null).
- */
- private String name;
-
- /**
- * This node's value (may be null).
- */
- private Object value;
-
- /**
- * This node's parent node.
- */
- private TreeContentProviderNode parent;
-
- /**
- * Constructs a TreeContentProviderNode with the given name and value.
- *
- * @param name this node's name (may be null, if value is not null)
- * @param value this node's value (may be null, if name is not null)
- */
- public TreeContentProviderNode(String name, Object value) {
- this.name = name;
- this.value = value;
- }
-
- /**
- * Constructs a TreeContentProviderNode with the given name.
- *
- * @param name this node's name (may not be null).
- */
- public TreeContentProviderNode(String name) {
- this(name, null);
- }
-
- /**
- * Sets this node's parent.
- *
- * @param parent this node's new parent
- */
- private void setParent(TreeContentProviderNode parent) {
- this.parent = parent;
- }
-
- /**
- * Adds a new child. If the child is a TreeContentProviderNode, sets its parent
- * to this object.
- *
- * @param child a new child to be added.
- */
- public void addChild(Object child) {
- // lazilly instantiates the children's list
- if (this.children == null) {
- this.children = new ArrayList();
- }
- this.children.add(child);
- if (child instanceof TreeContentProviderNode) {
- TreeContentProviderNode childNode = (TreeContentProviderNode) child;
- childNode.setParent(this);
- }
- }
-
- /**
- * Returns an array containing all children this node has. If this node
- * has no children, returns an empty array.
- *
- * @return an array containing this node's children.
- */
- public Object[] getChildren() {
- return children == null ? new Object[0] : children.toArray();
- }
-
- /**
- * Returns a boolean indicating if this node has any children.
- *
- * @return true, if this node has children, false otherwise
- */
- public boolean hasChildren() {
- return children != null && !children.isEmpty();
- }
-
- /**
- * Returns a string representation of the object.
- *
- * @see java.lang.Object#toString()
- */
- public String toString() {
- if (name == null)
- return value.toString();
- if (value == null)
- return name;
- return name + " = " + value; //$NON-NLS-1$
- }
-
- /**
- * Returns this node's parent node.
- *
- * @return this node's parent node or null, if this node is a root
- */
- public TreeContentProviderNode getParent() {
- return parent;
- }
-
- /**
- * Returns this node's value (may be null).
- *
- * @return this node's value
- */
- public Object getValue() {
- return value;
- }
-
- /**
- * Returns a boolean indicating if this node is root or not.
- *
- * @return true if this node is root, false otherwise
- */
- public boolean isRoot() {
- return parent == null;
- }
-
- /**
- * Sorts this node's children list in ascending order. The children are
- * ordered by name. Any changes in the children list will potentially
- * invalidate the ordering. All children must be instances of
- * <code>TreeContentProviderNode</code>.
- */
- public void sort() {
- if (children == null)
- return;
- Collections.sort(children);
- }
-
- /**
- * Compares this node with another node.
- *
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(Object other) {
- TreeContentProviderNode otherNode = (TreeContentProviderNode) other;
- return this.name.compareTo(otherNode.name);
- }
-
- /**
- * Accepts the given visitor. The visitor's <code>visit</code> method is called
- * with this node. If the visitor returns <code>true</code>, this method visits
- * this node's child nodes.
- *
- * @param visitor the visitor
- * @see ITreeNodeVisitor#visit
- */
- public void accept(ITreeNodeVisitor visitor) {
- if (!visitor.visit(this))
- return;
- if (children == null)
- return;
- for (Iterator childrenIter = children.iterator(); childrenIter.hasNext();) {
- Object child = childrenIter.next();
- // child nodes don't need to be TreeContentProviderNodes
- if (child instanceof TreeContentProviderNode)
- ((TreeContentProviderNode) child).accept(visitor);
- }
- }
-
- /**
- * Returns this node's tree root node. If this node is a root node, returns itself.
- *
- * @return this node's tree root node
- */
- public TreeContentProviderNode getRoot() {
- return this.getParent() == null ? this : this.getParent().getRoot();
- }
-
- /**
- * Returns this node's immediate child that has the given value.
- *
- * @return a tree node, or <code>null</code>
- */
- public TreeContentProviderNode findNode(Object obj) {
- if (obj.equals(this.value))
- return this;
- if (children == null || children.isEmpty())
- return null;
- for (Iterator i = children.iterator(); i.hasNext();) {
- TreeContentProviderNode found = ((TreeContentProviderNode) i.next()).findNode(obj);
- if (found != null)
- return found;
- }
- return null;
- }
-
- public Object getAdapter(Class adapter) {
- return value instanceof IAdaptable ? ((IAdaptable) value).getAdapter(adapter) : null;
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TreeSelectionProviderDecorator.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TreeSelectionProviderDecorator.java
deleted file mode 100644
index 0be29ff..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TreeSelectionProviderDecorator.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import java.util.*;
-import org.eclipse.jface.viewers.*;
-
-/**
- * This class provides a decorator for ISelectionProviders that use
- * TreeContentProviderNode as the basis for their data model.
- * The only affected method is <code>getSelection()</code>, which will return a
- * selection object that provides selected elements in the same order they
- * appear in the tree.
- *
- * <p>This class is an workaround to the SWT's <code>Tree.getSelection()</code>
- * method, which returns an array of selected elements without preserving the
- * order they appear in the tree widget.</p>
- */
-public class TreeSelectionProviderDecorator implements ISelectionProvider {
-
- /** The decorated selection provider. */
- private ISelectionProvider selectionProvider;
-
- /**
- * Constructs a <code>TreeSelectionProviderDecorator</code> having the given
- * selection provider as its decorated object.
- *
- * @param selectionProvider the selection provider to be decorated
- */
- public TreeSelectionProviderDecorator(ISelectionProvider selectionProvider) {
- this.selectionProvider = selectionProvider;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- selectionProvider.addSelectionChangedListener(listener);
- }
-
- /**
- * Returns the current selection for this provider. If the selection is a
- * structured selection made of <code>TreeContentProviderNode</code>
- * elements, this method will return a structured selection where the order of
- * elements is the same order the elements appear in the tree (only for tree
- * elements that are instances of <code>TreeContentProviderNode</code>).
- *
- * @return the current selection, ordered in the same sequence they appear in
- * the tree
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
- */
- public ISelection getSelection() {
- // gets the original selection object
- ISelection selection = selectionProvider.getSelection();
-
- // in these cases the original selection will be returned
- if (selection == null || selection.isEmpty() || !(selection instanceof IStructuredSelection))
- return selection;
-
- // constructs a list with the selected elements
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- final List selectedElements = new ArrayList(structuredSelection.toList());
-
- // tries to find a TreeContentProviderNode between the selected elements
- TreeContentProviderNode anyNode = findNodeElement(selectedElements);
-
- // if there is no TreeContentProviderNodes, there is nothing to do
- if (anyNode == null)
- return selection;
-
- // otherwise, we will move the elements to a new list in the same order
- // we find them in the tree.
- final List orderedElements = new LinkedList();
-
- // uses a visitor to traverse the whole tree
- // when a visited node is the selected list, it is moved to the ordered list
- anyNode.getRoot().accept(new ITreeNodeVisitor() {
- public boolean visit(TreeContentProviderNode node) {
- int elementIndex = selectedElements.indexOf(node);
-
- if (selectedElements.contains(node))
- orderedElements.add(selectedElements.remove(elementIndex));
-
- return true;
- }
- });
-
- // any remaining elements in the list (probably they are not tree nodes)
- // are copied to the end of the ordered list
- orderedElements.addAll(selectedElements);
- return new StructuredSelection(orderedElements);
- }
-
- /**
- * Returns the first element in the list that is instance of
- * <code>TreeContentProviderNode</code>.
- *
- * @return the first element that is a tree node or null, if none is found.
- */
- private TreeContentProviderNode findNodeElement(List elements) {
- for (Iterator iter = elements.iterator(); iter.hasNext();) {
- Object element = iter.next();
- if (element instanceof TreeContentProviderNode)
- return (TreeContentProviderNode) element;
- }
-
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- selectionProvider.removeSelectionChangedListener(listener);
- }
-
- /**
- * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
- */
- public void setSelection(ISelection selection) {
- selectionProvider.setSelection(selection);
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TreeTextOperationTarget.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TreeTextOperationTarget.java
deleted file mode 100644
index ca199d2..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TreeTextOperationTarget.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.swt.widgets.Tree;
-
-public class TreeTextOperationTarget implements ITextOperationTarget {
-
- private Tree tree;
-
- public TreeTextOperationTarget(Tree tree) {
- this.tree = tree;
- }
-
- /**
- * @see org.eclipse.jface.text.ITextOperationTarget#canDoOperation(int)
- */
- public boolean canDoOperation(int operation) {
- return true;
- }
-
- /**
- * @see org.eclipse.jface.text.ITextOperationTarget#doOperation(int)
- */
- public void doOperation(int operation) {
- //TODO: add support to other operations
- switch (operation) {
- case ITextOperationTarget.SELECT_ALL :
- tree.selectAll();
- }
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/messages.properties b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/messages.properties
deleted file mode 100644
index 5865a35..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/messages.properties
+++ /dev/null
@@ -1,72 +0,0 @@
-###############################################################################
-# Copyright (c) 2004, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-### Spy message catalog
-
-
-### Stats View
-stats_eventHeader = Event
-stats_blameHeader = Blame
-stats_contextHeader = Context
-stats_countHeader = Count
-stats_timeHeader = Time
-
-stats_badStat = Not an EventStats
-stats_badColumn = Invalid Column
-stats_pluginid = Plug-in Identifier: {0}
-
-### Resource Spy
-resource_error_unknown_resource_impl = Error: unknown IResource implementation: {0}
-
-resource_file = File
-resource_folder = Folder
-resource_project = Project
-resource_root = Root
-resource_full_path = Full Path
-resource_content_id = Content ID
-resource_type = Type
-resource_node_id = Node ID
-resource_local_sync_info = Local Sync Info
-
-resource_persistent_properties = Persistent Properties
-resource_error_stored_properties = Error getting resource's stored properties: {0}
-
-resource_session_properties = Session Properties
-
-resource_flags = Flags
-resource_open = Open
-resource_local_exists = Local exists
-resource_phantom = Phantom
-resource_used = Used
-resource_derived = Derived
-resource_team_private = Team private
-resource_markers_snap_dirty = Marker snapshot is dirty
-resource_sync_info_snap_dirty = Sync info snapshot is dirty
-resource_no_content_description = No content description
-resource_default_content_description = Default content description
-resource_hidden = Hidden
-
-resource_content_description = Content description
-resource_error_content_description = Error getting file's content description: {0}
-resource_content_description_from_cache = cached: {0}
-
-resource_markers = Markers
-resource_error_marker = Error getting marker information: {0}
-
-resource_sync_info = Sync information
-
-### Plug-in Dependency Spy
-depend_noInformation = Unable to find information for {0}.
-depend_noParentPlugins = Not required by any plug-ins.
-depend_requiredBy = Required by:
-depend_noChildrenPlugins = Requires no plug-ins.
-depend_requires = Requires:
-depend_badPluginId = Invalid plug-in id
-
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/AbstractDumper.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/AbstractDumper.java
deleted file mode 100644
index 0bf40de..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/AbstractDumper.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.*;
-
-/**
- * An abstract implementation for dumpers that generate bare text dumps by
- * sequentially reading input streams.
- */
-public abstract class AbstractDumper implements IDumper {
-
- /**
- * Reads a given file and produces a dump object. Provides a template implementation for
- * <code>IDumper.dump(java.io.File)</code>.
- * <p>Subclasses must implement
- * <code>getStringDumpingStrategy(InputStream)</code> in order to select the
- * real dumping behaviour. This method will call
- * <code>IStringDumpingStrategy#dumpStringContents(DataInputStream)</code> on
- * the returned strategy. If, after calling that method, there are still bytes
- * to be read in the input stream,
- * <code>getStringDumpingStrategy(InputStream)</code> will be called again in
- * order to select another strategy to read the remaining contents, and so on.
- * </p>
- *
- * <p>Subclasses can also select which type of low-level InputStream will be
- * used to read the file to be dumped by overriding
- * <code>openInputStream(File)</code>.</p>
- *
- * @param file the file to be dumped
- * @return a dump object representing the contents of the dumped file
- * @see org.eclipse.core.tools.metadata.IDumper#dump(java.io.File)
- * @see IStringDumpingStrategy#dumpStringContents(DataInputStream)
- * @see #openInputStream(File)
- */
- public IDump dump(File file) {
- MeteredInputStream meteredInput = null;
- Dump dump = new Dump();
- dump.setFile(file);
- StringBuffer contents = new StringBuffer(40);
- try {
- //uses a metered input stream in order to count the number of bytes read
- meteredInput = new MeteredInputStream(openInputStream(file));
- dumpContents(meteredInput, contents); //$NON-NLS-1$
- } catch (PartialDumpException pde) {
- // ensure we remember any partial contents
- if (pde.getPartialContents() != null)
- contents.append(pde.getPartialContents());
- dump.setFailureReason(pde);
- } catch (Exception e) {
- dump.setFailureReason(e);
- }
- dump.setContents(contents.toString());
- if (meteredInput != null)
- dump.setOffset(meteredInput.getOffset());
- return dump;
- }
-
- /**
- * Does the actual work. Subclasses must implement this method to define
- * dumping behavior. The results are added to the <code>contents</code>
- * string buffer.
- *
- * @param input
- * @param contents
- * @throws IOException
- * @throws Exception
- * @throws DumpException
- */
- protected abstract void dumpContents(PushbackInputStream input, StringBuffer contents) throws IOException, Exception, DumpException;
-
- /**
- * Opens an input stream connected to the file object provided. Provides an
- * opportunity for subclasses to select a different input stream class. By
- * default, returns a <code>FileInputStream</code> object.
- *
- * @param file the file to be opened
- * @return an input stream connected to the file provided as
- * argument
- * @throws IOException if an exception happens while opening the inpuut stream
- */
- protected InputStream openInputStream(File file) throws IOException {
- return new FileInputStream(file);
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/Dump.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/Dump.java
deleted file mode 100644
index dbe79fd..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/Dump.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.File;
-
-/**
- * Default implementation for <code>IDump</code>.
- *
- * @see IDump
- */
-public class Dump implements IDump {
- /**
- * The file processed in order to produce this dump
- */
- private File file;
- /**
- * The failure flag for this dump object.
- */
- private boolean failed;
- /**
- * The exception that caused the failure (may be null)
- */
- private Exception failureReason;
- /**
- * An object that represents the dump contents.
- */
- private Object contents;
- /**
- * The offset where the dumper stopped when reading the dumped file.
- */
- private long offset;
-
- /**
- * Constructs a Dump object to be initialized using the setter methods.
- */
- public Dump() {
- super();
- }
-
- /**
- * @see org.eclipse.core.tools.metadata.IDump#getFile()
- */
- public File getFile() {
- return file;
- }
-
- /**
- * @see org.eclipse.core.tools.metadata.IDump#isFailed()
- */
- public boolean isFailed() {
- return failed || this.failureReason != null;
- }
-
- /**
- * @see org.eclipse.core.tools.metadata.IDump#getFailureReason()
- */
- public Exception getFailureReason() {
- return failureReason;
- }
-
- /**
- * Sets the failure reason.
- *
- * @param failureReason The failure reason for this dump object
- */
- public void setFailureReason(Exception failureReason) {
- this.failureReason = failureReason;
- }
-
- /**
- * Sets the file.
- *
- * @param file The file for this dump object
- */
- public void setFile(File file) {
- this.file = file;
- }
-
- /**
- * @see IDump#getContents()
- */
- public Object getContents() {
- return contents;
- }
-
- /**
- * Sets the contents.
- *
- * @param contents The contents for this dump object
- */
- public void setContents(Object contents) {
- this.contents = contents;
- }
-
- /**
- * Sets the offset.
- *
- * @param offset The offset for this dump object
- */
- public void setOffset(long offset) {
- this.offset = offset;
- }
-
- /**
- * @see IDump#getOffset()
- */
- public long getOffset() {
- return offset;
- }
-
- /**
- * Returns a human-readable representation for this dump object (for
- * debugging purposes).
- *
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return "File: " + getFile() + "\n" + "Contents: \n******\n" + getContents() + "\n******\n" + "Failed: " + failed + "\n" + "Reason: " + failureReason + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpContentsView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpContentsView.java
deleted file mode 100644
index 91e2300..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpContentsView.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.File;
-import org.eclipse.core.tools.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-
-/**
- * Dump Contents Spy view. This view shows the contents resulting of a dumping
- * process.
- */
-public class DumpContentsView extends SpyView {
-
- /** Stores the initially assigned view title. */
- private String initialTitle;
-
- /** The JFace widget that shows the current selected file dump contents. */
- protected TextViewer viewer;
-
- /** The file names registered in the DumperFactory. */
- protected String[] registeredFileNames;
-
- /** The dumper factory used to instantiate dumpers. */
- private DumperFactory dumperFactory;
-
- /** The current selected file. */
- private File currentFile;
-
- /** The id by which this view is known in the plug-in registry */
- public static final String VIEW_ID = DumpContentsView.class.getName();
-
- /**
- * Constructs a DumpContentsView.
- */
- public DumpContentsView() {
- dumperFactory = DumperFactory.getInstance();
- this.registeredFileNames = dumperFactory.getRegisteredFileNames();
- }
-
- /**
- * Creates this view widget and actions.
- *
- * @param parent the parent control
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(final Composite parent) {
- // creates a read-only text viewer
- viewer = new TextViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL);
- viewer.setDocument(new Document());
- viewer.setEditable(false);
-
- // creates the actions
- final IAction loadFileAction = new LoadFileAction();
- final IAction copySelectionAction = new CopyTextSelectionAction(viewer);
- final IAction clearContentsAction = new ClearTextAction(viewer.getDocument());
-
- // adds actions to the menu bar
- IMenuManager barMenuManager = getViewSite().getActionBars().getMenuManager();
- barMenuManager.add(loadFileAction);
- barMenuManager.add(copySelectionAction);
- barMenuManager.add(clearContentsAction);
-
- // creates a context menu with actions and adds it to the viewer control
- MenuManager menuMgr = new MenuManager();
- menuMgr.add(loadFileAction);
- menuMgr.add(copySelectionAction);
- menuMgr.add(clearContentsAction);
- Menu menu = menuMgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- }
-
- /**
- * Sets the file to be dumped. The view state will be updated to reflect
- * changes.
- *
- * @param file the file to be dumped
- */
- public void setFile(File file) {
- IDumper dumper = null;
-
- // tries to get the associated file dumper
- try {
- dumper = dumperFactory.getDumper(file.getName());
- } catch (DumpException de) {
- ErrorUtil.logException(de, null);
- ErrorUtil.showErrorMessage(de.getMessage(), "Error creating file dumper"); //$NON-NLS-1$
- return;
- }
-
- // dumps file
- IDump dump = dumper.dump(file);
- if (dump.isFailed()) {
- CoreToolsPlugin.getDefault().log("Error during file dump", dump.getFailureReason()); //$NON-NLS-1$
- String message = "File dumping did not complete successfully. Reason: " + dump.getFailureReason(); //$NON-NLS-1$
- ErrorUtil.showErrorMessage(message, "Error during file dump"); //$NON-NLS-1$
- }
-
- // loads the new dump object
- load(dump);
- }
-
- /**
- * Rebuilds the view with the dump object provided.
- *
- * @param dump a dump object to be shown on this view
- */
- private void load(IDump dump) {
-
- this.currentFile = dump.getFile();
-
- // now it is safe to get the part title
- // (during createPartControl it gets Workbench window title)
- if (initialTitle == null)
- this.initialTitle = this.getTitle();
-
- // updates title and title tool tip
- this.setContentDescription(initialTitle + " : " + this.currentFile.getName()); //$NON-NLS-1$
- this.setTitleToolTip("Dump contents for " + this.currentFile.getAbsolutePath()); //$NON-NLS-1$
-
- // updates viewer
- viewer.getDocument().set(dump.getContents().toString());
-
- // tries to show summary information in Dump Summary view
- IWorkbenchPage page = this.getSite().getPage();
- String summaryId = DumpSummaryView.VIEW_ID;
-
- // maybe the summary view is already open
- DumpSummaryView summaryView = (DumpSummaryView) page.findView(summaryId);
-
- // if it is not the case and the dump failed, tries to open it
- if (summaryView == null && dump.isFailed())
- try {
- summaryView = (DumpSummaryView) page.showView(summaryId);
- } catch (PartInitException pie) {
- ErrorUtil.logException(pie, "Error opening view"); //$NON-NLS-1$
- }
-
- // if the Dump Summary view is available, updates it
- if (summaryView != null)
- summaryView.load(dump);
- }
-
- /**
- * File load action implementation.
- */
- private class LoadFileAction extends Action {
- /** Sets action text and tool tip. */
- LoadFileAction() {
- this.setText("Load File..."); //$NON-NLS-1$
- this.setToolTipText("Load file..."); //$NON-NLS-1$
- }
-
- /**
- * Executes this action, opening a file dialog so the user can select the
- * file to be dumped. If a file is successfully selected, opens it by
- * calling <code>#setFile(File)</code>.
- *
- * @see DumpContentsView#setFile
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- // opens a file dialog
- FileDialog fileDialog = new FileDialog(viewer.getControl().getShell(), SWT.OPEN);
- fileDialog.setText("Please choose a metadata file to view"); //$NON-NLS-1$
- fileDialog.setFilterExtensions(DumpContentsView.this.registeredFileNames);
-
- // if a file hasn't been selected, ignore
- String filePath = fileDialog.open();
- if (filePath == null)
- return;
-
- // opens the selected file
- DumpContentsView.this.setFile(new File(filePath));
- }
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpException.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpException.java
deleted file mode 100644
index dd9fc95..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpException.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-
-/**
- A high-level exception class to be used by <code>IDumper</code>s. It is
- intended to be used as a wrapper for low-level exceptions. A method for
- accessing the low-level exception that caused this
- <code>DumpException</code> is provided.
- */
-public class DumpException extends Exception {
-
- private static final long serialVersionUID = 1L;
- /**
- * The low-level exception that caused this <code>DumpException</code>. May be
- * null.
- */
- private Throwable cause;
-
- /**
- * Constructs a <code>DumpException</code> with the provided message.
- *
- * @param msg the message
- */
- public DumpException(String msg) {
- super(msg);
- }
-
- /**
- * Constructs a <code>DumpException</code> with the provided message and cause.
- *
- * @param msg the message
- * @param cause the exception that caused this <code>DumpException</code>
- */
- public DumpException(String msg, Throwable cause) {
- super(msg);
- this.cause = cause;
- }
-
- /**
- * Returns the cause for this <code>DumpException</code>. May be null.
- *
- * @return the cause for this <code>DumpException</code>.
- */
- public Throwable getCause() {
- return cause;
- }
-
- /**
- * Returns this exception message (including the cause message, if there is a
- * cause exception).
- *
- * @return the error message string
- * @see java.lang.Throwable#getMessage()
- */
- public String getMessage() {
- return super.getMessage() + ((cause != null) ? (" caused by " + cause.toString()) : ""); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Prints this <code>DumpException</code> message and its backtrace to the
- * specified print stream.
- *
- * @param output the <code>java.io.PrintStream</code> object where to print
- * @see java.lang.Throwable#printStackTrace(java.io.PrintStream)
- */
- public void printStackTrace(PrintStream output) {
- super.printStackTrace(output);
- if (cause == null)
- return;
- output.println("*** Caused by:"); //$NON-NLS-1$
- cause.printStackTrace(output);
- }
-
- /**
- * Prints this <code>DumpException</code> message and its backtrace to the
- * specified print writer.
- *
- * @param output the <code>java.io.PrintWriter</code> object where to print
- * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter)
- */
- public void printStackTrace(PrintWriter output) {
- super.printStackTrace(output);
- if (cause == null)
- return;
- output.println("*** Caused by:"); //$NON-NLS-1$
- cause.printStackTrace(output);
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpSummaryView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpSummaryView.java
deleted file mode 100644
index 9c6a02c..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpSummaryView.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.File;
-import org.eclipse.core.tools.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-
-/**
- * Dump Summary Spy view. This view shows the outcome of a dumping.
- */
-public class DumpSummaryView extends SpyView {
-
- /** Stores the initially assigned view title. */
- private String initialTitle;
-
- /** The JFace widget that shows the current selected file dump summary */
- private TextViewer viewer;
-
- /** The id by which this view is known in the plug-in registry */
- public static final String VIEW_ID = DumpSummaryView.class.getName();
-
- /**
- * Creates this view widget and actions.
- *
- * @param parent the parent control
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl
- * (org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(final Composite parent) {
-
- // creates a read-only text viewer
- viewer = new TextViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL);
- viewer.setDocument(new Document());
- viewer.setEditable(false);
-
- final IAction copySelectionAction = new CopyTextSelectionAction(viewer);
- final IAction clearContentsAction = new ClearTextAction(viewer.getDocument());
-
- // adds actions to the menu bar
- IMenuManager barMenuManager = getViewSite().getActionBars().getMenuManager();
- barMenuManager.add(copySelectionAction);
- barMenuManager.add(clearContentsAction);
-
- // creates a context menu with actions and adds it to the viewer control
- MenuManager menuMgr = new MenuManager();
- menuMgr.add(copySelectionAction);
- menuMgr.add(clearContentsAction);
- Menu menu = menuMgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- }
-
- /**
- * Rebuilds the view with the dump object provided. Only summary information
- * is made available.
- *
- * @param dump a dump object describing the result of a dumping process.
- */
- void load(IDump dump) {
-
- // now is safe to get the part title
- if (initialTitle == null)
- this.initialTitle = this.getTitle();
-
- // sets title and tool tip
- File file = dump.getFile();
- this.setContentDescription(initialTitle + " : " + file.getName()); //$NON-NLS-1$
- this.setTitleToolTip("Dump summary for file " + file.getAbsolutePath()); //$NON-NLS-1$
-
- // generates text to be shown on this view
- StringBuffer output = new StringBuffer();
- if (dump.isFailed())
- output.append(dump.getFailureReason().toString());
- else
- output.append("No errors. "); //$NON-NLS-1$
- output.append(dump.getOffset());
- output.append('/');
- output.append(dump.getFile().length());
- output.append(" byte(s) read"); //$NON-NLS-1$
-
- // updates the view contents
- viewer.getDocument().set(output.toString());
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpTool.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpTool.java
deleted file mode 100644
index 4190c24..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpTool.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.*;
-import java.util.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.app.IApplication;
-import org.eclipse.equinox.app.IApplicationContext;
-
-/**
- * A command-line interface for running dumpers on metadata files.
- * This application requires the name of the file to be dumped as its unique
- * argument.
- */
-public class DumpTool implements IApplication {
-
- // list of files to dump
- String[] files = null;
-
- /**
- * The file filter.
- *
- * @see MetadataFileFilter
- */
- private FileFilter fileFilter;
-
- /**
- * The directory filter.
- *
- * @see DirectoryFilter
- */
- private FileFilter directoryFilter;
-
-
- /**
- * Dumps a given file using the associated dumper, sending its contents to the
- * standard output.
- *
- * @param context Application Context
- * @see DumperFactory#getDumper(String)
- */
- public Object start(IApplicationContext context) throws Exception {
- String fileName = System.getProperty("dump.file"); //$NON-NLS-1$
- if (fileName == null) {
- System.err.println("Use \"dump.file\" system property to point to the metadata file to be dumped"); //$NON-NLS-1$
- return new Integer(0);
- }
-
- File toDump = new File(fileName);
- if (!toDump.exists()) {
- System.err.println("File \"" + toDump.getAbsolutePath() + "\" does not exist"); //$NON-NLS-1$ //$NON-NLS-2$
- return new Integer(1);
- }
-
- // ready to parse
- DumperFactory factory = DumperFactory.getInstance();
- String[] registeredFileNames = factory.getRegisteredFileNames();
- this.fileFilter = new MetadataFileFilter(registeredFileNames);
- this.directoryFilter = new DirectoryFilter();
- System.out.println("DumpTool started...");
- System.out.println("Analyzing: "+fileName);
-
- if (toDump.isFile()) {
- files = new String[]{fileName};
- } else {
- files = extractFiles(fileName);
- }
-
- for (int i = 0; i < files.length; i++) {
- dump(files[i]);
- }
-
- System.out.println("DumpTool finished...");
- return new Integer(0);
- }
-
- private void dump(String fileName) {
- IDumper dumper = null;
- try {
- dumper = DumperFactory.getInstance().getDumper(fileName);
- } catch (DumpException de) {
- System.err.println("Error: \n" + de); //$NON-NLS-1$
- return;
- }
- IDump dump = dumper.dump(new File(fileName));
- System.out.println("*****************************************************");
- System.out.print("Dump for file: "); //$NON-NLS-1$
- System.out.println(dump.getFile().getAbsolutePath());
- System.out.print("Contents: "); //$NON-NLS-1$
- System.out.println(dump.getContents());
- if (dump.isFailed()) {
- System.out.print("*** Dump failed. Reason: "); //$NON-NLS-1$
- System.out.print(dump.getFailureReason());
- dump.getFailureReason().printStackTrace();
- } else {
- System.out.print(">>> File is ok"); //$NON-NLS-1$
- }
- System.out.print(". Bytes read: "); //$NON-NLS-1$
- System.out.print(dump.getOffset());
- System.out.print(" / Total: "); //$NON-NLS-1$
- System.out.println(dump.getFile().length());
- }
-
- private String[] extractFiles(String directory) {
- List fileNames = new ArrayList();
- extractInfo(new File(directory), fileNames, new NullProgressMonitor());
-
- String[] result = new String[fileNames.size()];
- if (fileNames.size()>0){
- result = (String[])fileNames.toArray(new String[fileNames.size()]);
- }
- return result;
- }
- /**
- * Builds this content provider data model from a given root directory. This
- * method operates recursively, adding a tree node for each file of a registered
- * type it finds and for each directory that contains (any directories that
- * contain) a file of a registered type. This method returns a boolean value
- * indicating that it (or at least one of its sub dirs) contains files with one
- * of the registered types (so its parent will include it too).
- *
- * @param dir a directory potentially containing known metadata files.
- * @param dirNode the node corresponding to that directory
- * @return true if the provided dir (or at least one of its sub dirs)
- * contains files with one of the registered types, false otherwise
- */
- void extractInfo(File dir, List fileList, IProgressMonitor monitor) {
-
- if (monitor.isCanceled())
- return;
-
- monitor.beginTask("Scanning dir " + dir, 100); //$NON-NLS-1$
- try {
- // looks for files of registered types in this directory
- File[] selectedFiles = dir.listFiles(fileFilter);
- monitor.worked(1);
- Arrays.sort(selectedFiles);
- for (int i = 0; i < selectedFiles.length; i++) {
- fileList.add(selectedFiles[i].getAbsolutePath());
- }
- // looks for files of registered types in its subdirectories
- File[] subDirs = dir.listFiles(directoryFilter);
- monitor.worked(1);
- Arrays.sort(subDirs);
-
- for (int i = 0; i < subDirs.length; i++) {
- // Recursive call
- extractInfo(subDirs[i], fileList, new SubProgressMonitor(monitor, 98 / subDirs.length));
- }
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Filters directories entries.
- *
- * @see java.io.FileFilter
- */
- private class DirectoryFilter implements FileFilter {
- /**
- * @see java.io.FileFilter#accept(java.io.File)
- */
- public boolean accept(File file) {
- return file.isDirectory();
- }
- }
-
- public void stop() {
- // Does not do anything
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumperFactory.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumperFactory.java
deleted file mode 100644
index 9c46d82..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumperFactory.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.File;
-import java.util.Enumeration;
-import java.util.Properties;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.tools.CoreToolsPlugin;
-
-/**
- * A dumper factory creates a dumper object given a file name.
- */
-public class DumperFactory {
-
- private static final String ELEM_DUMPER = "dumper"; //$NON-NLS-1$
- private static final String ATTR_FILE_NAME = "file-name"; //$NON-NLS-1$
- private static final String PT_METADATA_DUMPERS = "metadataDumpers"; //$NON-NLS-1$
- /**
- * The <code>DumperFactory</code> singleton reference.
- */
- private static DumperFactory ref;
-
- /**
- * This dumper factory mappings configuration.
- */
- private Properties configuration = new Properties();
-
- /**
- * Provides access to a DumperFactory instance.
- *
- * @return a <code>DumperFactory</code> instance
- */
- public synchronized static DumperFactory getInstance() {
- // currently we allow only one instance for this class
- if (ref == null)
- ref = new DumperFactory();
- return ref;
- }
-
- /**
- * Constructs a dumper factory, reading dumper definitions from the
- * extension registry. Forbids instantiation from outside this class.
- */
- private DumperFactory() {
- loadDumpers();
- }
-
- private void loadDumpers() {
- IExtensionPoint dumpersPoint = Platform.getExtensionRegistry().getExtensionPoint(CoreToolsPlugin.PI_TOOLS, PT_METADATA_DUMPERS);
- IConfigurationElement[] dumperDefinitions = dumpersPoint.getConfigurationElements();
- for (int i = 0; i < dumperDefinitions.length; i++)
- if (dumperDefinitions[i].getName().equals(ELEM_DUMPER))
- configuration.put(dumperDefinitions[i].getAttribute(ATTR_FILE_NAME), dumperDefinitions[i]);
- }
-
- /**
- * Returns an array containing all known file names.
- *
- * @return an array containing file names registered in this factory.
- */
- public String[] getRegisteredFileNames() {
- String[] fileNames = new String[configuration.size()];
- return (String[]) configuration.keySet().toArray(fileNames);
- }
-
- /**
- * Returns an instance of the dumper class registered for the provided file name.
- * If there is no dumper class registered for the provided file name, raises an
- * exception.
- *
- * @param fileName the file to be dumped's name
- * @return a <code>IDumper</code> that knows how to read the file
- * @throws DumpException if there is no dumper class registered for the
- * provided file name of if we cannot instanciate the dumper class
- */
- public IDumper getDumper(String fileName) throws DumpException {
- fileName = fileName.substring(fileName.lastIndexOf(File.separator) + 1);
-
- Object dumper = configuration.get(fileName);
-
- if (dumper == null) {
- String NO_DUMPER_MSG = "There is no dumper class for <" + fileName + "> files"; //$NON-NLS-1$ //$NON-NLS-2$
- NO_DUMPER_MSG += getListOfDumperClass(configuration);
- throw new DumpException(NO_DUMPER_MSG);
- }
- // legacy-style definition (from the properties file)
- if (dumper instanceof String)
- try {
- return (IDumper) Class.forName((String) dumper).newInstance();
- } catch (Exception e) {
- throw new DumpException("Error instantiating dumper named " + dumper + " for <" + fileName + "> file", e); //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-2$
- }
- // dumper defined through extension mechanism
- try {
- return (IDumper) ((IConfigurationElement) dumper).createExecutableExtension("class"); //$NON-NLS-1$
- } catch (CoreException ce) {
- throw new DumpException("Error instantiating dumper for <" + fileName + "> file", ce); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- private String getListOfDumperClass(Properties cfg) {
- StringBuffer buf = new StringBuffer("\r\nList of files who have a dumper class");
- for (Enumeration e = cfg.keys(); e.hasMoreElements();) {
- String element = (String) e.nextElement();
- buf.append("\r\n");
- buf.append(element);
- }
- return buf.toString();
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/IDump.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/IDump.java
deleted file mode 100644
index b7b3e6d..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/IDump.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.File;
-
-/**
- * Represents an object produced by dumping a given file.
- */
-public interface IDump {
-
- /**
- * Returns the file processed in order to produce this dump.
- *
- * @return the file processed
- */
- File getFile();
-
- /**
- * Returns the dump contents. Dump contents objects must have a
- * <code>toString()</code>
- * implementation that returns meaningful, human-readable, representation for
- * the contents.
- *
- * @return an object representing the contents of the dumped file.
- */
- Object getContents();
-
- /**
- * Returns true if the file reading process ended due to a failure. If
- * <code>getFailureReason()</code> does not return <code>null</code>, this
- * method must return <code>true</code>.
- *
- * @return true if the dumping process terminated due to a failure
- */
- boolean isFailed();
-
- /**
- * Returns the exception that caused the failure, or null if a failure did not
- * happen.
- *
- * @return the exception that caused the failure, or null if a
- * failure did not happen.
- */
- Exception getFailureReason();
-
- /**
- * Returns the offset where dumper stopped reading the dumped file. Optionally
- * implemented.
- *
- * @return the number of bytes read
- */
- long getOffset();
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/IDumper.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/IDumper.java
deleted file mode 100644
index eb2a9bd..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/IDumper.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.File;
-
-/**
- * A dumper is an object that knows how to process a given kind of file,
- * translating it to a human-readable form.
- */
-public interface IDumper {
-
- /**
- * Reads a given file and produces a dump object. Any exception that
- * may occur during file processing must be caught and stored as
- * failure reason in the IDump object returned.
- *
- * @param file the file to be dumped
- * @return a dump object representing the contents of the file dumped
- */
- IDump dump(File file);
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/IStringDumpingStrategy.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/IStringDumpingStrategy.java
deleted file mode 100644
index 91c3620..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/IStringDumpingStrategy.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-
-/**
- * A dumping strategy defines how a input stream will be dumped as a string.
- * A given dumper may use different strategies for reading different versions of
- * a file it understands, or may even use different strategies for reading
- * different segments of a same file.
- *
- * @see org.eclipse.core.tools.metadata.AbstractDumper
- */
-public interface IStringDumpingStrategy {
- /**
- * Dumps contents read from the provided stream.
- * Concrete implementations should not catch any exceptions.
- * Concrete implementations should not close the input stream.
- * This method may read the entire input stream contents, or just part of it.
- *
- * @param input the input stream where to dump contents from
- * @return the contents read in string format, or null if no further reading should occur
- * @throws IOException an exception occurred while dumping the input stream
- * @throws DumpException an exception occurred while dumping the input stream
- */
- public String dumpStringContents(DataInputStream input) throws IOException, DumpException;
-
- /**
- * Returns a high-level description for the file format understood by this
- * strategy.
- *
- * @return a string describing the file format this strategy understands.
- */
- public String getFormatDescription();
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataFileFilter.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataFileFilter.java
deleted file mode 100644
index c985175..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataFileFilter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.Arrays;
-
-/**
- * Filters accepted files (the ones who are registered in the DumperFactory).
- *
- * @see MetadataTreeContentProvider#MetadataTreeContentProvider(String[])
- * @see java.io.FileFilter
- */
-class MetadataFileFilter implements FileFilter {
- private String[] fileNames;
-
- MetadataFileFilter(String[] fileNames) {
- this.fileNames = fileNames;
- Arrays.sort(this.fileNames);
- }
-
- /**
- * @see java.io.FileFilter#accept(java.io.File)
- */
- public boolean accept(File file) {
- return file.isFile() && Arrays.binarySearch(fileNames, file.getName()) >= 0;
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataPerspective.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataPerspective.java
deleted file mode 100644
index 5ae111a..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataPerspective.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import org.eclipse.ui.*;
-
-/**
- * A perspective for working with metadata files.
- */
-public class MetadataPerspective implements IPerspectiveFactory {
- /**
- * Creates a layout containing the following views: Metadata Tree, Dump Contents
- * and Dump Summary, with no editor area.
- *
- * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(
- * org.eclipse.ui.IPageLayout)
- */
- public void createInitialLayout(IPageLayout layout) {
- String editorAreaId = layout.getEditorArea();
-
- layout.setEditorAreaVisible(false);
-
- IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, (float) 0.30, editorAreaId); //$NON-NLS-1$
- left.addView(MetadataTreeView.VIEW_ID);
-
- IFolderLayout right = layout.createFolder("right", IPageLayout.RIGHT, (float) 0.5, editorAreaId); //$NON-NLS-1$
- right.addView(DumpContentsView.VIEW_ID);
-
- IFolderLayout bottom = layout.createFolder("bottom", IPageLayout.BOTTOM, (float) 0.70, "right"); //$NON-NLS-1$ //$NON-NLS-2$
- bottom.addView(DumpSummaryView.VIEW_ID);
-
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataTreeContentProvider.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataTreeContentProvider.java
deleted file mode 100644
index 551ef8d..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataTreeContentProvider.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.Arrays;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.tools.AbstractTreeContentProvider;
-import org.eclipse.core.tools.TreeContentProviderNode;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * A tree content provider for Metadata view. Its input is a metadata directory,
- * the root directory from which Eclipse metadata files
- * will be searched. The result is a tree containing directory that contains
- * (any directories that contain) metadata files and the metadata files
- * themselves.<br>
- * This content provider mantains its contents using
- * <code>TreeContentProviderNode</code>
- * objects.
- *
- * @see org.eclipse.core.tools.TreeContentProviderNode
- */
-public class MetadataTreeContentProvider extends AbstractTreeContentProvider {
- /**
- * The file filter.
- *
- * @see MetadataFileFilter
- */
- private FileFilter fileFilter;
-
- /**
- * The directory filter.
- *
- * @see DirectoryFilter
- */
- private FileFilter directoryFilter;
-
- private MetadataTreeRebuilder treeRebuilder;
-
- /**
- * Constructs a new content provider.
- *
- * @param registeredFileNames an array containing all metadata file names known
- */
- public MetadataTreeContentProvider(String[] registeredFileNames) {
- super(true);
- this.fileFilter = new MetadataFileFilter(registeredFileNames);
- this.directoryFilter = new DirectoryFilter();
- this.treeRebuilder = new MetadataTreeRebuilder();
- }
-
- /**
- * Returns true if the input is a <code>File</code> object pointing to
- * a directory.
- *
- * @return true if this input object is a <code>File</code> pointing to a
- * directory.
- * @param input an input object
- * @see org.eclipse.core.tools.AbstractTreeContentProvider#acceptInput(java.lang.Object)
- */
- protected boolean acceptInput(Object input) {
- return (input instanceof File) && ((File) input).isDirectory(); //$NON-NLS-1$
- }
-
- /**
- * Updates the data model for this content provider upon the provided input.
- *
- * @param input a File object pointing to a metadata directory.
- *
- * @see org.eclipse.core.tools.AbstractTreeContentProvider#rebuild(Viewer, Object)
- */
- protected void rebuild(final Viewer viewer, final Object input) {
- final File metadataRootDir = (File) input;
- final TreeContentProviderNode metadataRootNode = makeNode(metadataRootDir);
- getRootNode().addChild(metadataRootNode);
- treeRebuilder.rebuild(viewer, metadataRootDir, metadataRootNode);
- }
-
- private class MetadataTreeRebuilder extends Job {
- private File rootDir;
- private TreeContentProviderNode rootNode;
- private Viewer viewer;
-
- public MetadataTreeRebuilder() {
- super("Updating metadata tree"); //$NON-NLS-1$
- }
-
- protected IStatus run(IProgressMonitor monitor) {
- try {
- extractInfo(rootDir, rootNode, monitor);
- return Status.OK_STATUS;
- } finally {
- final Viewer tmpViewer = viewer;
- if (!tmpViewer.getControl().isDisposed())
- tmpViewer.getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- tmpViewer.refresh();
- }
- });
- }
- }
-
- public synchronized void rebuild(Viewer viewer, File rootDir, TreeContentProviderNode rootNode) {
- this.rootDir = rootDir;
- this.rootNode = rootNode;
- this.viewer = viewer;
- cancel();
- setName("Loading metadata tree from " + rootDir); //$NON-NLS-1$
- schedule();
- }
- }
-
- /**
- * Builds this content provider data model from a given root directory. This
- * method operates recursively, adding a tree node for each file of a registered
- * type it finds and for each directory that contains (any directories that
- * contain) a file of a registered type. This method returns a boolean value
- * indicating that it (or at least one of its sub dirs) contains files with one
- * of the registered types (so its parent will include it too).
- *
- * @param dir a directory potentially containing known metadata files.
- * @param dirNode the node corresponding to that directory
- * @return true if the provided dir (or at least one of its sub dirs)
- * contains files with one of the registered types, false otherwise
- */
- boolean extractInfo(File dir, TreeContentProviderNode dirNode, IProgressMonitor monitor) {
-
- if (monitor.isCanceled())
- return false;
-
- TreeContentProviderNode childNode;
-
- monitor.beginTask("Scanning dir " + dir, 100); //$NON-NLS-1$
- try {
- // looks for files of registered types in this directory
- File[] selectedFiles = dir.listFiles(fileFilter);
- monitor.worked(1);
- Arrays.sort(selectedFiles);
- for (int i = 0; i < selectedFiles.length; i++) {
- childNode = makeNode(selectedFiles[i]);
- dirNode.addChild(childNode);
- }
- // looks for files of registered types in its subdirectories
- File[] subDirs = dir.listFiles(directoryFilter);
- monitor.worked(1);
- Arrays.sort(subDirs);
-
- for (int i = 0; i < subDirs.length; i++) {
- // constructs a node for each subdir...
- childNode = makeNode(subDirs[i]);
- if (extractInfo(subDirs[i], childNode, new SubProgressMonitor(monitor, 98 / subDirs.length)))
- // ...but only adds them if they have files of registered types
- dirNode.addChild(childNode);
- }
- // returns true if this dir has any file of any registered type
- return selectedFiles.length > 0 || dirNode.hasChildren();
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Helper method that creates a new TreeContentProviderNode object given a File
- * object.
- *
- * @param file the file a node will created for
- * @return a <code>TreeContentProviderNode</code>
- */
- private TreeContentProviderNode makeNode(final File file) {
- return new TreeContentProviderNode(file.getName(), file) {
- // redefines toString so the root shows the full path while any other
- // node shows only the file / directory name
- public String toString() {
- return isRoot() ? file.getAbsolutePath() : file.getName();
- }
- };
- }
-
- /**
- * Filters directories entries.
- *
- * @see java.io.FileFilter
- */
- private class DirectoryFilter implements FileFilter {
- /**
- * @see java.io.FileFilter#accept(java.io.File)
- */
- public boolean accept(File file) {
- return file.isDirectory();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataTreeView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataTreeView.java
deleted file mode 100644
index 067e48a..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataTreeView.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.File;
-import org.eclipse.core.tools.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Implements the Metadata Spy view. This view allows the user to browse the
- * known files under a specified directory. "Known files" are those whose names
- * are known by the DumperFactory, thus they can be dumped.
- */
-public class MetadataTreeView extends SpyView {
-
- /**
- * A JFace widget used to display a tree corresponding to the metadata
- * directory structure (containing only files of known types).
- */
- protected AbstractTreeViewer viewer;
-
- /** The currently selected metadata dir. */
- protected File metadataPath;
-
- /** The id by which this view is known in the plug-in registry */
- public static final String VIEW_ID = MetadataTreeView.class.getName();
-
- /**
- * Dump file action implementation.
- */
- private class DumpFileAction extends Action {
- /**
- * Constructs a DumpFileAction, initializing text and tool tip text.
- */
- DumpFileAction() {
- this.setText("Dump Selected File"); //$NON-NLS-1$
- this.setToolTipText("Dump selected file"); //$NON-NLS-1$
- }
-
- /**
- * This action activates the Dump Contents view with the current selected
- * file in this view (if any)
- *
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- IStructuredSelection sel = (IStructuredSelection) MetadataTreeView.this.viewer.getSelection();
- if (sel == null || sel.isEmpty())
- return;
-
- TreeContentProviderNode fileNode = (TreeContentProviderNode) sel.getFirstElement();
-
- File file = (File) fileNode.getValue();
- // we have no interest in directories
- if (!file.isFile())
- return;
-
- try {
- DumpContentsView dumpView = (DumpContentsView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(DumpContentsView.VIEW_ID);
- dumpView.setFile(file);
- } catch (PartInitException e) {
- ErrorUtil.showErrorMessage(e.getMessage(), "Error opening view"); //$NON-NLS-1$
- ErrorUtil.logException(e, "Error opening view"); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Select metadata root action implementation.
- */
- private class SelectMetadataLocationAction extends Action {
- /**
- * Initializes action's text and tool tip text.
- */
- SelectMetadataLocationAction() {
- this.setText("Select metadata location..."); //$NON-NLS-1$
- this.setToolTipText("Select metadata location..."); //$NON-NLS-1$
- }
-
- /**
- * Executes action, opening a file dialog so the user can select which
- * metadata directory will be browsed.
- *
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- DirectoryDialog dirDialog = new DirectoryDialog(viewer.getControl().getShell());
-
- dirDialog.setText("Open a metadata directory"); //$NON-NLS-1$
- dirDialog.setMessage("Please choose a directory where to look for metadata files"); //$NON-NLS-1$
- if (metadataPath != null)
- dirDialog.setFilterPath(metadataPath.getAbsolutePath());
-
- String dirPath = dirDialog.open();
-
- if (dirPath == null)
- return;
-
- setMetadataRoot(new File(dirPath));
- }
- }
-
- /**
- * Creates this view widget and actions.
- *
- * @param parent the parent control
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
- viewer = new TreeViewer(parent);
-
- // sets a content provider for the viewer
- DumperFactory factory = DumperFactory.getInstance();
- String[] fileNames = factory.getRegisteredFileNames();
- viewer.setContentProvider(new MetadataTreeContentProvider(fileNames));
-
- // creates actions
- final IAction dumpFileAction = new DumpFileAction();
- final IAction selectMetadataLocationAction = new SelectMetadataLocationAction();
-
- // adds actions to the menu bar
- IMenuManager barMenuManager = getViewSite().getActionBars().getMenuManager();
- barMenuManager.add(selectMetadataLocationAction);
- barMenuManager.add(dumpFileAction);
-
- // creates a context menu with actions and adds it to the viewer control
- MenuManager menuMgr = new MenuManager();
- menuMgr.add(selectMetadataLocationAction);
- menuMgr.add(dumpFileAction);
-
- Menu menu = menuMgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
-
- // associates double-click to dump file action
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- dumpFileAction.run();
- }
- });
- }
-
- /**
- * Rebuilds the viewer content provider.
- *
- * @param file
- * @see WorkspaceContentProvider#inputChanged(Viewer, Object, Object)
- */
- protected void setMetadataRoot(final File file) {
- if (file == null)
- return;
- if (!file.isDirectory()) {
- ErrorUtil.showErrorMessage("Selected item is not a directory", "Error selecting metadata location"); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- metadataPath = file;
- viewer.setInput(file);
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MeteredInputStream.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MeteredInputStream.java
deleted file mode 100644
index 32d7de7..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MeteredInputStream.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.*;
-
-/**
- * An input stream that counts how many bytes have been read.
- */
-public class MeteredInputStream extends PushbackInputStream {
-
- /** The current number of bytes read. */
- private long offset;
-
- /**
- * Constructs a metered input stream chained to the given source input stream.
- *
- * @param in the input stream from where to read data
- */
- public MeteredInputStream(InputStream in) {
- super(in);
- }
-
- /**
- * Forwards the call to the super class, incrementing the offset if a
- * byte is successfully read.
- *
- * @return the next byte or <code>-1</code> if there is more data to be read.
- * @throws IOException if a failure occurs while reading the input stream
- * @see java.io.PushbackInputStream#read()
- */
- public int read() throws IOException {
- int byteRead = super.read();
- if (byteRead >= 0)
- offset++;
- return byteRead;
- }
-
- /**
- * Forwards the call to the super class, incrementing the current offset
- * by the number of bytes read.
- *
- * @param b an array containing bytes to be read
- * @return the number of bytes read.
- * @throws IOException if a failure occurs while reading the input stream
- * @see java.io.PushbackInputStream#read(byte[])
- */
- public int read(byte[] b) throws IOException {
- return read(b, 0, b.length);
- }
-
- /**
- * Forwards the call to the super class, incrementing the current offset
- * by the number of bytes read.
- *
- * @param b an array containing bytes to be read
- * @param off the array offset where bytes will be read to
- * @param len the number of bytes to be read
- * @return the number of bytes read
- * @throws IOException if a failure occurs while reading the input stream
- * @see java.io.PushbackInputStream#read(byte[], int, int)
- */
- public int read(byte[] b, int off, int len) throws IOException {
- int read = super.read(b, off, len);
- if (read > 0)
- offset += read;
- return read;
- }
-
- /**
- * Returns the current offset value.
- *
- * @return long the current number of bytes read
- */
- public long getOffset() {
- return offset;
- }
-
- /**
- * Forwards the call to the underlying input stream, decrementing the offset by
- * the number of bytes unread.
- *
- * @param b an array containing bytes to be unread
- * @throws IOException if a failure occurs
- * @see java.io.PushbackInputStream#unread(byte)
- */
- public void unread(byte[] b) throws IOException {
- super.unread(b);
- offset -= b.length;
- }
-
- /**
- * Forwards the call to the underlying input stream, decrementing the offset by
- * the number of bytes unread.
- *
- * @param b an array containing bytes to be unread
- * @param off the array offset from where bytes will be unread
- * @param len the number of bytes to be unread
- * @throws IOException if a failure occurs
- * @see PushbackInputStream#unread(byte[], int, int)
- */
- public void unread(byte[] b, int off, int len) throws IOException {
- super.unread(b, off, len);
- offset -= len;
- }
-
- /**
- * Forwards the call to the underlying push back input stream, decrementing the
- * offset if a
- * byte is successfully unread.
- *
- * @param b the byte to be unread
- * @throws IOException if a failure occurs
- * @see PushbackInputStream#unread(byte[])
- */
- public void unread(int b) throws IOException {
- super.unread(b);
- offset--;
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MultiStrategyDumper.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MultiStrategyDumper.java
deleted file mode 100644
index b54614f..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MultiStrategyDumper.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.*;
-
-/**
- * Subclasses must provide a concrete
- * implementation for <code>getStringDumpingStrategy(InputStream)</code> method.
- */
-public abstract class MultiStrategyDumper extends AbstractDumper {
-
- /**
- * <p>Subclasses must implement
- * <code>getStringDumpingStrategy(InputStream)</code> in order to select the
- * real dumping behaviour. This method will call
- * <code>IStringDumpingStrategy#dumpStringContents(DataInputStream)</code> on
- * the returned strategy. If, after calling that method, there are still bytes
- * to be read in the input stream,
- * <code>getStringDumpingStrategy(InputStream)</code> will be called again in
- * order to select another strategy to read the remaining contents, and so on.
- * </p>
- *
- * @param file the file to be dumped
- * @return a dump object representing the contents of the dumped file
- * @see org.eclipse.core.tools.metadata.IDumper#dump(java.io.File)
- * @see #getStringDumpingStrategy(DataInputStream)
- * @see IStringDumpingStrategy#dumpStringContents(DataInputStream)
- * @see #openInputStream(File)
- */
- protected final void dumpContents(PushbackInputStream input, StringBuffer contents) throws IOException, Exception, DumpException {
- DataInputStream dataInput = new DataInputStream(input);
- int c;
- while ((c = input.read()) != -1) {
- input.unread(c);
- IStringDumpingStrategy strategy = getStringDumpingStrategy(dataInput);
- String dumpedContents = strategy.dumpStringContents(dataInput);
- if (dumpedContents == null)
- break;
- contents.append("Format: "); //$NON-NLS-1$
- contents.append(strategy.getFormatDescription());
- contents.append("\n\n"); //$NON-NLS-1$
- contents.append(dumpedContents);
- contents.append("\n"); //$NON-NLS-1$
- }
- if (contents.length() == 0)
- contents.append("No contents\n"); //$NON-NLS-1$
- }
-
- /**
- * Returns a <code>IStringDumpingStrategy</code> object. Subclasses must provide
- * a concrete implementation for this method. The input stream is connected to
- * the file being dumped. If needed, implementations may consume the input
- * stream in order to choose a strategy.
- *
- * @param input the input stream being read
- * @return a <code>IStringDumpingStrategy</code> object
- * @throws Exception any exceptions occurred during input stream reading must
- * NOT be caught
- */
- protected abstract IStringDumpingStrategy getStringDumpingStrategy(DataInputStream input) throws Exception;
-
- /**
- * Opens an input stream connected to the file object provided. Provides an
- * opportunity for subclasses to select a different input stream class. By
- * default, returns a <code>FileInputStream</code> object.
- *
- * @param file the file to be opened
- * @return an input stream connected to the file provided as
- * argument
- * @throws IOException if an exception happens while opening the inpuut stream
- */
- protected InputStream openInputStream(File file) throws IOException {
- return new FileInputStream(file);
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/PartialDumpException.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/PartialDumpException.java
deleted file mode 100644
index 61290ff..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/PartialDumpException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-public class PartialDumpException extends DumpException {
-
- private static final long serialVersionUID = 1L;
- /**
- * Data read when the error happened. May be
- * null.
- */
- private Object partialContents;
-
- public PartialDumpException(String msg, Object partialContents) {
- super(msg);
- this.partialContents = partialContents;
- }
-
- /**
- * Returns the contents partially read when this exception occurred. May
- * return <code>null</code>.
- *
- * @return the contents partially read, or <code>null</code>
- */
- public Object getPartialContents() {
- return partialContents;
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/StateDumper.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/StateDumper.java
deleted file mode 100644
index 1781636..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/StateDumper.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.*;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osgi.service.resolver.*;
-
-public class StateDumper extends AbstractDumper {
-
- protected void dumpContents(PushbackInputStream input, StringBuffer contents) throws IOException, Exception, DumpException {
- PlatformAdmin admin = Platform.getPlatformAdmin();
- // use the deprecated API to support running against a 3.0 Eclipse
- State state = admin.getFactory().readState(new DataInputStream(input));
- if (state==null){
- contents.append("Unable to read state file.");
- return;
- }
- contents.append("State resolved: "); //$NON-NLS-1$
- contents.append(state.isResolved());
- contents.append("\n"); //$NON-NLS-1$
- BundleDescription[] allBundles = state.getBundles();
- admin.getStateHelper().sortBundles(allBundles);
- for (int i = 0; i < allBundles.length; i++)
- dumpBundle(allBundles[i], contents);
- }
-
- private void dumpBundle(BundleDescription bundle, StringBuffer contents) {
- contents.append("\n"); //$NON-NLS-1$
- contents.append("Bundle: "); //$NON-NLS-1$
- contents.append(bundle.getSymbolicName());
- contents.append('_');
- contents.append(bundle.getVersion());
- contents.append(" ("); //$NON-NLS-1$
- contents.append(bundle.isResolved() ? "resolved" : "unresolved"); //$NON-NLS-1$ //$NON-NLS-2$
- if (bundle.isSingleton())
- contents.append(", singleton"); //$NON-NLS-1$
- contents.append(")\n"); //$NON-NLS-1$
- HostSpecification host = bundle.getHost();
- if (host != null)
- dumpHost(host, contents);
- BundleSpecification[] required = bundle.getRequiredBundles();
- for (int i = 0; i < required.length; i++)
- dumpRequired(required[i], contents);
- }
-
- private void dumpRequired(BundleSpecification required, StringBuffer contents) {
- contents.append("\tRequired: "); //$NON-NLS-1$
- contents.append(required.getName());
- contents.append(" - Version: "); //$NON-NLS-1$
- contents.append(required.getVersionRange());
- contents.append(" ("); //$NON-NLS-1$
- contents.append(required.isResolved() ? ("actual: " + required.getSupplier().getVersion().toString()) : "unresolved"); //$NON-NLS-1$ //$NON-NLS-2$
- if (required.isOptional())
- contents.append(", optional"); //$NON-NLS-1$
- contents.append(')');
- contents.append('\n');
- }
-
- private void dumpHost(HostSpecification host, StringBuffer contents) {
- contents.append("\tHost: "); //$NON-NLS-1$
- contents.append(host.getName());
- contents.append(" - Version: "); //$NON-NLS-1$
- contents.append(host.getVersionRange());
- contents.append(" ("); //$NON-NLS-1$
- contents.append(host.isResolved() ? ("actual: " + host.getSupplier().getVersion().toString()) : "unresolved"); //$NON-NLS-1$ //$NON-NLS-2$
- contents.append(')');
- contents.append('\n');
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/ConvertMessageBundleAction.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/ConvertMessageBundleAction.java
deleted file mode 100644
index 3040b24..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/ConvertMessageBundleAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.nls;
-
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ltk.core.refactoring.CheckConditionsOperation;
-import org.eclipse.ltk.core.refactoring.PerformRefactoringOperation;
-import org.eclipse.ui.*;
-
-public class ConvertMessageBundleAction implements IObjectActionDelegate {
-
- private ICompilationUnit fAccessorUnit;
- private IWorkbenchPart fPart;
-
- public void setActivePart(IAction action, IWorkbenchPart part) {
- fPart = part;
- }
-
- public void run(IAction action) {
- if (fAccessorUnit == null)
- return;
- try {
- final GotoResourceAction pAction = new GotoResourceAction(fPart);
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- pAction.run();
- }
- };
- PlatformUI.getWorkbench().getProgressService().run(false, false, runnable);
- IFile propertiesFile = (IFile) pAction.getResource();
- if (propertiesFile == null)
- return;
- MessageBundleRefactoring refactoring = new MessageBundleRefactoring(fAccessorUnit.getTypes()[0], propertiesFile);
- PerformRefactoringOperation op = new PerformRefactoringOperation(refactoring, CheckConditionsOperation.ALL_CONDITIONS);
- PlatformUI.getWorkbench().getProgressService().run(false, false, new WorkbenchRunnableAdapter(op));
- } catch (CoreException e) {
- throw new RuntimeException(e);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
-
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- Object element = ((IStructuredSelection) selection).getFirstElement();
- if (element instanceof ICompilationUnit) {
- fAccessorUnit = (ICompilationUnit) element;
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/GotoResourceAction.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/GotoResourceAction.java
deleted file mode 100644
index 2b1c05e..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/GotoResourceAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.nls;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IJavaModel;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.dialogs.ResourceListSelectionDialog;
-
-public class GotoResourceAction extends Action {
- IResource selectedResource;
- IWorkbenchPart part;
-
- private static class GotoResourceDialog extends ResourceListSelectionDialog {
- private IJavaModel fJavaModel;
-
- public GotoResourceDialog(Shell parentShell, IContainer container) {
- super(parentShell, container, IResource.FILE | IResource.FOLDER | IResource.PROJECT);
- fJavaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
- setTitle("Select the corresponding properties file:"); //$NON-NLS-1$
- }
-
- protected boolean select(IResource resource) {
- IProject project = resource.getProject();
- try {
- if (project.getNature(JavaCore.NATURE_ID) != null)
- return fJavaModel.contains(resource);
- } catch (CoreException e) {
- // do nothing. Consider resource;
- }
- return true;
- }
- }
-
- public IResource getResource() {
- return selectedResource;
- }
-
- public GotoResourceAction(IWorkbenchPart part) {
- this.part = part;
- setText("Select the corresponding properties file:"); //$NON-NLS-1$
- }
-
- public void run() {
- GotoResourceDialog dialog = new GotoResourceDialog(part.getSite().getShell(), ResourcesPlugin.getWorkspace().getRoot());
- dialog.open();
- Object[] result = dialog.getResult();
- if (result == null || result.length == 0 || !(result[0] instanceof IResource))
- return;
- selectedResource = (IResource) result[0];
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/IntegerMap.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/IntegerMap.java
deleted file mode 100644
index b23507e..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/IntegerMap.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.nls;
-
-public class IntegerMap {
-
- private static final int DEFAULT = 0;
- private static final int GROW_SIZE = 10;
-
- private int[] keys;
- private int[] values;
-
- public IntegerMap(int size) {
- super();
- keys = new int[size];
- values = new int[size];
- }
-
- public int get(int key) {
- for (int i = 0; i < keys.length; i++) {
- int current = keys[i];
- if (current != 0 && current == key)
- return values[i];
- }
- return DEFAULT;
- }
-
- public void put(int key, int value) {
-
- // replace if exists
- int emptySlot = -1;
- for (int i = 0; i < keys.length; i++) {
- int current = keys[i];
- if (current == 0) {
- emptySlot = i;
- continue;
- } else if (current == key) {
- values[i] = value;
- return;
- }
- }
-
- // grow if needed, then fill the empty slot
- if (emptySlot == -1)
- emptySlot = grow();
- keys[emptySlot] = key;
- values[emptySlot] = value;
- }
-
- private int grow() {
- int size = keys.length;
- int[] tempKeys = new int[size + GROW_SIZE];
- System.arraycopy(keys, 0, tempKeys, 0, size);
- keys = tempKeys;
- int[] tempValues = new int[size + GROW_SIZE];
- System.arraycopy(values, 0, tempValues, 0, size);
- values = tempValues;
- return size;
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/MessageBundleRefactoring.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/MessageBundleRefactoring.java
deleted file mode 100644
index 2e6b694..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/MessageBundleRefactoring.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.nls;
-
-import java.io.IOException;
-import java.util.List;
-import org.eclipse.core.filebuffers.*;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.tools.CoreToolsPlugin;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.dom.*;
-import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.core.search.SearchPattern;
-import org.eclipse.jdt.internal.corext.dom.Bindings;
-import org.eclipse.jdt.internal.corext.refactoring.RefactoringScopeFactory;
-import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine;
-import org.eclipse.jdt.internal.corext.refactoring.changes.CompilationUnitChange;
-import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser;
-import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringFileBuffers;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.ltk.core.refactoring.*;
-
-public class MessageBundleRefactoring extends Refactoring {
-
- IType fAccessorClass;
- IFile fPropertiesFile;
- CompositeChange fChange;
- ITypeBinding fAccessorTypeBinding;
-
- public MessageBundleRefactoring(IType accessorClass, IFile propertiesFile) {
- super();
- fAccessorClass = accessorClass;
- fPropertiesFile = propertiesFile;
- }
-
- public String getName() {
- return "Message Bundle Refactoring";
- }
-
- public RefactoringStatus checkInitialConditions(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
- return new RefactoringStatus();
- }
-
- public RefactoringStatus checkFinalConditions(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
- RefactoringStatus result = new RefactoringStatus();
- fAccessorTypeBinding = computeAccessorClassBinding(new SubProgressMonitor(monitor, 1));
- if (fAccessorTypeBinding == null) {
- result.addFatalError("Couldn't resolve accessor class");
- return result;
- }
- fChange = new CompositeChange("Accessor Class Changes");
- ICompilationUnit[] affectedUnits = RefactoringSearchEngine.findAffectedCompilationUnits(SearchPattern.createPattern(fAccessorClass, IJavaSearchConstants.REFERENCES), RefactoringScopeFactory.create(fAccessorClass), new SubProgressMonitor(monitor, 5), result);
- monitor.beginTask("", affectedUnits.length + 1);
- for (int i = 0; i < affectedUnits.length; i++) {
- ICompilationUnit unit = affectedUnits[i];
- if (unit.equals(fAccessorClass.getCompilationUnit()))
- continue;
- processCompilationUnit(result, unit, new SubProgressMonitor(monitor, 1));
- }
- processPropertiesFile(result, new SubProgressMonitor(monitor, 1));
- return result;
- }
-
- private void processPropertiesFile(RefactoringStatus result, IProgressMonitor monitor) throws CoreException {
- // TODO need to roll the changes to the properties file into a text edit that we can hook into
- // the "Undo -> Refactoring" framework
- try {
- ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
- try {
- manager.connect(fPropertiesFile.getFullPath(), null);
- manager.connect(fAccessorClass.getCompilationUnit().getCorrespondingResource().getFullPath(), null);
- fChange.addAll(new PropertyFileConverter().convertFile(fAccessorClass, fPropertiesFile));
- } finally {
- manager.disconnect(fPropertiesFile.getFullPath(), null);
- manager.disconnect(fAccessorClass.getCompilationUnit().getCorrespondingResource().getFullPath(), null);
- }
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, CoreToolsPlugin.PI_TOOLS, IStatus.ERROR, e.getMessage(), e));
- }
- }
-
- private void processCompilationUnit(RefactoringStatus result, ICompilationUnit unit, IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("", 2);
- CompilationUnit root = new RefactoringASTParser(AST.JLS3).parse(unit, true, new SubProgressMonitor(monitor, 1));
- ASTRewrite rewriter = ASTRewrite.create(root.getAST());
-
- processAST(result, root, rewriter, new SubProgressMonitor(monitor, 1));
-
- CompilationUnitChange change = new CompilationUnitChange(unit.getElementName(), unit);
- try {
- ITextFileBuffer buffer = RefactoringFileBuffers.acquire(unit);
- IDocument document = buffer.getDocument();
- change.setEdit(rewriter.rewriteAST(document, null));
- } finally {
- RefactoringFileBuffers.release(unit);
- }
- fChange.add(change);
- monitor.done();
- }
-
- private void processAST(RefactoringStatus result, final CompilationUnit root, final ASTRewrite rewriter, SubProgressMonitor monitor) {
- // keep track of the number of changes we make per line so we can get rid of the NLS comments.
- final IntegerMap map = new IntegerMap(10);
- ASTVisitor visitor = new ASTVisitor() {
- public boolean visit(MethodInvocation node) {
- Name messageBundleName = getMessageBundleReceiver(node);
- if (messageBundleName == null)
- return true;
- IMethodBinding method = node.resolveMethodBinding();
- // TODO here we have to do some checks whether the called method on the
- // resource bundle is something we have to rewrite. This depends on
- // the kind of the bundle and needs some AI.
- ITypeBinding[] params = method.getParameterTypes();
- if (params.length == 0)
- return true;
- if (!"java.lang.String".equals(params[0].getQualifiedName()))
- return true;
- List args = node.arguments();
- if (args.size() != 1)
- return true;
- Object obj = args.get(0);
- if (!(obj instanceof StringLiteral))
- return true;
- // compute the key of the message property
- StringLiteral string = (StringLiteral) obj;
- String key = PropertyFileConverter.convertToJavaIdentifier(string.getLiteralValue());
-
- // create the field access object
- FieldAccess fieldAccess = root.getAST().newFieldAccess();
- fieldAccess.setExpression((Expression) rewriter.createCopyTarget(messageBundleName));
- fieldAccess.setName(root.getAST().newSimpleName(key));
-
- // replace the method invocation with the field access
- rewriter.replace(node, fieldAccess, null);
- int line = 11;
- int value = map.get(line);
- value++;
- map.put(line, value);
- return true;
- }
-
- private Name getMessageBundleReceiver(MethodInvocation node) {
- Expression expression = node.getExpression();
- if (expression == null)
- return null;
- if (expression instanceof Name && Bindings.equals(fAccessorTypeBinding, ((Name) expression).resolveBinding())) {
- return (Name) expression;
- }
- return null;
- }
- };
- root.accept(visitor);
-
- // create another visitor to trim the //$NON-NLS-N$ comments
- // visitor = new ASTVisitor() {
- // public boolean visit(LineComment node) {
- // return true;
- // }
- // };
- // root.accept(visitor);
- }
-
- public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
- return fChange;
- }
-
- private ITypeBinding computeAccessorClassBinding(IProgressMonitor monitor) {
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setProject(fAccessorClass.getJavaProject());
- return (ITypeBinding) parser.createBindings(new IJavaElement[] {fAccessorClass}, monitor)[0];
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/NLSFileChange.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/NLSFileChange.java
deleted file mode 100644
index 8ba958f..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/NLSFileChange.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.nls;
-
-import java.io.*;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-
-public class NLSFileChange extends TextFileChange {
- private IFile file;
- private String contents;
-
- public NLSFileChange(IFile file) {
- super("Message bundle properties file change", file); //$NON-NLS-1$
- this.file = file;
- setTextType("text"); //$NON-NLS-1$
- }
-
- public RefactoringStatus isValid(IProgressMonitor pm) throws OperationCanceledException {
- return RefactoringStatus.create(Status.OK_STATUS);
- }
-
- void setContents(String text) {
- this.contents = text;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ltk.core.refactoring.TextFileChange#commit(org.eclipse.jface.text.IDocument, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void commit(IDocument document, IProgressMonitor monitor) throws CoreException {
- if (contents == null) {
- System.err.println("Cannot write null contents to file: " + file); //$NON-NLS-1$
- return;
- }
- byte[] bytes = null;
- try {
- bytes = contents.getBytes(file.getCharset(true));
- } catch (UnsupportedEncodingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- if (bytes == null)
- bytes = contents.getBytes();
- InputStream input = new BufferedInputStream(new ByteArrayInputStream(bytes));
- file.setContents(input, IResource.FORCE, null);
- }
-
- /* (non-Javadoc)
- * @see Change#getModifiedElement()
- */
- public Object getModifiedElement() {
- return file;
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/PropertyFileConverter.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/PropertyFileConverter.java
deleted file mode 100644
index 66c186f..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/PropertyFileConverter.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.core.tools.nls;
-
-import java.io.*;
-import java.util.HashSet;
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.ltk.core.refactoring.Change;
-
-/**
- * Converts a message bundle file to the new format, and generates a Java
- * file with fields for each key in the bundle.
- */
-public class PropertyFileConverter {
-
- private static final HashSet keywords = new HashSet();
-
- static {
- keywords.add("abstract"); //$NON-NLS-1$
- keywords.add("assert"); //$NON-NLS-1$
- keywords.add("break"); //$NON-NLS-1$
- keywords.add("case"); //$NON-NLS-1$
- keywords.add("catch"); //$NON-NLS-1$
- keywords.add("class"); //$NON-NLS-1$
- keywords.add("continue"); //$NON-NLS-1$
- keywords.add("default"); //$NON-NLS-1$
- keywords.add("do"); //$NON-NLS-1$
- keywords.add("else"); //$NON-NLS-1$
- keywords.add("extends"); //$NON-NLS-1$
- keywords.add("final"); //$NON-NLS-1$
- keywords.add("finally"); //$NON-NLS-1$
- keywords.add("for"); //$NON-NLS-1$
- keywords.add("if"); //$NON-NLS-1$
- keywords.add("implements"); //$NON-NLS-1$
- keywords.add("import"); //$NON-NLS-1$
- keywords.add("instanceof"); //$NON-NLS-1$
- keywords.add("interface"); //$NON-NLS-1$
- keywords.add("native"); //$NON-NLS-1$
- keywords.add("new"); //$NON-NLS-1$
- keywords.add("package"); //$NON-NLS-1$
- keywords.add("private"); //$NON-NLS-1$
- keywords.add("protected"); //$NON-NLS-1$
- keywords.add("public"); //$NON-NLS-1$
- keywords.add("return"); //$NON-NLS-1$
- keywords.add("static"); //$NON-NLS-1$
- keywords.add("strictfp"); //$NON-NLS-1$
- keywords.add("super"); //$NON-NLS-1$
- keywords.add("switch"); //$NON-NLS-1$
- keywords.add("synchronized"); //$NON-NLS-1$
- keywords.add("this"); //$NON-NLS-1$
- keywords.add("throw"); //$NON-NLS-1$
- keywords.add("throws"); //$NON-NLS-1$
- keywords.add("transient"); //$NON-NLS-1$
- keywords.add("try"); //$NON-NLS-1$
- keywords.add("volatile"); //$NON-NLS-1$
- keywords.add("while"); //$NON-NLS-1$
- keywords.add("true"); //$NON-NLS-1$
- keywords.add("false"); //$NON-NLS-1$
- keywords.add("null"); //$NON-NLS-1$
- }
-
- /**
- * Appends the text to put at the end of each Java messages file.
- */
- private void appendPostText(StringBuffer buffer, String bundlePath, String typeName) {
- buffer.append("\n\tstatic {\n"); //$NON-NLS-1$
- buffer.append("\t\t// load message values from bundle file\n"); //$NON-NLS-1$
- buffer.append("\t\tNLS.initializeMessages(BUNDLE_NAME, "); //$NON-NLS-1$
- buffer.append(typeName);
- buffer.append(".class"); //$NON-NLS-1$
- buffer.append(");\n"); //$NON-NLS-1$
- buffer.append("\t}\n"); //$NON-NLS-1$
- buffer.append("}"); //$NON-NLS-1$
- }
-
- /**
- * Appends the text to put at the beginning of each Java messages file.
- */
- private void appendPreText(StringBuffer buffer, String pkgName, String bundleName, String typeName) {
- //if this text had typos, would it be a false pretext?
- buffer.append("/**********************************************************************\n"); //$NON-NLS-1$
- buffer.append(" * Copyright (c) 2005 IBM Corporation and others. All rights reserved. This\n"); //$NON-NLS-1$
- buffer.append(" * program and the accompanying materials are made available under the terms of\n"); //$NON-NLS-1$
- buffer.append(" * the Eclipse Public License v1.0 which accompanies this distribution, and is\n"); //$NON-NLS-1$
- buffer.append(" * available at http://www.eclipse.org/legal/epl-v10.html\n"); //$NON-NLS-1$
- buffer.append(" * \n"); //$NON-NLS-1$
- buffer.append(" * Contributors: \n"); //$NON-NLS-1$
- buffer.append(" * IBM - Initial API and implementation\n"); //$NON-NLS-1$
- buffer.append(" **********************************************************************/\n"); //$NON-NLS-1$
- buffer.append("package "); //$NON-NLS-1$
- buffer.append(pkgName);
- buffer.append(";\n\n"); //$NON-NLS-1$
-
- buffer.append("import org.eclipse.osgi.util.NLS;\n\n"); //$NON-NLS-1$
- buffer.append("public class "); //$NON-NLS-1$
- buffer.append(typeName);
- buffer.append(" extends NLS {\n"); //$NON-NLS-1$
- buffer.append("\tprivate static final String BUNDLE_NAME = \"" + pkgName + '.' + bundleName + "\";//$NON-NLS-1$\n"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * Remove the properties in the specified list from the file.
- */
- public Change trim(IFile propertiesFile, List toDelete) throws IOException, CoreException {
- if (toDelete == null || toDelete.isEmpty())
- return null;
- BufferedReader reader = new BufferedReader(new InputStreamReader(propertiesFile.getContents()));
- StringBuffer bundle = new StringBuffer();
-
- try {
- String line;
- boolean isContinued = false;
- boolean wasDeleted = false;
- while ((line = reader.readLine()) != null) {
- line = line.trim();
- // just add comments directly to the output
- if (skipLine(line)) {
- bundle.append(line);
- bundle.append("\r\n"); //$NON-NLS-1$
- continue;
- }
-
- boolean wasContinued = isContinued;
- isContinued = isContinued(line);
- // if we are continued from the previous line...
- if (wasContinued) {
- // if the previous line was deleted then...
- if (wasDeleted) {
- // skip this line
- } else {
- // otherwise write it out
- bundle.append(line);
- bundle.append("\r\n"); //$NON-NLS-1$
- }
- } else {
- // we weren't continued from the previous line
- String key = extractKey(line);
- boolean shouldDelete = toDelete.contains(key);
- // if the key was in our skip list then don't write it out
- if (shouldDelete) {
- wasDeleted = true;
- } else {
- wasDeleted = false;
- bundle.append(line);
- bundle.append("\r\n"); //$NON-NLS-1$
- }
- }
-
- }
- } finally {
- if (reader != null)
- reader.close();
- }
- NLSFileChange pChange = new NLSFileChange(propertiesFile);
- pChange.setContents(bundle.toString());
- return pChange;
- }
-
- /**
- * Reads an old properties file, and creates a new properties file and corresponding
- * Java messages file.
- */
- public Change[] convertFile(IType accessorType, IFile propertiesFile) throws IOException, CoreException {
- String pkgName = accessorType.getPackageFragment().getElementName();
- IFile accessorFile = (IFile) accessorType.getCompilationUnit().getCorrespondingResource();
- String typeName = accessorFile.getFullPath().removeFileExtension().lastSegment();
- BufferedReader reader = new BufferedReader(new InputStreamReader(propertiesFile.getContents()));
- String bundleName = propertiesFile.getName();
- StringBuffer clazz = new StringBuffer();
- // convert the bundle resource (messages.properties) to the simple name (messages)
- String simpleBundleName = new Path(bundleName).removeFileExtension().toString();
- appendPreText(clazz, pkgName, simpleBundleName, typeName);
- StringBuffer bundle = new StringBuffer();
- int savings = 0;
- try {
- String line;
- boolean isContinued = false;
- while ((line = reader.readLine()) != null) {
- line = line.trim();
- boolean wasContinued = isContinued;
- isContinued = isContinued(line);
- if (!wasContinued) {
- if (skipLine(line)) {
- clazz.append(convertToComment(line));
- } else {
- String key = extractKey(line);
- savings += 88 + 4 * key.length();
- String identifier = convertToJavaIdentifier(key);
- clazz.append("\tpublic static String "); //$NON-NLS-1$
- clazz.append(identifier);
- clazz.append(";\n"); //$NON-NLS-1$
- //convert the bundle file line to use the Java identifier
- line = identifier + line.substring(key.length());
- }
- }
- //write the line out to the new bundle file
- bundle.append(line);
- bundle.append("\r\n"); //$NON-NLS-1$
- }
- } finally {
- if (reader != null)
- reader.close();
- }
- System.out.println("Memory saved by converting to field-based keys: " + savings);
- appendPostText(clazz, pkgName + '.' + bundleName, typeName);
-
- NLSFileChange pChange = new NLSFileChange(propertiesFile);
- pChange.setContents(bundle.toString());
-
- NLSFileChange cChange = new NLSFileChange(accessorFile);
- cChange.setContents(clazz.toString());
-
- return new Change[] {pChange, cChange};
- }
-
- /**
- * Writes the given line as a comment int the provided class buffer.
- * Blank lines are preserved.
- */
- private String convertToComment(String line) {
- StringBuffer comment = new StringBuffer();
- if (line.trim().length() > 0) {
- comment.append("\t//"); //$NON-NLS-1$
- }
- int offset = 0;
- //skip leading comment characters
- while (offset < line.length()) {
- char c = line.charAt(offset);
- if (c != '!' && c != '#')
- break;
- offset++;
- }
- comment.append(line.substring(offset));
- comment.append('\n');
- return comment.toString();
- }
-
- /**
- * Converts an arbitrary string into a string that represents a valid
- * Java identifier.
- */
- public static String convertToJavaIdentifier(String key) {
- String string = key.trim();
- int len = string.length();
- if (len == 0)
- return string;
- StringBuffer result = new StringBuffer();
- char c = string.charAt(0);
- if (Character.isJavaIdentifierStart(c))
- result.append(c);
- else {
- //if it's a valid part, just add an underscore first but keep the character
- result.append('_');
- if (Character.isJavaIdentifierPart(c))
- result.append(c);
- }
- for (int i = 1; i < len; i++) {
- c = string.charAt(i);
- if (Character.isJavaIdentifierPart(c))
- result.append(c);
- else
- result.append('_');
- }
- //preserve trailing space
- if (key.endsWith(" ")) //$NON-NLS-1$
- result.append(' ');
- return makeUnique(result.toString());
- }
-
- /**
- * Given a key converted to a Java identifier, ensure it is unique.
- * @return A unique key
- */
- private static String makeUnique(String originalKey) {
- String attempt = originalKey;
- int counter = 0;
- while (keywords.contains(attempt))
- attempt = originalKey + counter++;
- return attempt;
- }
-
- /**
- * Extracts and returns the property key from the given property file line.
- * The provided line contains no leading or trailing whitespace.
- */
- private String extractKey(String line) {
- int len = line.length();
- StringBuffer key = new StringBuffer();
- for (int i = 0; i < len; i++) {
- char c = line.charAt(i);
- //whitespace, colon, or equals characters represent key separators
- if (Character.isWhitespace(c) || c == ':' || c == '=')
- break;
- key.append(c);
- }
- return key.toString();
- }
-
- /**
- * Returns whether the property value on this line will be continued onto the next.
- */
- private boolean isContinued(String line) {
- //note that literal escaped slash characters at the end of a line are not
- //treated as continuation markers.
- boolean continuation = false;
- for (int i = line.length() - 1; (i >= 0) && (line.charAt(i) == '\\'); i--)
- continuation = !continuation;
- return continuation;
- }
-
- /**
- * Returns whether the given line contains a key that needs to be converted.
- */
- private boolean skipLine(String line) {
- if (line.length() == 0)
- return true;
- char first = line.charAt(0);
- return first == '#' || first == '!';
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/RemoveUnusedMessages.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/RemoveUnusedMessages.java
deleted file mode 100644
index e15b02e..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/RemoveUnusedMessages.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.nls;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.filebuffers.*;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.tools.CoreToolsPlugin;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.dom.*;
-import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.core.search.SearchPattern;
-import org.eclipse.jdt.internal.corext.refactoring.RefactoringScopeFactory;
-import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine;
-import org.eclipse.jdt.internal.corext.refactoring.changes.CompilationUnitChange;
-import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser;
-import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringFileBuffers;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.ltk.core.refactoring.*;
-
-/*
- * Class that removes field declarations which aren't referenced.
- */
-public class RemoveUnusedMessages extends Refactoring {
-
- IType accessorClass;
- IFile propertiesFile;
- CompositeChange change;
-
- public RemoveUnusedMessages(IType accessorClass, IFile propertiesFile) {
- super();
- this.accessorClass = accessorClass;
- this.propertiesFile = propertiesFile;
- }
-
- public String getName() {
- return "Fix NLS References";
- }
-
- public RefactoringStatus checkInitialConditions(IProgressMonitor monitor) {
- return new RefactoringStatus();
- }
-
- public RefactoringStatus checkFinalConditions(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
- if (monitor == null)
- monitor = new NullProgressMonitor();
- change = new CompositeChange("Accessor Class Changes");
- RefactoringStatus result = new RefactoringStatus();
- ICompilationUnit unit = JavaCore.createCompilationUnitFrom((IFile) accessorClass.getResource());
- CompilationUnit root = new RefactoringASTParser(AST.JLS3).parse(unit, true, null);
- ASTRewrite rewriter = ASTRewrite.create(root.getAST());
-
- // Search for references
- IField[] fields = accessorClass.getFields();
- ArrayList toDelete = new ArrayList();
- // 10 units of work for modifying the properties file and AST
- monitor.beginTask("Searching for references.", fields.length + 10);
- try {
- for (int i = 0; i < fields.length; i++) {
- if (monitor.isCanceled())
- throw new OperationCanceledException();
- IField field = fields[i];
- String fieldName = field.getElementName();
- monitor.subTask("Searching for references to: " + fieldName);
- int flags = field.getFlags();
- // only want to look at the public static String fields
- if (!(Flags.isPublic(flags) && Flags.isStatic(flags)))
- continue;
- // search for references
- ICompilationUnit[] affectedUnits = RefactoringSearchEngine.findAffectedCompilationUnits(SearchPattern.createPattern(field, IJavaSearchConstants.REFERENCES), RefactoringScopeFactory.create(accessorClass), new SubProgressMonitor(monitor, 1), result);
- // there are references so go to the next field
- if (affectedUnits.length > 0)
- continue;
- System.out.println("Found unused field: " + fieldName);
- toDelete.add(fieldName);
- }
- System.out.println("Analysis of " + fields.length + " messages found " + toDelete.size() + " unused messages");
-
- // any work to do?
- if (toDelete.isEmpty())
- return result;
-
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-
- // remove the field and its corresponding entry in the messages.properties file
- processAST(root, rewriter, toDelete);
- monitor.worked(5);
- processPropertiesFile(toDelete);
- monitor.worked(5);
-
- CompilationUnitChange cuChange = new CompilationUnitChange(unit.getElementName(), unit);
- try {
- ITextFileBuffer buffer = RefactoringFileBuffers.acquire(unit);
- IDocument document = buffer.getDocument();
- cuChange.setEdit(rewriter.rewriteAST(document, null));
- } finally {
- RefactoringFileBuffers.release(unit);
- }
- change.add(cuChange);
-
- } finally {
- monitor.done();
- }
-
- // return the result
- return result;
- }
-
- private void processAST(final CompilationUnit root, final ASTRewrite rewriter, final List toDelete) {
- ASTVisitor visitor = new ASTVisitor() {
- public boolean visit(VariableDeclarationFragment node) {
- // check to see if its in our list of fields to delete
- if (!toDelete.contains(node.getName().toString()))
- return true;
- rewriter.remove(node.getParent(), null);
- return true;
- }
- };
- root.accept(visitor);
- }
-
- private void processPropertiesFile(List list) throws CoreException {
- try {
- ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
- try {
- manager.connect(propertiesFile.getFullPath(), null);
- manager.connect(accessorClass.getCompilationUnit().getCorrespondingResource().getFullPath(), null);
- change.add(new PropertyFileConverter().trim(propertiesFile, list));
- } finally {
- manager.disconnect(propertiesFile.getFullPath(), null);
- manager.disconnect(accessorClass.getCompilationUnit().getCorrespondingResource().getFullPath(), null);
- }
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, CoreToolsPlugin.PI_TOOLS, IStatus.ERROR, e.getMessage(), e));
- }
- }
-
- public Change createChange(IProgressMonitor monitor) {
- return change;
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/RemoveUnusedMessagesAction.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/RemoveUnusedMessagesAction.java
deleted file mode 100644
index 700577a..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/RemoveUnusedMessagesAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.nls;
-
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ltk.core.refactoring.CheckConditionsOperation;
-import org.eclipse.ltk.core.refactoring.PerformRefactoringOperation;
-import org.eclipse.ui.*;
-
-public class RemoveUnusedMessagesAction implements IObjectActionDelegate {
-
- private ICompilationUnit fAccessorUnit;
- private IWorkbenchPart fPart;
-
- public void setActivePart(IAction action, IWorkbenchPart part) {
- fPart = part;
- }
-
- public void run(IAction action) {
- if (fAccessorUnit == null)
- return;
- try {
- final GotoResourceAction pAction = new GotoResourceAction(fPart);
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- pAction.run();
- }
- };
- PlatformUI.getWorkbench().getProgressService().run(false, false, runnable);
- IFile propertiesFile = (IFile) pAction.getResource();
- if (propertiesFile == null)
- return;
- RemoveUnusedMessages refactoring = new RemoveUnusedMessages(fAccessorUnit.getTypes()[0], propertiesFile);
- PerformRefactoringOperation op = new PerformRefactoringOperation(refactoring, CheckConditionsOperation.ALL_CONDITIONS);
- PlatformUI.getWorkbench().getProgressService().run(false, true, new WorkbenchRunnableAdapter(op));
- } catch (CoreException e) {
- throw new RuntimeException(e);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
-
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- Object element = ((IStructuredSelection) selection).getFirstElement();
- if (element instanceof ICompilationUnit) {
- fAccessorUnit = (ICompilationUnit) element;
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsView.java
deleted file mode 100644
index 235ade2..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsView.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import org.eclipse.core.runtime.internal.stats.BundleStats;
-import org.eclipse.core.runtime.internal.stats.StatsManager;
-import org.eclipse.core.tools.CoreToolsPlugin;
-import org.eclipse.core.tools.TableWithTotalView;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.ActionFactory;
-
-/**
- * View used to display the activated plugins
- */
-public class ActivePluginsView extends TableWithTotalView {
- private Action refreshAction;
- private Action displayClassesInfoAction;
- private Action displayStackAction;
-
- public static String VIEW_ID = ActivePluginsView.class.getName();
- private static String columnHeaders[] = {"Plug-in", "Classes", "Alloc", "Used", "Startup time", "Order", "Timestamp", "Class load time", "Startup method time", "RAM Alloc", "RAM Used", "ROM Alloc", "ROM Used"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$
- private static int columnWidths[] = {500, 150, 200, 200, 150, 100, 0, 0, 0, 0, 0, 0, 0};
-
- protected String[] getColumnHeaders() {
- return columnHeaders;
- }
-
- protected ColumnLayoutData[] getColumnLayout() {
- ColumnLayoutData[] result = new ColumnLayoutData[columnWidths.length];
- for (int i = 0; i < columnWidths.length; i++) {
- int width = columnWidths[i];
- result[i] = width == 0 ? (ColumnLayoutData) new ColumnPixelData(width) : (ColumnLayoutData) new ColumnWeightData(width);
- }
- return result;
- }
-
- protected void createToolbar() {
- IActionBars actionBars = getViewSite().getActionBars();
- IToolBarManager manager = actionBars.getToolBarManager();
- manager.add(refreshAction);
- manager.add(displayClassesInfoAction);
- manager.add(displayStackAction);
- }
-
- protected void createContextMenu() {
- // Create menu manager.
- MenuManager manager = new MenuManager();
- manager.setRemoveAllWhenShown(true);
- manager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager mgr) {
- fillContextMenu(mgr);
- }
- });
-
- // Create menu.
- Menu menu = manager.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
-
- // Register menu for extension.
- getSite().registerContextMenu(manager, viewer);
- }
-
- protected void fillContextMenu(IMenuManager manager) {
- manager.add(refreshAction);
- manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
- manager.add(new Separator());
- manager.add(displayClassesInfoAction);
- manager.add(displayStackAction);
- }
-
- protected String[] computeTotalLine(Iterator iterator) {
- int sumOfClasses = 0;
- int sumOfMemoryUsed = 0;
- int sumOfMemoryAlloc = 0;
- long sumOfStartupTime = 0;
- long sumOfClassloadtime = 0;
- int sumOfRAMAlloc = 0;
- int sumOfRAMUsed = 0;
- long sumOfStartupMethodTime = 0;
- int sumOfROMAlloc = 0;
- int sumOfROMUsed = 0;
- int count = 0;
- if (!iterator.hasNext()) {
- Object[] elements = ((ITreeContentProvider) viewer.getContentProvider()).getElements(viewer.getInput());
- iterator = Arrays.asList(elements).iterator();
- }
- for (; iterator.hasNext();) {
- BundleStats element = (BundleStats) iterator.next();
- if (element != null) {
- VMClassloaderInfo vmInfo = VMClassloaderInfo.getClassloader(element.getSymbolicName());
- sumOfClasses += element.getClassLoadCount();
- sumOfMemoryUsed += (vmInfo.getUsedRAM() + vmInfo.getUsedROM());
- sumOfMemoryAlloc += (vmInfo.getAllocRAM() + vmInfo.getAllocROM());
- sumOfStartupTime = sumOfStartupTime + element.getStartupTime();
- sumOfClassloadtime = sumOfClassloadtime + element.getClassLoadTime();
- sumOfStartupMethodTime = sumOfStartupMethodTime + element.getStartupMethodTime();
- sumOfRAMAlloc += vmInfo.getAllocRAM();
- sumOfRAMUsed += vmInfo.getUsedRAM();
- sumOfROMAlloc += vmInfo.getAllocROM();
- sumOfROMUsed += vmInfo.getUsedROM();
- count++;
- }
- }
- String[] totalLine = new String[getColumnHeaders().length];
- totalLine[0] = "Total: " + count; //$NON-NLS-1$
- totalLine[1] = "" + sumOfClasses; //$NON-NLS-1$
- totalLine[2] = "" + sumOfMemoryAlloc; //$NON-NLS-1$
- totalLine[3] = "" + sumOfMemoryUsed; //$NON-NLS-1$
- totalLine[4] = "" + sumOfStartupTime; //$NON-NLS-1$
- totalLine[8] = "" + sumOfStartupMethodTime; //$NON-NLS-1$
- totalLine[9] = "" + sumOfRAMAlloc; //$NON-NLS-1$
- totalLine[10] = "" + sumOfRAMUsed; //$NON-NLS-1$
- totalLine[11] = "" + sumOfROMAlloc; //$NON-NLS-1$
- totalLine[12] = "" + sumOfROMUsed; //$NON-NLS-1$
- return totalLine;
- }
-
- public void createPartControl(Composite parent) {
- if (!StatsManager.MONITOR_ACTIVATION) {
- Text text = new Text(parent, 0);
- text.setText("Plug-in monitoring is not enabled"); //$NON-NLS-1$
- return;
- }
- super.createPartControl(parent);
- viewer.setInput(BundleStats.class);
- getSite().setSelectionProvider(viewer);
- viewer.setSelection(StructuredSelection.EMPTY);
- }
-
- protected void createActions() {
- refreshAction = new Action("Refresh") { //$NON-NLS-1$
- public void run() {
- VMClassloaderInfo.refreshInfos();
- getViewer().refresh();
- }
- };
- refreshAction.setImageDescriptor(CoreToolsPlugin.createImageDescriptor("refresh.gif")); //$NON-NLS-1$
- refreshAction.setToolTipText("Refresh the data"); //$NON-NLS-1$
- IActionBars actionBars = getViewSite().getActionBars();
- actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction);
-
- displayClassesInfoAction = new Action("Classes") { //$NON-NLS-1$
- public void run() {
- try {
- LoadedClassesView view = (LoadedClassesView) getSite().getPage().showView(LoadedClassesView.VIEW_ID);
- IStructuredSelection selection = ((IStructuredSelection) getViewer().getSelection());
- if (selection == null)
- return;
-
- view.setInput(selection.toArray());
-
- } catch (PartInitException e) {
- e.printStackTrace();
- }
- }
- };
- displayClassesInfoAction.setToolTipText("Display classes loaded by the selected plug-in"); //$NON-NLS-1$
- displayClassesInfoAction.setImageDescriptor(CoreToolsPlugin.createImageDescriptor("classes.gif")); //$NON-NLS-1$
-
- displayStackAction = new Action("Stack &Trace") { //$NON-NLS-1$
- public void run() {
- try {
- StackTraceView view = (StackTraceView) getSite().getPage().showView(StackTraceView.VIEW_ID);
- BundleStats info = (BundleStats) ((IStructuredSelection) getViewer().getSelection()).getFirstElement();
- if (info == null)
- return;
- view.setInput(StatsManager.TRACE_FILENAME, info.getTraceStart(), info.getTraceEnd());
- } catch (PartInitException e) {
- e.printStackTrace();
- }
- }
- };
- displayStackAction.setToolTipText("Display the plug-in activation stack trace"); //$NON-NLS-1$
- displayStackAction.setImageDescriptor(CoreToolsPlugin.createImageDescriptor("trace.gif")); //$NON-NLS-1$
- }
-
- protected ITreeContentProvider getContentProvider() {
- return new ActivePluginsViewContentProvider();
- }
-
- protected ITableLabelProvider getLabelProvider() {
- return new ActivePluginsViewLabelProvider();
- }
-
- protected ViewerSorter getSorter(int column) {
- return new ActivePluginsViewSorter(column);
- }
-
- /**
- * @see org.eclipse.core.tools.TableWithTotalView#getStatusLineMessage(Object)
- */
- protected String getStatusLineMessage(Object element) {
- return ""; //$NON-NLS-1$
- }
-
- protected TableTreeViewer getViewer() {
- return viewer;
- }
-
- public void dispose() {
- // if there is no viewer then we were not monitoring so there
- // is nothing to dispose.
- if (viewer == null)
- return;
- refreshAction.setImageDescriptor(null);
- displayClassesInfoAction.setImageDescriptor(null);
- displayStackAction.setImageDescriptor(null);
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsViewContentProvider.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsViewContentProvider.java
deleted file mode 100644
index d0ce940..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsViewContentProvider.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.internal.stats.BundleStats;
-import org.eclipse.core.runtime.internal.stats.StatsManager;
-import org.eclipse.core.tools.IFlattable;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * Content provider for the ActivePluginsView
- */
-public class ActivePluginsViewContentProvider implements ITreeContentProvider, IFlattable {
- private boolean flat;
-
- public void setFlat(boolean mode) {
- flat = mode;
- }
-
- public void dispose() {
- // do nothing
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-
- public Object[] getChildren(Object element) {
- if (flat || !(element instanceof BundleStats))
- return new Object[0];
- if (element == null)
- return null;
- ArrayList stats = ((BundleStats) element).getBundlesActivated();
- return stats.toArray(new Object[stats.size()]);
- }
-
- public Object getParent(Object element) {
- if (flat || !(element instanceof BundleStats))
- return null;
- if (element == null)
- return null;
- return ((BundleStats) element).getActivatedBy().getSymbolicName();
- }
-
- public boolean hasChildren(Object element) {
- if (flat || !(element instanceof BundleStats))
- return false;
- return element == null ? false : ((BundleStats) element).getBundlesActivated().size() > 0;
- }
-
- public Object[] getElements(Object inputElement) {
- if (!StatsManager.MONITOR_ACTIVATION || inputElement != BundleStats.class)
- return null;
-
- BundleStats[] active = StatsManager.getDefault().getBundles();
- ArrayList result = new ArrayList(active.length);
- for (int i = 0; i < active.length; i++) {
- if (flat || active[i].getActivatedBy() == null)
- result.add(active[i]);
- }
- return result.toArray(new BundleStats[result.size()]);
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsViewLabelProvider.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsViewLabelProvider.java
deleted file mode 100644
index b667f2f..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsViewLabelProvider.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import org.eclipse.core.runtime.internal.stats.BundleStats;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Label provider for the ActivePluginsView
- *
- */
-public class ActivePluginsViewLabelProvider extends LabelProvider implements ITableLabelProvider {
-
- 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
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- if (!(element instanceof BundleStats))
- return "not a plug-in"; //$NON-NLS-1$
- BundleStats info = (BundleStats) element;
- if (info == null)
- return "no info for plug-in"; //$NON-NLS-1$
- VMClassloaderInfo loaderInfo = VMClassloaderInfo.getClassloader(info.getSymbolicName());
- switch (columnIndex) {
- case 0 : /* id */
- return info.getSymbolicName() + (info.isStartupBundle() ? "*" : ""); //$NON-NLS-1$ //$NON-NLS-2$
- case 1 : /* class load count */
- return "" + info.getClassLoadCount(); //$NON-NLS-1$
- case 2 : /* Total Mem Alloc */
- return "" + (loaderInfo.getAllocRAM() + loaderInfo.getAllocROM()); //$NON-NLS-1$
- case 3 : /* Total Mem Used */
- return "" + (loaderInfo.getUsedRAM() + loaderInfo.getUsedROM()); //$NON-NLS-1$
- case 4 : /* startup time */
- return "" + (info.getStartupTime()); //$NON-NLS-1$
- case 5 : /* activation order */
- return "" + info.getActivationOrder(); //$NON-NLS-1$
- case 6 : /* activation time */
- return "" + (int) (info.getTimestamp()); //$NON-NLS-1$
- case 7 : /* class load time*/
- return "" + (int) (info.getClassLoadTime()); //$NON-NLS-1$
- case 8 : /* startup method time */
- return "" + (int) (info.getStartupMethodTime()); //$NON-NLS-1$
- case 9 : /* RAM alloc */
- return "" + loaderInfo.getAllocRAM(); //$NON-NLS-1$
- case 10 : /* RAM used */
- return "" + loaderInfo.getUsedRAM(); //$NON-NLS-1$
- case 11 : /* ROM alloc */
- return "" + loaderInfo.getAllocROM(); //$NON-NLS-1$
- case 12 : /* ROM used */
- return "" + loaderInfo.getUsedROM(); //$NON-NLS-1$
- }
- return null;
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsViewSorter.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsViewSorter.java
deleted file mode 100644
index 5d278d0..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsViewSorter.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import java.text.Collator;
-import org.eclipse.core.runtime.internal.stats.BundleStats;
-import org.eclipse.core.tools.ISorter;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-/**
- * Sorter used in the ActivePluginsView
- */
-public class ActivePluginsViewSorter extends ViewerSorter implements ISorter {
- private boolean reversed = true;
- private int columnNumber;
- private Collator collator = Collator.getInstance();
-
- // column headings: "Plug-in", "Classes", "Alloc", "Used", "Startup time", "Order", "Timestamp", "Class load time", "Startup method time", "RAM Alloc", "RAM Used", "ROM Alloc", "ROM Used" };
- private int[][] SORT_ORDERS_BY_COLUMN = { //
- {0}, /* Plugin */{1, 0}, /* Count */{2, 0}, /* Alloc */{3, 0}, /* Used */{4, 0}, /* Startup time */{5, 0}, /* Order */{6, 0}, /* timestamp */{7, 0}, /* Class load time */{8, 0}, /* Startup method time */{9, 0}, /* RAM Alloc */{10, 0}, /* RAM Used */{11, 0}, /* ROM Alloc */{12, 0} /* ROM Used */
- };
-
- public ActivePluginsViewSorter(int columnNumber) {
- this.columnNumber = columnNumber;
- if (columnNumber == 0)
- reversed = false;
- }
-
- /**
- * Compares two stats objects, sorting first by the main column of this sorter,
- * then by subsequent columns, depending on the column sort order.
- */
- public int compare(Viewer viewer, Object o1, Object o2) {
- BundleStats info1 = (BundleStats) o1;
- BundleStats info2 = (BundleStats) o2;
- int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber];
- int result = 0;
- for (int i = 0; i < columnSortOrder.length; ++i) {
- result = compareColumnValue(columnSortOrder[i], info1, info2);
- if (result != 0)
- break;
- }
- return reversed ? -result : result;
- }
-
- /**
- * Compares two markers, based only on the value of the specified column.
- */
- int compareColumnValue(int column, BundleStats info1, BundleStats info2) {
- VMClassloaderInfo loaderInfo1 = VMClassloaderInfo.getClassloader(info1.getSymbolicName());
- VMClassloaderInfo loaderInfo2 = VMClassloaderInfo.getClassloader(info2.getSymbolicName());
- switch (column) {
- case 0 : /* id */
- return collator.compare(info1.getSymbolicName(), info2.getSymbolicName());
- case 1 : /* Number Of classes loaded */
- return info1.getClassLoadCount() - info2.getClassLoadCount();
- case 2 : /* Total Mem Alloc */
- return (loaderInfo1.getAllocRAM() + loaderInfo1.getAllocROM()) - (loaderInfo2.getAllocRAM() + loaderInfo2.getAllocROM());
- case 3 : /* Total Mem Used */
- return (loaderInfo1.getUsedRAM() + loaderInfo1.getUsedROM()) - (loaderInfo2.getUsedRAM() + loaderInfo2.getUsedROM());
- case 4 : /* startup time */
- return (int) (info1.getStartupTime() - info2.getStartupTime());
- case 5 : /* actionvation order */
- return info1.getActivationOrder() - info2.getActivationOrder();
- case 6 : /* Activation time */
- return (int) (info1.getTimestamp() - info2.getTimestamp());
- case 7 : /* Class load time */
- return (int) (info1.getClassLoadTime() - info2.getClassLoadTime());
- case 8 : /* Startup method time */
- return (int) (info1.getStartupMethodTime() - info2.getStartupMethodTime());
- case 9 : /* RAM Alloc */
- return loaderInfo1.getAllocRAM() - loaderInfo2.getAllocRAM();
- case 10 : /* RAM Alloc */
- return loaderInfo1.getUsedRAM() - loaderInfo2.getUsedRAM();
- case 11 :
- return loaderInfo1.getAllocROM() - loaderInfo2.getAllocROM();
- case 12 :
- return loaderInfo1.getUsedROM() - loaderInfo2.getUsedROM();
- }
- return 0;
- }
-
- public int getColumnNumber() {
- return columnNumber;
- }
-
- public boolean isReversed() {
- return reversed;
- }
-
- public void setReversed(boolean value) {
- reversed = value;
- }
-
- /**
- * @see org.eclipse.core.tools.ISorter#states()
- */
- public int states() {
- return 3;
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ContentTypePropertySource.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ContentTypePropertySource.java
deleted file mode 100644
index 44b7380..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ContentTypePropertySource.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2004 Geoff Longman 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:
- * Geoff Longman - Initial API and implementation
- * IBM - Tightening integration with existing Platform
- **********************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.ui.views.properties.*;
-
-/**
- * A read-only IPropertySource for Marker attributes.
- */
-public class ContentTypePropertySource implements IPropertySource, IAdaptable {
- final static IPropertyDescriptor UNIQUE_ID = new TextPropertyDescriptor("id", "Unique ID");
- final static IPropertyDescriptor NAME = new TextPropertyDescriptor("name", "Name");
- final static IPropertyDescriptor PARENT_ID = new TextPropertyDescriptor("parent", "Parent ID");
- final static IPropertyDescriptor FILE_NAMES = new TextPropertyDescriptor("file-names", "Associated file names");
- final static IPropertyDescriptor FILE_EXTENSIONS = new TextPropertyDescriptor("file-extensions", "Associated file extensions");
- final static IPropertyDescriptor DEFAULT_CHARSET = new TextPropertyDescriptor("charset", "Default charset");
-
- final static IPropertyDescriptor[] PROPERTY_DESCRIPTORS = {UNIQUE_ID, NAME, PARENT_ID, FILE_NAMES, FILE_EXTENSIONS, DEFAULT_CHARSET};
-
- protected IContentType type;
-
- public ContentTypePropertySource(IContentType type) {
- this.type = type;
- }
-
- /**
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue() {
- return null;
- }
-
- /**
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors() {
- return PROPERTY_DESCRIPTORS;
- }
-
- /**
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(Object)
- */
- public Object getPropertyValue(Object id) {
- if (id.equals(UNIQUE_ID.getId()))
- return type.getId();
- if (id.equals(NAME.getId()))
- return type.getName();
- if (id.equals(PARENT_ID.getId())) {
- IContentType baseType = type.getBaseType();
- return baseType == null ? null : baseType.getId();
- }
- if (id.equals(FILE_NAMES.getId()))
- return toString(type.getFileSpecs(IContentType.FILE_NAME_SPEC));
- if (id.equals(FILE_EXTENSIONS.getId()))
- return toString(type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC));
- if (id.equals(DEFAULT_CHARSET.getId()))
- return type.getDefaultCharset();
- return null;
- }
-
- private Object toString(String[] fileNames) {
- if (fileNames.length == 0)
- return ""; //$NON-NLS-1$
- StringBuffer result = new StringBuffer();
- for (int i = 0; i < fileNames.length; i++) {
- result.append(fileNames[i]);
- result.append(',');
- }
- result.deleteCharAt(result.length() - 1);
- return result.toString();
- }
-
- /**
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(Object)
- */
- public boolean isPropertySet(Object id) {
- return true;
- }
-
- /**
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(Object)
- */
- public void resetPropertyValue(Object id) {
- // do nothing
- }
-
- /**
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(Object, Object)
- */
- public void setPropertyValue(Object id, Object value) {
- // do nothing
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof ContentTypePropertySource))
- return false;
- return type.getId().equals(((ContentTypePropertySource) obj).type.getId());
- }
-
- public int hashCode() {
- return type.getId().hashCode();
- }
-
- public String toString() {
- return type.getId();
- }
-
- public Object getAdapter(Class adapter) {
- if (adapter == IPropertySource.class)
- return this;
- return null;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ContentTypeView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ContentTypeView.java
deleted file mode 100644
index 4e2c544..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ContentTypeView.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.core.tools.runtime;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.core.internal.content.ContentTypeManager;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.tools.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Content type Spy view. This view shows detailed information about the currently
- * the content type registry .
- *
- */
-public class ContentTypeView extends SpyView implements IAdaptable {
-
- private static class ContentTypeContentProvider extends AbstractTreeContentProvider {
-
- public ContentTypeContentProvider() {
- super(true);
- }
-
- protected boolean acceptInput(Object input) {
- return true;
- }
-
- private TreeContentProviderNode addContentType(IContentType type, Set visited) {
- ContentTypePropertySource wrapped = new ContentTypePropertySource(type);
- if (!visited.add(wrapped))
- return getNodeFor(wrapped);
- IContentType base = type.getBaseType();
- TreeContentProviderNode newNode = createNode(null, wrapped);
- if (base == null) {
- getRootNode().addChild(newNode);
- return newNode;
- }
- TreeContentProviderNode baseTypeNode = addContentType(base, visited);
- baseTypeNode.addChild(newNode);
- return newNode;
- }
-
- private TreeContentProviderNode getNodeFor(Object type) {
- return getRootNode().findNode(type);
- }
-
- protected void rebuild(Viewer viewer, Object input) {
- IContentType[] allTypes = ContentTypeManager.getInstance().getAllContentTypes();
- Set visited = new HashSet(allTypes.length);
- for (int i = 0; i < allTypes.length; i++)
- addContentType(allTypes[i], visited);
- }
- }
-
- /** JFace's tree component used to present resource details. */
- private AbstractTreeViewer viewer;
-
- public void createPartControl(Composite parent) {
- viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.setContentProvider(new ContentTypeContentProvider());
- viewer.setInput(""); //$NON-NLS-1$
- getSite().setSelectionProvider(viewer);
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/EclipsePreferencesView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/EclipsePreferencesView.java
deleted file mode 100644
index 878493f..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/EclipsePreferencesView.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.tools.CollapseAllAction;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.ViewPart;
-import org.osgi.service.prefs.BackingStoreException;
-
-public class EclipsePreferencesView extends ViewPart {
-
- private TreeViewer viewer;
- private IAction collapseAllAction;
-
- class ViewContentProvider implements IStructuredContentProvider, ITreeContentProvider {
-
- private IEclipsePreferences invisibleRoot;
-
- public void inputChanged(Viewer v, Object oldInput, Object newInput) {
- // do nothing
- }
-
- public Object[] getElements(Object parent) {
- if (parent.equals(getViewSite())) {
- if (invisibleRoot == null)
- invisibleRoot = Platform.getPreferencesService().getRootNode();
- return new Object[] {invisibleRoot};
- }
- return getChildren(parent);
- }
-
- public void dispose() {
- // do nothing
- }
-
- public Object getParent(Object child) {
- if (child instanceof IEclipsePreferences)
- return ((IEclipsePreferences) child).parent();
- return null;
- }
-
- public Object[] getChildren(Object parent) {
- ArrayList result = new ArrayList();
- if (parent instanceof IEclipsePreferences) {
- IEclipsePreferences node = (IEclipsePreferences) parent;
- try {
- String[] childrenNames = node.childrenNames();
- for (int i = 0; childrenNames != null && i < childrenNames.length; i++)
- result.add(node.node(childrenNames[i]));
- String[] keys = node.keys();
- for (int i = 0; i < keys.length; i++)
- result.add(keys[i] + '=' + node.get(keys[i], "")); //$NON-NLS-1$
- } catch (BackingStoreException e) {
- e.printStackTrace();
- }
- }
- return result.toArray(new Object[result.size()]);
- }
-
- public boolean hasChildren(Object parent) {
- if (parent instanceof IEclipsePreferences)
- try {
- IEclipsePreferences node = (IEclipsePreferences) parent;
- return node.childrenNames().length != 0 || node.keys().length != 0;
- } catch (BackingStoreException e) {
- e.printStackTrace();
- }
- return false;
- }
- }
-
- class ViewLabelProvider extends LabelProvider {
-
- public String getText(Object obj) {
- String result = obj.toString();
- if (obj instanceof IEclipsePreferences) {
- IEclipsePreferences node = (IEclipsePreferences) obj;
- result = node.name();
- if (result.length() == 0)
- result = "<root>"; //$NON-NLS-1$
- }
- return result;
- }
-
- public Image getImage(Object obj) {
- String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
- if (obj instanceof IEclipsePreferences)
- imageKey = ISharedImages.IMG_OBJ_FOLDER;
- return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
- }
- }
-
- public EclipsePreferencesView() {
- super();
- }
-
- public void createPartControl(Composite parent) {
- viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.setContentProvider(new ViewContentProvider());
- viewer.setLabelProvider(new ViewLabelProvider());
- viewer.setSorter(new ViewerSorter());
- viewer.setInput(getViewSite());
- getViewSite().setSelectionProvider(viewer);
- IActionBars bars = getViewSite().getActionBars();
- collapseAllAction = new CollapseAllAction(viewer);
- bars.getToolBarManager().add(collapseAllAction);
- bars.updateActionBars();
- }
-
- public void dispose() {
- super.dispose();
- collapseAllAction = null;
- }
-
- public void setFocus() {
- viewer.getControl().setFocus();
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/EventsSorter.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/EventsSorter.java
deleted file mode 100644
index 2881d6d..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/EventsSorter.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import java.text.Collator;
-import java.util.Arrays;
-import java.util.Comparator;
-import org.eclipse.core.runtime.PerformanceStats;
-import org.eclipse.core.tools.ISorter;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-public class EventsSorter extends ViewerSorter implements ISorter {
- protected boolean reversed = false;
- protected int columnNumber;
-
- protected int[][] SORT_ORDERS_BY_COLUMN = {
- // Event
- {EventsView.COLUMN_EVENT, EventsView.COLUMN_BLAME, EventsView.COLUMN_CONTEXT},
- // Blame
- {EventsView.COLUMN_BLAME, EventsView.COLUMN_EVENT, EventsView.COLUMN_CONTEXT},
- // Context
- {EventsView.COLUMN_CONTEXT, EventsView.COLUMN_EVENT, EventsView.COLUMN_BLAME},
- // Count
- {EventsView.COLUMN_COUNT, EventsView.COLUMN_EVENT, EventsView.COLUMN_BLAME, EventsView.COLUMN_CONTEXT},
- // Time
- {EventsView.COLUMN_TIME, EventsView.COLUMN_EVENT, EventsView.COLUMN_BLAME, EventsView.COLUMN_CONTEXT}};
-
- public EventsSorter(int columnNumber) {
- this.columnNumber = columnNumber;
- }
-
- /**
- * Returns the number of the column by which this is sorting.
- */
- public int getColumnNumber() {
- return columnNumber;
- }
-
- /**
- * Returns true for descending, or false for ascending sorting order.
- */
- public boolean isReversed() {
- return reversed;
- }
-
- /**
- * Sets the sorting order.
- */
- public void setReversed(boolean newReversed) {
- reversed = newReversed;
- }
-
- /*
- * Overrides method from ViewerSorter
- */
- public void sort(final Viewer viewer, Object[] elements) {
- Comparator comparator = new Comparator() {
- Collator c = Collator.getInstance();
-
- /**
- * Compares two stats objects, sorting first by the main column of this sorter,
- * then by subsequent columns, depending on the column sort order.
- */
- public int compare(Object o1, Object o2) {
- PerformanceStats s1 = (PerformanceStats) o1;
- PerformanceStats s2 = (PerformanceStats) o2;
- //always sort failures above non-failures
- if (s1.isFailure() && !s2.isFailure())
- return -1;
- if (s2.isFailure() && !s1.isFailure())
- return 1;
- int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber];
- int result = 0;
- for (int i = 0; i < columnSortOrder.length; ++i) {
- result = compareColumnValue(columnSortOrder[i], s1, s2);
- if (result != 0)
- break;
- }
- if (reversed)
- result = -result;
- return result;
- }
-
- /**
- * Compares two markers, based only on the value of the specified column.
- */
- int compareColumnValue(int column, PerformanceStats s1, PerformanceStats s2) {
- switch (column) {
- case EventsView.COLUMN_EVENT :
- return c.compare(s1.getEvent(), s2.getEvent());
- case EventsView.COLUMN_BLAME :
- return c.compare(s1.getBlameString(), s2.getBlameString());
- case EventsView.COLUMN_CONTEXT :
- String name1 = s1.getContext() == null ? "" : s1.getContext(); //$NON-NLS-1$
- String name2 = s2.getContext() == null ? "" : s2.getContext(); //$NON-NLS-1$
- return c.compare(name1, name2);
- case EventsView.COLUMN_COUNT :
- return s2.getRunCount() - s1.getRunCount();
- case EventsView.COLUMN_TIME :
- return (int) (s2.getRunningTime() - s1.getRunningTime());
- }
- return 0;
- }
- };
- Arrays.sort(elements, comparator);
- }
-
- public int states() {
- return 2;
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/EventsView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/EventsView.java
deleted file mode 100644
index 8973b52..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/EventsView.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.core.tools.runtime;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import org.eclipse.core.runtime.PerformanceStats;
-import org.eclipse.core.tools.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.part.WorkbenchPart;
-
-/**
- * Stats View
- *
- * This spy utility will display globally available statistical
- * information on various plug-ins. The statistics available are those that
- * are available through the PluginStats class of
- * org.eclipse.core.resource/src/org/eclipse/core/internal/utils
- *
- * Currently available information includes:
- * the id of the statistic
- * the number of notification this plug-in received
- * the amount of time spent receiving these notifications
- * the number of build requests on this plug-in
- * the amount of time spent building this plug-in
- *
- * Build statistics will only be displayed if the tracing/debug option
- * "build/invoking" in the plug-in org.eclipse.core.resources is set to
- * true.
- */
-
-public class EventsView extends TableWithTotalView {
- class EventsViewContentProvider implements ITreeContentProvider {
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- // do nothing
- }
-
- /** @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) */
- public Object[] getChildren(Object parentElement) {
- return new Object[0];
- }
-
- /** @see IStructuredContentProvider#getElements(Object) */
- public Object[] getElements(Object input) {
- return PerformanceStats.getAllStats();
- }
-
- /** @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) */
- public Object getParent(Object element) {
- return null;
- }
-
- /** @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) */
- public boolean hasChildren(Object element) {
- return false;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer aViewer, Object oldInput, Object newInput) {
- // do nothing
- }
- }
-
- /**
- * Class to display the labels for the stats view table.
- */
- class EventsViewLabelProvider extends LabelProvider implements ITableLabelProvider, IColorProvider {
-
- /**
- * @see ITableLabelProvider#getColumnImage(Object, int)
- */
- public Image getColumnImage(Object arg0, int arg1) {
- return null;
- }
-
- /**
- * @see ITableLabelProvider#getColumnText(Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- if (!(element instanceof PerformanceStats)) {
- return Messages.stats_badStat;
- }
- PerformanceStats stats = (PerformanceStats) element;
- switch (columnIndex) {
- case COLUMN_EVENT :
- return stats.getEvent();
- case COLUMN_BLAME :
- return stats.getBlameString();
- case COLUMN_CONTEXT :
- return stats.getContext(); //$NON-NLS-1$
- case COLUMN_COUNT :
- return Integer.toString(stats.getRunCount());
- case COLUMN_TIME :
- return Long.toString(stats.getRunningTime());
- }
- return Messages.stats_badColumn;
- }
-
- public Color getForeground(Object element) {
- if (!(element instanceof PerformanceStats)) {
- return null;
- }
- PerformanceStats stats = (PerformanceStats) element;
- if (stats.isFailure())
- return Display.getDefault().getSystemColor(SWT.COLOR_RED);
- return null;
- }
-
- public Color getBackground(Object element) {
- return null;
- }
- }
-
- class StatsListener extends PerformanceStats.PerformanceListener {
- private void asyncExec(Runnable runnable) {
- final Control control = viewer.getControl();
- if (control == null || control.isDisposed())
- return;
- final Display display = control.getDisplay();
- if (display.isDisposed())
- return;
- display.asyncExec(runnable);
- }
-
- /**
- * @see PerformanceStats.PerformanceListener#eventsOccurred(PerformanceStats[])
- */
- public void eventsOccurred(final PerformanceStats[] event) {
- asyncExec(new Runnable() {
- public void run() {
- if (!getViewer().getControl().isDisposed())
- getViewer().refresh();
- }
- });
- }
-
- public void eventFailed(final PerformanceStats event, final long duration) {
- asyncExec(new Runnable() {
- public void run() {
- String msg = "Performance event failure: " + event.getEvent() + " blame: " + event.getBlameString() + " context: " + event.getContext() + " duration: " + duration; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- getViewSite().getActionBars().getStatusLineManager().setErrorMessage(msg);
- // MessageDialog.openError(getSite().getShell(), "Performance failure", msg);
- }
- });
- }
- }
-
- // Table of Column Indices
- public final static int COLUMN_EVENT = 0;
- public final static int COLUMN_BLAME = 1;
- public final static int COLUMN_CONTEXT = 2;
- public final static int COLUMN_COUNT = 3;
- public final static int COLUMN_TIME = 4;
-
- private String columnHeaders[] = {Messages.stats_eventHeader, //
- Messages.stats_blameHeader, //
- Messages.stats_contextHeader, //
- Messages.stats_countHeader, //
- Messages.stats_timeHeader, //
- };
- private ColumnLayoutData columnLayouts[] = {new ColumnWeightData(80), // event
- new ColumnWeightData(180), // blame
- new ColumnWeightData(40), // context
- new ColumnPixelData(65), // count
- new ColumnPixelData(65)}; // total time
- private CopyStructuredSelectionAction copyAction;
- private Action resetAction;
- private final StatsListener statsListener = new StatsListener();
-
- /**
- * @see org.eclipse.core.tools.TableWithTotalView#computeTotalLine(java.util.Iterator)
- */
- protected String[] computeTotalLine(Iterator iter) {
- String[] totals = new String[getColumnHeaders().length];
- int count = 0;
- int events = 0;
- int time = 0;
- if (!iter.hasNext()) {
- Object[] elements = ((ITreeContentProvider) viewer.getContentProvider()).getElements(viewer.getInput());
- iter = Arrays.asList(elements == null ? new Object[0] : elements).iterator();
- }
- while (iter.hasNext()) {
- PerformanceStats element = (PerformanceStats) iter.next();
- events += element.getRunCount();
- time += element.getRunningTime();
- count++;
- }
- totals[0] = "Total: " + count; //$NON-NLS-1$
- totals[2] = "" + events; //$NON-NLS-1$
- totals[3] = "" + time; //$NON-NLS-1$
- return totals;
- }
-
- /**
- * @see org.eclipse.core.tools.TableWithTotalView#createActions()
- */
- protected void createActions() {
- resetAction = new Action("Reset") { //$NON-NLS-1$
- public void run() {
- PerformanceStats.clear();
- getViewer().setInput("");
- updateTotals();
- }
- };
- resetAction.setToolTipText("Reset all event statistics"); //$NON-NLS-1$
- resetAction.setImageDescriptor(CoreToolsPlugin.createImageDescriptor("clear.gif")); //$NON-NLS-1$
- // Add copy selection action
-
- IActionBars bars = getViewSite().getActionBars();
- copyAction = new CopyStructuredSelectionAction(new TableSelectionProviderDecorator(viewer));
- copyAction.registerAsGlobalAction(bars);
- bars.updateActionBars();
- }
-
- /**
- * @see org.eclipse.core.tools.TableWithTotalView#createContextMenu()
- */
- protected void createContextMenu() {
- // creates a context menu with actions and adds it to the viewer control
- MenuManager menuMgr = new MenuManager();
- menuMgr.add(resetAction);
- menuMgr.add(copyAction);
- Menu menu = menuMgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- }
-
- /**
- * @see IWorkbenchPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- PerformanceStats.addListener(statsListener);
- viewer.setInput(""); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.core.tools.TableWithTotalView#createToolbar()
- */
- protected void createToolbar() {
- IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager();
- mgr.add(resetAction);
- }
-
- /**
- * @see WorkbenchPart#dispose()
- */
- public void dispose() {
- super.dispose();
- PerformanceStats.removeListener(statsListener);
- }
-
- /**
- * @see org.eclipse.core.tools.TableWithTotalView#getColumnHeaders()
- */
- protected String[] getColumnHeaders() {
- return columnHeaders;
- }
-
- /**
- * @see org.eclipse.core.tools.TableWithTotalView#getColumnLayout()
- */
- protected ColumnLayoutData[] getColumnLayout() {
- return columnLayouts;
- }
-
- /**
- * @see org.eclipse.core.tools.TableWithTotalView#getContentProvider()
- */
- protected ITreeContentProvider getContentProvider() {
- return new EventsViewContentProvider();
- }
-
- /**
- * @see org.eclipse.core.tools.TableWithTotalView#getLabelProvider()
- */
- protected ITableLabelProvider getLabelProvider() {
- return new EventsViewLabelProvider();
- }
-
- /**
- * @see org.eclipse.core.tools.TableWithTotalView#getSorter(int)
- */
- protected ViewerSorter getSorter(int column) {
- return new EventsSorter(column);
- }
-
- /**
- * @see org.eclipse.core.tools.TableWithTotalView#getStatusLineMessage(Object)
- */
- protected String getStatusLineMessage(Object element) {
- if (!(element instanceof PerformanceStats))
- return ""; //$NON-NLS-1$
- return ((PerformanceStats) element).getBlameString();
- }
-
- protected TableTreeViewer getViewer() {
- return viewer;
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesView.java
deleted file mode 100644
index 265135a..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesView.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import org.eclipse.core.runtime.internal.stats.ClassStats;
-import org.eclipse.core.runtime.internal.stats.StatsManager;
-import org.eclipse.core.tools.CoreToolsPlugin;
-import org.eclipse.core.tools.TableWithTotalView;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PartInitException;
-
-/**
- * View that display information about classes
- */
-public class LoadedClassesView extends TableWithTotalView {
- private Action displayStackAction;
-
- public static String VIEW_ID = LoadedClassesView.class.getName();
- private String[] columnHeaders = new String[] {"Class", "Order", "Memory", "Plug-in", "Timestamp", "RAM", "ROM"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- private ColumnLayoutData[] columnLayout = new ColumnLayoutData[] {new ColumnWeightData(500), new ColumnWeightData(100), new ColumnWeightData(100), new ColumnWeightData(200), new ColumnPixelData(0), new ColumnPixelData(0), new ColumnPixelData(0)};
-
- protected String[] getColumnHeaders() {
- return columnHeaders;
- }
-
- protected ColumnLayoutData[] getColumnLayout() {
- return columnLayout;
- }
-
- public void createPartControl(Composite parent) {
- if (!StatsManager.MONITOR_CLASSES) {
- Text text = new Text(parent, 0);
- text.setText("Class monitoring is not enabled."); //$NON-NLS-1$
- return;
- }
- super.createPartControl(parent);
- viewer.setSelection(StructuredSelection.EMPTY);
- }
-
- protected ITreeContentProvider getContentProvider() {
- return new LoadedClassesViewContentProvider();
- }
-
- protected ITableLabelProvider getLabelProvider() {
- return new LoadedClassesViewLabelProvider();
- }
-
- protected ViewerSorter getSorter(int column) {
- return new LoadedClassesViewSorter(column);
- }
-
- /**
- * @see org.eclipse.core.tools.TableWithTotalView#getStatusLineMessage(Object)
- */
- protected String getStatusLineMessage(Object element) {
- return ""; //$NON-NLS-1$
- }
-
- protected TableTreeViewer getViewer() {
- return viewer;
- }
-
- protected void createActions() {
- displayStackAction = new Action("Stack &Trace") { //$NON-NLS-1$
- public void run() {
- try {
- StackTraceView view = (StackTraceView) getSite().getPage().showView(StackTraceView.VIEW_ID);
- ClassStats clazz = (ClassStats) ((IStructuredSelection) getViewer().getSelection()).getFirstElement();
- if (clazz == null)
- return;
- view.setInput(StatsManager.TRACE_FILENAME, clazz.getTraceStart(), clazz.getTraceEnd());
- } catch (PartInitException e) {
- e.printStackTrace();
- }
- }
- };
- displayStackAction.setToolTipText("Display the class activation stack trace"); //$NON-NLS-1$
- displayStackAction.setImageDescriptor(CoreToolsPlugin.createImageDescriptor("trace.gif")); //$NON-NLS-1$
- }
-
- protected void createToolbar() {
- IToolBarManager manager = getViewSite().getActionBars().getToolBarManager();
- manager.add(displayStackAction);
- }
-
- public void setInput(Object input) {
- viewer.setInput(input);
- viewer.setSelection(StructuredSelection.EMPTY);
- }
-
- protected String[] computeTotalLine(Iterator iterator) {
- String[] totals = new String[getColumnHeaders().length];
- int ramTotal = 0;
- int romTotal = 0;
- int jitTotal = 0;
- int count = 0;
- if (!iterator.hasNext()) {
- Object[] elements = ((ITreeContentProvider) viewer.getContentProvider()).getElements(viewer.getInput());
- iterator = Arrays.asList(elements == null ? new Object[0] : elements).iterator();
- }
- while (iterator.hasNext()) {
- ClassStats clazz = (ClassStats) iterator.next();
- VMClassloaderInfo loader = VMClassloaderInfo.getClassloader(clazz.getClassloader().getId());
- VMClassInfo classInfo = loader.getClass(clazz.getClassName());
- ramTotal += classInfo.getRAMSize();
- romTotal += classInfo.getROMSize();
- jitTotal += classInfo.getJitSize();
- count++;
- }
- totals[0] = "Total: " + count; //$NON-NLS-1$
- totals[2] = Integer.toString(ramTotal + romTotal);
- totals[5] = Integer.toString(ramTotal);
- totals[6] = Integer.toString(romTotal);
- return totals;
- }
-
- public void dispose() {
- if (displayStackAction != null)
- displayStackAction.setImageDescriptor(null);
- }
-
- protected void createContextMenu() {
- MenuManager manager = new MenuManager();
- manager.setRemoveAllWhenShown(true);
- manager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager mgr) {
- fillContextMenu(mgr);
- }
- });
- Menu menu = manager.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- getSite().registerContextMenu(manager, viewer);
- }
-
- protected void fillContextMenu(IMenuManager manager) {
- manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
- manager.add(displayStackAction);
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesViewContentProvider.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesViewContentProvider.java
deleted file mode 100644
index 7994ed2..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesViewContentProvider.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import java.util.*;
-import org.eclipse.core.runtime.internal.stats.*;
-import org.eclipse.core.tools.IFlattable;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * Content provider for the LoadedClassesView
- */
-public class LoadedClassesViewContentProvider implements ITreeContentProvider, IFlattable {
- private boolean flat;
- private String inputNames[] = new String[0];
-
- public void setFlat(boolean mode) {
- flat = mode;
- }
-
- public Object[] getChildren(Object element) {
- if (flat || !(element instanceof ClassStats))
- return new Object[0];
- ArrayList result = new ArrayList(10);
- for (Iterator i = ((ClassStats) element).getLoadedClasses().iterator(); i.hasNext();) {
- ClassStats child = (ClassStats) i.next();
- if (filterChildren(child, inputNames))
- result.add(child);
- }
- return result.toArray(new Object[result.size()]);
- }
-
- private boolean filterChildren(ClassStats element, String[] filters) {
- String name = element.getClassloader().getId();
- for (int i = 0; i < filters.length; i++)
- if (filters[i].equals(name))
- return true;
- ArrayList children = element.getLoadedClasses();
- for (Iterator i = children.iterator(); i.hasNext();)
- if (filterChildren((ClassStats) i.next(), filters))
- return true;
- return false;
- }
-
- public Object getParent(Object element) {
- if (flat || !(element instanceof ClassStats))
- return null;
- return ((ClassStats) element).getLoadedBy();
- }
-
- public boolean hasChildren(Object element) {
- if (flat || !(element instanceof ClassStats))
- return false;
- for (Iterator i = ((ClassStats) element).getLoadedClasses().iterator(); i.hasNext();)
- if (filterChildren((ClassStats) i.next(), inputNames))
- return true;
- return false;
- }
-
- public Object[] getElements(Object inputElement) {
- if (!StatsManager.MONITOR_CLASSES)
- return null;
- if (inputElement instanceof Object[]) {
- Object[] elements = (Object[]) inputElement;
- if (elements.length == 0 || !(elements[0] instanceof BundleStats))
- return null;
- Set result = new HashSet(51);
- for (int i = 0; i < elements.length; i++) {
- ClassStats[] classes = getClasses(((BundleStats) elements[i]).getSymbolicName());
- result.addAll(Arrays.asList(classes));
- }
- return result.toArray(new Object[result.size()]);
- }
- return null;
- }
-
- private ClassStats[] getClasses(String id) {
- ClassloaderStats loader = ClassloaderStats.getLoader(id);
- if (loader == null)
- return new ClassStats[0];
- ClassStats[] classes = loader.getClasses();
- if (flat)
- return classes;
- ArrayList result = new ArrayList();
- for (int i = 0; i < classes.length; i++) {
- ClassStats target = classes[i];
- while (target.getLoadedBy() != null)
- target = target.getLoadedBy();
- result.add(target);
- }
- return (ClassStats[]) result.toArray(new ClassStats[result.size()]);
- }
-
- public void dispose() {
- // do nothing
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (oldInput == newInput)
- return;
- if (newInput == null) {
- inputNames = new String[0];
- return;
- }
- Object[] list = (Object[]) newInput;
- inputNames = new String[list.length];
- for (int i = 0; i < list.length; i++)
- inputNames[i] = ((BundleStats) list[i]).getSymbolicName();
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesViewLabelProvider.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesViewLabelProvider.java
deleted file mode 100644
index 3195b3c..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesViewLabelProvider.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import org.eclipse.core.runtime.internal.stats.ClassStats;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * LabelProvider for the LoadedClassesView
- */
-
-public class LoadedClassesViewLabelProvider extends LabelProvider implements ITableLabelProvider {
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- if (!(element instanceof ClassStats))
- return "not a class info"; //$NON-NLS-1$
- ClassStats clazz = (ClassStats) element;
- VMClassloaderInfo loader = VMClassloaderInfo.getClassloader(clazz.getClassloader().getId());
- VMClassInfo classInfo = loader.getClass(clazz.getClassName());
-
- switch (columnIndex) {
- case 0 : //"Class name"
- return clazz.getClassName() + (clazz.isStartupClass() ? "*" : ""); //$NON-NLS-1$ //$NON-NLS-2$
- case 1 : // "Loading order",
- return clazz.getLoadOrder() == -2 ? "<boot>" : "" + clazz.getLoadOrder(); //$NON-NLS-1$ //$NON-NLS-2$
- case 2 : // "Memory",
- return classInfo == null ? "" : "" + (classInfo.getRAMSize() + classInfo.getROMSize()); //$NON-NLS-1$ //$NON-NLS-2$
- case 3 : // "Plug-in Id",
- return clazz.getClassloader().getId();
- case 4 : // "Activation time",
- return "" + clazz.getTimestamp(); //$NON-NLS-1$
- case 5 : // "RAM",
- return classInfo == null ? "" : "" + classInfo.getRAMSize(); //$NON-NLS-1$ //$NON-NLS-2$
- case 6 : // "ROM"
- return classInfo == null ? "" : "" + classInfo.getROMSize(); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return ""; //$NON-NLS-1$
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesViewSorter.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesViewSorter.java
deleted file mode 100644
index e1b9153..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesViewSorter.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import java.text.Collator;
-import org.eclipse.core.runtime.internal.stats.ClassStats;
-import org.eclipse.core.tools.ISorter;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-public class LoadedClassesViewSorter extends ViewerSorter implements ISorter {
- private boolean reversed = true;
- private int columnNumber;
- private Collator collator = Collator.getInstance();
-
- // columnHeaders = new String[]{ "Class", "Order", "Memory", "Plug-in", "Timestamp", "RAM", "ROM" };
- private int[][] SORT_ORDERS_BY_COLUMN = { //
- {0, 3}, /* Class */{1, 0, 3}, /* Order */{2, 0, 3}, /* Memory*/{3, 0}, /* Plugin */{4, 0, 3}, /* Timestamp */{5, 0, 3}, /* RAM */{6, 0, 3}, /* ROM */
- };
-
- public LoadedClassesViewSorter(int columnNumber) {
- this.columnNumber = columnNumber;
- if (columnNumber == 0)
- reversed = false;
- }
-
- /**
- * Compares two stats objects, sorting first by the main column of this sorter,
- * then by subsequent columns, depending on the column sort order.
- */
- public int compare(Viewer viewer, Object o1, Object o2) {
- ClassStats class1 = (ClassStats) o1;
- ClassStats class2 = (ClassStats) o2;
-
- int[] columnSortOrder;
- columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber];
-
- int result = 0;
- for (int i = 0; i < columnSortOrder.length; ++i) {
- result = compareColumnValue(columnSortOrder[i], class1, class2);
- if (result != 0)
- break;
- }
- if (reversed)
- result = -result;
- return result;
- }
-
- /**
- * Compares two markers, based only on the value of the specified column.
- */
- private int compareColumnValue(int column, ClassStats class1, ClassStats class2) {
- VMClassloaderInfo loader = VMClassloaderInfo.getClassloader(class1.getClassloader().getId());
- VMClassInfo classInfo1 = loader.getClass(class1.getClassName());
- loader = VMClassloaderInfo.getClassloader(class2.getClassloader().getId());
- VMClassInfo classInfo2 = loader.getClass(class2.getClassName());
- switch (column) {
- case 0 : { /* class name */
- String package1 = getPackageName(class1.getClassName());
- String package2 = getPackageName(class2.getClassName());
- int result = collator.compare(package1, package2);
- return result != 0 ? result : collator.compare(class1.getClassName(), class2.getClassName());
- }
- case 1 : /*Loading order */
- return class1.getLoadOrder() - class2.getLoadOrder();
- case 2 : /* Memory */
- return (classInfo1.getRAMSize() + classInfo1.getROMSize()) - (classInfo2.getRAMSize() + classInfo2.getROMSize());
- case 3 : /* Plugin Id */
- return collator.compare(class1.getClassloader().getId(), class2.getClassloader().getId());
- case 4 : /* Activation time */
- return (int) (class1.getTimestamp() - class2.getTimestamp());
- case 5 : /* RAM */
- return classInfo1.getRAMSize() - classInfo2.getRAMSize();
- case 6 : /* ROM */
- return classInfo1.getROMSize() - classInfo2.getROMSize();
- }
- return 0;
- }
-
- private String getPackageName(String className) {
- int index = className.lastIndexOf('.');
- return index == -1 ? "" : className.substring(0, index); //$NON-NLS-1$
- }
-
- /**
- * Returns the number of the column by which this is sorting.
- */
- public int getColumnNumber() {
- return columnNumber;
- }
-
- /**
- * Returns true for descending, or false for ascending sorting order.
- */
- public boolean isReversed() {
- return reversed;
- }
-
- /**
- * Sets the sorting order.
- */
- public void setReversed(boolean value) {
- reversed = value;
- }
-
- /**
- * @see org.eclipse.core.tools.ISorter#states()
- */
- public int states() {
- return 3;
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDataSheetView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDataSheetView.java
deleted file mode 100644
index 4cb5f17..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDataSheetView.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.internal.stats.*;
-import org.eclipse.core.tools.BaseTextView;
-import org.eclipse.core.tools.DeepSize;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IWorkbenchPart;
-import org.osgi.framework.Bundle;
-
-/**
- * View displaying information about the resources for a given plugin
- *
- */
-public class PluginDataSheetView extends BaseTextView implements ISelectionListener {
-
- /** The id by which this view is known in the plug-in registry */
- public static final String VIEW_ID = PluginDataSheetView.class.getName();
-
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- getViewSite().getPage().addSelectionListener(this);
- }
-
- public void dispose() {
- getViewSite().getPage().removeSelectionListener(this);
- }
-
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- Object first = ((IStructuredSelection) selection).getFirstElement();
- if (first != null && first instanceof BundleStats) {
- viewer.getDocument().set(printStats((BundleStats) first));
- viewer.refresh();
- }
- }
- }
-
- private String printStats(BundleStats descriptor) {
- StringBuffer result = new StringBuffer(200);
- ClassloaderStats classloader = ClassloaderStats.getLoader(descriptor.getSymbolicName());
- printResourceBundleStats(result, classloader == null ? null : classloader.getBundles(), descriptor);
- result.append('\n');
- printExtensionLoadingStats(result, Platform.getExtensionRegistry().getExtensions(descriptor.getSymbolicName()));
- return result.toString();
- }
-
- private void printExtensionLoadingStats(StringBuffer result, IExtension[] extensions) {
- if (extensions.length == 0) {
- result.append("No extensions contributed by this plug-in\n"); //$NON-NLS-1$
- return;
- }
- result.append("Extension loading stats:\n"); //$NON-NLS-1$
- for (int i = 0; i < extensions.length; i++) {
- IExtension extension = extensions[i];
- result.append('\t');
- result.append(extension.getExtensionPointUniqueIdentifier());
- result.append(" <- "); //$NON-NLS-1$
- result.append(extension.getUniqueIdentifier());
- result.append('\n');
- }
- }
-
- private void printResourceBundleStats(StringBuffer result, ArrayList bundles, BundleStats info) {
- if (bundles == null || bundles.size() == 0) {
- result.append("No resources loaded by this plug-in\n"); //$NON-NLS-1$
- return;
- }
- result.append("Resource bundles stats:\n"); //$NON-NLS-1$
- for (Iterator iterator = bundles.iterator(); iterator.hasNext();) {
- ResourceBundleStats resource = (ResourceBundleStats) iterator.next();
- result.append('\t');
- result.append(resource.getFileName());
- result.append("\tElements: #" + resource.getKeyCount()); //$NON-NLS-1$
- long totalSize;
- // if hashsize == 0, we should compute the total size using DeepSize
- if (resource.getHashSize() == 0) {
- DeepSize.reset();
- DeepSize calculator = new DeepSize();
- Bundle bundle = Platform.getBundle(info.getSymbolicName());
- if (bundle != null)
- calculator.deepSize(Platform.getResourceBundle(bundle));
- totalSize = calculator.getSize();
- } else
- totalSize = resource.getTotalSize();
- result.append(" \ttotal: " + totalSize); //$NON-NLS-1$
- result.append("b \tkeys: " + resource.getKeySize()); //$NON-NLS-1$
- result.append("b \tvalues: " + resource.getValueSize() + "b\n"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyGraphNode.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyGraphNode.java
deleted file mode 100644
index 38f5113..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyGraphNode.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import java.util.*;
-import org.eclipse.core.tools.Messages;
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * This class is used to build up a dependency graph. The full dependency
- * graph is just a hash table containing PluginDependencyGraphNode's. Each
- * node represents one plug-in. They are retrievable based on the plug-in
- * id. Each node has a list of all the plug-in ids for plug-ins that this
- * plug-in requires (children) and another list of all the plug-in ids that
- * require this particular plug-in (ancestors).
- */
-public class PluginDependencyGraphNode {
-
- private BundleDescription descriptor = null;
- private Set children = new HashSet();
- private Set ancestors = new HashSet();
-
- /**
- * Constructor for this class. Each node is associated with a plug-in so
- * we accept the plug-in descriptor here and keep it around for later use.
- */
- public PluginDependencyGraphNode(BundleDescription descriptor) {
- this.descriptor = descriptor;
- }
-
- /**
- * Add the given node to this node's set of ancestors.
- */
- public void addAncestor(PluginDependencyGraphNode ancestor) {
- ancestors.add(ancestor);
- }
-
- /**
- * Add the given node to this node's set of children.
- */
- public void addChild(PluginDependencyGraphNode child) {
- children.add(child);
- }
-
- /**
- * Return the identifier for this node. It is the unique plug-in identifier
- * for this object's plug-in descriptor.
- *
- * @return the plug-in id
- */
- public String getId() {
- return descriptor.getSymbolicName();
- }
-
- /**
- * Return a string representation of this object. It should be nicely formated
- * and include the list of children and ancestor nodes.
- */
- public String toDeepString() {
- StringBuffer buffer = new StringBuffer();
-
- // write ID
- writeln(buffer, 0, NLS.bind(Messages.stats_pluginid, descriptor.getSymbolicName()));
-
- // write ancestors
- if (ancestors.size() == 0) {
- writeln(buffer, 1, Messages.depend_noParentPlugins);
- } else {
- writeln(buffer, 1, Messages.depend_requiredBy);
- for (Iterator i = ancestors.iterator(); i.hasNext();) {
- PluginDependencyGraphNode ancestor = (PluginDependencyGraphNode) i.next();
- writeln(buffer, 2, ancestor.getId());
- }
- }
-
- // write children
- if (children.size() == 0) {
- writeln(buffer, 1, Messages.depend_noChildrenPlugins);
- } else {
- writeln(buffer, 1, Messages.depend_requires);
- for (Iterator i = children.iterator(); i.hasNext();) {
- PluginDependencyGraphNode child = (PluginDependencyGraphNode) i.next();
- writeln(buffer, 2, child.getId());
- }
- }
- return buffer.toString();
- }
-
- /**
- * Ultility method to write a string and cr to the given buffer. Indent the
- * text the given number of tabs.
- */
- private void writeln(StringBuffer buffer, int indent, String text) {
- for (int i = 0; i < indent; i++)
- buffer.append('\t');
- buffer.append(text);
- buffer.append('\n');
- }
-
- /**
- * @see java.lang.Object#equals(Object)
- */
- public boolean equals(Object obj) {
- if (obj == null)
- return false;
- if (!(obj instanceof PluginDependencyGraphNode))
- return false;
- PluginDependencyGraphNode other = (PluginDependencyGraphNode) obj;
- return this.getId().equals(other.getId());
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return getId().hashCode();
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append("PluginDependencyGraphNode("); //$NON-NLS-1$
- buffer.append(descriptor.getSymbolicName());
- buffer.append(')');
- return buffer.toString();
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyPerspective.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyPerspective.java
deleted file mode 100644
index e8d11e1..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyPerspective.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import org.eclipse.ui.*;
-
-/**
- * A perspective for working with metadata files.
- */
-public class PluginDependencyPerspective implements IPerspectiveFactory {
- /**
- * Creates a layout containing the following views:
- * PluginListView and
- * PluginDependencyView
- * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)
- */
- public void createInitialLayout(IPageLayout layout) {
- String editorAreaId = layout.getEditorArea();
-
- layout.setEditorAreaVisible(false);
-
- IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, (float) 0.30, editorAreaId); //$NON-NLS-1$
- left.addView(PluginListView.VIEW_ID);
-
- IFolderLayout right = layout.createFolder("right", IPageLayout.RIGHT, (float) 0.7, editorAreaId); //$NON-NLS-1$
- right.addView(PluginDependencyView.VIEW_ID);
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyView.java
deleted file mode 100644
index d34890f..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyView.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.internal.stats.BundleStats;
-import org.eclipse.core.tools.*;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.service.resolver.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.*;
-
-public class PluginDependencyView extends SpyView implements ISelectionListener {
-
- private TextViewer viewer;
- private Map dependencyGraph = null;
-
- /** The id by which this view is known in the plug-in registry */
- public static final String VIEW_ID = PluginDependencyView.class.getName();
-
- /**
- * @see IWorkbenchPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- viewer = new TextViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.WRAP | SWT.READ_ONLY);
- viewer.setDocument(new Document());
-
- IActionBars bars = getViewSite().getActionBars();
-
- final GlobalAction clearOutputAction = new ClearTextAction(viewer.getDocument());
- clearOutputAction.registerAsGlobalAction(bars);
-
- final GlobalAction selectAllAction = new SelectAllAction(viewer);
- selectAllAction.registerAsGlobalAction(bars);
-
- // Delete action shortcuts are not captured by the workbench
- // so we need our key binding service to handle Delete keystrokes for us
- this.viewer.getControl().addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- if (e.character == SWT.DEL)
- clearOutputAction.run();
- }
- });
-
- GlobalAction copyAction = new CopyTextSelectionAction(viewer);
- copyAction.registerAsGlobalAction(bars);
-
- bars.getToolBarManager().add(clearOutputAction);
-
- bars.updateActionBars();
-
- // creates a context menu with actions and adds it to the viewer control
- MenuManager menuMgr = new MenuManager();
- menuMgr.add(copyAction);
- menuMgr.add(clearOutputAction);
- Menu menu = menuMgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
-
- getViewSite().getPage().addSelectionListener(this);
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- getViewSite().getPage().removeSelectionListener(this);
- super.dispose();
- dependencyGraph = null;
- }
-
- /**
- * Build the table of plug-in dependencies. Iterate over all the plug-ins in the
- * plug-in registry and the cycle through the list of pre-requisites and create the
- * parent/child relationships in the nodes.
- */
- private Map getDependencyGraph() {
- if (dependencyGraph != null)
- return dependencyGraph;
- // Build up the dependency graph (see PluginDependencyGraphNode) so
- // we have the information readily available for any plug-in.
- State state = Platform.getPlatformAdmin().getState(false);
- BundleDescription[] plugins = state.getBundles();
- dependencyGraph = new HashMap();
- for (int i = 0; i < plugins.length; i++) {
- BundleDescription descriptor = plugins[i];
- PluginDependencyGraphNode node = (PluginDependencyGraphNode) dependencyGraph.get(new Long(descriptor.getBundleId()));
- if (node == null) {
- node = new PluginDependencyGraphNode(descriptor);
- dependencyGraph.put(new Long(descriptor.getBundleId()), node);
- }
-
- // Cycle through the prerequisites
- BundleSpecification[] requires = descriptor.getRequiredBundles();
- for (int j = 0; j < requires.length; j++) {
- BundleDescription childDesc = (BundleDescription) requires[j].getSupplier();
- // if the child doesn't exist then move to the next child
- if (childDesc == null)
- continue;
-
- // if the child entry is not in the table yet then add it
- PluginDependencyGraphNode childNode = (PluginDependencyGraphNode) dependencyGraph.get(new Long(childDesc.getBundleId()));
- if (childNode == null) {
- childNode = new PluginDependencyGraphNode(childDesc);
- dependencyGraph.put(new Long(childDesc.getBundleId()), childNode);
- }
-
- // Add the child to this node's children and set this node as an ancestor
- // of the child node
- node.addChild(childNode);
- childNode.addAncestor(node);
- }
- }
- return dependencyGraph;
- }
-
- /**
- * @see ISelectionListener#selectionChanged(IWorkbenchPart, ISelection)
- */
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- if (!(selection instanceof IStructuredSelection))
- return;
- Object element = ((IStructuredSelection) selection).getFirstElement();
- long id = -1;
- String name = null;
- if (element instanceof BundleDescription) {
- id = ((BundleDescription) element).getBundleId();
- name = ((BundleDescription) element).getSymbolicName();
- }
- if (element instanceof BundleStats) {
- id = ((BundleStats) element).getId();
- name = ((BundleStats) element).getSymbolicName();
- }
- if (id == -1)
- return;
- PluginDependencyGraphNode node = (PluginDependencyGraphNode) getDependencyGraph().get(new Long(id));
- String text = node == null ? NLS.bind(Messages.depend_noInformation, name) : node.toDeepString();
- viewer.getDocument().set(text);
- viewer.refresh();
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginListView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginListView.java
deleted file mode 100644
index 7a5dac4..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginListView.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import java.util.*;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.tools.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-public class PluginListView extends SpyView implements IStructuredContentProvider {
-
- // cache the plug-in list
- private Object[] bundles = null;
-
- /** The id by which this view is known in the plug-in registry */
- public static final String VIEW_ID = PluginListView.class.getName();
-
- /**
- * Class which provides the text labels for the view.
- */
- class PluginListLabelProvider extends LabelProvider implements ITableLabelProvider {
- /**
- * @see ITableLabelProvider#getColumnImage(Object, int)
- */
- public Image getColumnImage(Object arg0, int arg1) {
- return null;
- }
-
- /**
- * @see ITableLabelProvider#getColumnText(Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- return element == null ? Messages.depend_badPluginId : ((BundleDescription) element).getSymbolicName();
- }
- }
-
- /**
- * @see IStructuredContentProvider#getElements(Object)
- */
- public Object[] getElements(Object arg0) {
- if (bundles == null) {
- // before caching the array of descriptors, sort them.
- // we have to use a comparator here because plug-in
- // descriptors cannot be compared against each other
- // in a tree set.
- Comparator comparator = new Comparator() {
- public int compare(Object obj1, Object obj2) {
- String id1 = ((BundleDescription) obj1).getSymbolicName();
- String id2 = ((BundleDescription) obj2).getSymbolicName();
- return id1.compareTo(id2);
- }
- };
- Set set = new TreeSet(comparator);
- BundleContext context = CoreToolsPlugin.getDefault().getContext();
- Bundle[] allBundles = context.getBundles();
- State state = Platform.getPlatformAdmin().getState(false);
- for (int i = 0; i < allBundles.length; i++)
- set.add(state.getBundle(allBundles[i].getBundleId()));
- bundles = set.toArray();
- }
- return bundles;
- }
-
- /**
- * @see IContentProvider#dispose()
- */
- public void dispose() {
- bundles = null;
- }
-
- /**
- * @see IContentProvider#inputChanged(Viewer, Object, Object)
- */
- public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
- // do nothing
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(Composite)
- */
- public void createPartControl(Composite parent) {
- // Create viewer.
- ListViewer viewer = new ListViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- viewer.setContentProvider(this);
- viewer.setLabelProvider(new PluginListLabelProvider());
- viewer.setInput(""); //$NON-NLS-1$
- getSite().setSelectionProvider(viewer);
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PreferenceStatsView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PreferenceStatsView.java
deleted file mode 100644
index ad3c9dc..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PreferenceStatsView.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.core.tools.runtime;
-
-import java.util.*;
-import org.eclipse.core.internal.preferences.EclipsePreferences;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.preferences.*;
-import org.eclipse.core.tools.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.text.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IActionBars;
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * Text view that dumps sizeof info and stats about the
- * Eclipse preferences tree.
- *
- * @since 3.0
- */
-public class PreferenceStatsView extends SpyView {
-
- // The JFace widget used for showing the Element Tree info.
- protected TextViewer viewer;
-
- private IAction updateAction;
-
- class UpdateAction extends Action {
-
- // number of nodes in the tree
- int nodeCount;
- // number of key/value pairs in the tree
- int kvCount;
- // number of nodes without key/value pairs
- int emptyNodes;
- // size of the tree
- int treeSize;
- // list of node with key/value pairs
- Set nonEmptyNodes;
-
- // root node
- IEclipsePreferences rootNode = Platform.getPreferencesService().getRootNode();
-
- UpdateAction() {
- super("Update view"); //$NON-NLS-1$
- this.setToolTipText("Update"); //$NON-NLS-1$
- this.setImageDescriptor(CoreToolsPlugin.createImageDescriptor("refresh.gif")); //$NON-NLS-1$
- }
-
- public void run() {
- super.run();
- reset();
- try {
- visitTree();
- } catch (BackingStoreException e) {
- e.printStackTrace();
- }
- updateTextView();
- reset();
- }
-
- void reset() {
- nodeCount = 0;
- kvCount = 0;
- emptyNodes = 0;
- treeSize = 0;
- nonEmptyNodes = new TreeSet();
- }
-
- int basicSizeof(IEclipsePreferences node) {
- if (node instanceof EclipsePreferences)
- return basicSizeof((EclipsePreferences) node);
-
- // name
- int count = sizeof(node.name());
-
- // key/value pairs
- try {
- String[] keys = node.keys();
- for (int i = 0; i < keys.length; i++) {
- count += sizeof(keys[i]);
- String value = node.get(keys[i], null);
- count += sizeof(value);
- }
- } catch (BackingStoreException e) {
- e.printStackTrace();
- }
- return count;
- }
-
- int calculateOldSize() {
- int count = 0;
- IPluginRegistry registry = Platform.getPluginRegistry();
- if (registry == null)
- return count;
- IPluginDescriptor[] descriptors = registry.getPluginDescriptors();
- if (descriptors == null)
- return count;
- for (int i = 0; i < descriptors.length; i++) {
- IPluginDescriptor desc = descriptors[i];
- // if (desc.isPluginActivated())
- count += calculateOldSizeFor(desc.getUniqueIdentifier());
- }
- return count;
- }
-
- int calculateOldSizeFor(String pluginID) {
- int count = 0;
- // 12 for the object header + 4 for each field
- count += 12;
-
- // dirty boolean
- count += 4;
-
- // listener list
- // TODO
- count += 4;
-
- // Properties properties
- count += 4;
- IEclipsePreferences node = new InstanceScope().getNode(pluginID);
- if (node != null) {
- // add the key/value pairs
- // TODO rough estimate
- try {
- String[] keys = node.keys();
- for (int i = 0; i < keys.length; i++) {
- count += sizeof(keys[i]);
- String value = node.get(keys[i], null);
- count += sizeof(value);
- }
- } catch (BackingStoreException e) {
- e.printStackTrace();
- }
- }
-
- // Properties defaults
- count += 4;
- node = new DefaultScope().getNode(pluginID);
- if (node != null) {
- // add the key/value pairs
- // TODO rough estimate
- try {
- String[] keys = node.keys();
- for (int i = 0; i < keys.length; i++) {
- count += sizeof(keys[i]);
- String value = node.get(keys[i], null);
- count += sizeof(value);
- }
- } catch (BackingStoreException e) {
- e.printStackTrace();
- }
- }
-
- return count;
- }
-
- /*
- * 12 for the object header
- * 4 for each slot
- */
- int basicSizeof(EclipsePreferences node) {
- int count = 12;
-
- // name
- count += 4;
- count += sizeof(node.name());
-
- // dirty boolean
- count += 4;
-
- // removed boolean
- count += 4;
-
- // loading boolean
- count += 4;
-
- // slot for the parent pointer
- count += 4;
-
- // child map
- // TODO this isn't quite right but is ok for now
- count += 4;
- String[] childrenNames = node.childrenNames();
- for (int i = 0; i < childrenNames.length; i++)
- count += sizeof(childrenNames[i]);
-
- // node change listener list
- // TODO
- count += 4;
-
- // preference change listener list
- // TODO
- count += 4;
-
- // cached path
- count += 4;
- count += sizeof(node.absolutePath());
-
- // key/value pairs
- // TODO this isn't quite right but is ok for now
- count += 4;
- String[] keys = node.keys();
- for (int i = 0; i < keys.length; i++) {
- count += sizeof(keys[i]);
- String value = node.get(keys[i], null);
- count += sizeof(value);
- }
-
- return count;
- }
-
- int basicSizeof(Map map) {
- if (map == null)
- return 0;
-
- //formula taken from BundleStats
- int count = (int) Math.round(44 + (16 + (map.size() * 1.25 * 4)) + (24 * map.size()));
-
- for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry) it.next();
- count += sizeof(entry.getKey());
- count += sizeof(entry.getValue());
- }
- return count;
- }
-
- /**
- * All sizeof tests should go through this central method to weed out
- * duplicates.
- */
- int sizeof(Object object) {
- if (object == null)//|| DeepSize.ignore(object))
- return 0;
- if (object instanceof String)
- return 44 + 2 * ((String) object).length();
- if (object instanceof byte[])
- return 16 + ((byte[]) object).length;
- if (object instanceof Integer)
- return 16;
- if (object instanceof Map)
- return basicSizeof((Map) object);
- if (object instanceof IEclipsePreferences)
- return basicSizeof((IEclipsePreferences) object);
- if (object instanceof QualifiedName) {
- QualifiedName name = (QualifiedName) object;
- return 20 + sizeof(name.getQualifier()) + sizeof(name.getLocalName());
- }
- // unknown -- use deep size
- return 0;
- }
-
- void visitTree() throws BackingStoreException {
- // count the number of nodes in the preferences tree
- reset();
- IPreferenceNodeVisitor visitor = new IPreferenceNodeVisitor() {
- public boolean visit(IEclipsePreferences node) {
- try {
- treeSize += sizeof(node);
- nodeCount++;
- int keys = node.keys().length;
- kvCount += keys;
- if (keys == 0)
- emptyNodes++;
- else
- nonEmptyNodes.add(node.absolutePath() + " (" + keys + ")"); //$NON-NLS-1$//$NON-NLS-2$
- } catch (BackingStoreException e) {
- e.printStackTrace();
- }
- return true;
- }
- };
- rootNode.accept(visitor);
- }
-
- void updateTextView() {
- final StringBuffer buffer = new StringBuffer();
- buffer.append("Size of Eclipse 2.1 preference objects: " + prettyPrint(calculateOldSize()) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- buffer.append("Total node count: " + prettyPrint(nodeCount) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- buffer.append("Nodes without keys: " + prettyPrint(emptyNodes) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- buffer.append("Key/value pairs: " + prettyPrint(kvCount) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- buffer.append("Total size of tree: " + prettyPrint(treeSize) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- buffer.append("Nodes with key/value pairs:\n"); //$NON-NLS-1$
- for (Iterator i = nonEmptyNodes.iterator(); i.hasNext();)
- buffer.append("\t" + i.next() + "\n"); //$NON-NLS-1$//$NON-NLS-2$
-
- //post changes to UI thread
- viewer.getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (!viewer.getControl().isDisposed()) {
- IDocument doc = viewer.getDocument();
- doc.set(buffer.toString());
- viewer.setDocument(doc);
- }
- }
- });
- }
-
- private String prettyPrint(int i) {
- StringBuffer buf = new StringBuffer();
- for (;;) {
- if (i < 1000) {
- String val = Integer.toString(i);
- //pad with zeros if necessary
- if (buf.length() > 0) {
- if (val.length() < 2)
- buf.append('0');
- if (val.length() < 3)
- buf.append('0');
- }
- buf.append(val);
- return buf.toString();
- }
- if (i < 1000000) {
- String val = Integer.toString(i / 1000);
- //pad with zeros if necessary
- if (buf.length() > 0) {
- if (val.length() < 2)
- buf.append('0');
- if (val.length() < 3)
- buf.append('0');
- }
- buf.append(val);
- buf.append(',');
- i = i % 1000;
- continue;
- }
- buf.append(Integer.toString(i / 1000000));
- buf.append(',');
- i = i % 1000000;
- }
- }
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
-
- viewer = new TextViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.WRAP | SWT.READ_ONLY);
- viewer.setDocument(new Document());
-
- IActionBars bars = getViewSite().getActionBars();
-
- final GlobalAction clearOutputAction = new ClearTextAction(viewer.getDocument());
- clearOutputAction.registerAsGlobalAction(bars);
-
- final GlobalAction selectAllAction = new SelectAllAction(viewer);
- selectAllAction.registerAsGlobalAction(bars);
-
- IMenuManager barMenuManager = getViewSite().getActionBars().getMenuManager();
- updateAction = new UpdateAction();
- barMenuManager.add(updateAction);
-
- // Delete action shortcuts are not captured by the workbench
- // so we need our key binding service to handle Delete keystrokes for us
-
- this.viewer.getControl().addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- if (e.character == SWT.DEL)
- clearOutputAction.run();
- }
- });
-
- GlobalAction copyAction = new CopyTextSelectionAction(viewer);
- copyAction.registerAsGlobalAction(bars);
-
- bars.getToolBarManager().add(updateAction);
- bars.getToolBarManager().add(clearOutputAction);
-
- bars.updateActionBars();
-
- // creates a context menu with actions and adds it to the viewer control
- MenuManager menuMgr = new MenuManager();
- menuMgr.add(copyAction);
- menuMgr.add(clearOutputAction);
- Menu menu = menuMgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
-
- // populate the view with the initial data
- if (updateAction != null)
- updateAction.run();
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- super.dispose();
- updateAction = null;
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/RuntimeSpyPerspective.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/RuntimeSpyPerspective.java
deleted file mode 100644
index 4c04c4b..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/RuntimeSpyPerspective.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPerspectiveFactory;
-
-public class RuntimeSpyPerspective implements IPerspectiveFactory {
-
- public RuntimeSpyPerspective() {
- super();
- }
-
- public void createInitialLayout(IPageLayout layout) {
- layout.setEditorAreaVisible(false);
- layout.addView(ActivePluginsView.VIEW_ID, IPageLayout.LEFT, 0.75f, layout.getEditorArea());
- layout.addView(PluginDataSheetView.VIEW_ID, IPageLayout.RIGHT, 0.75f, ActivePluginsView.VIEW_ID);
- layout.addView(LoadedClassesView.VIEW_ID, IPageLayout.BOTTOM, 0.50f, ActivePluginsView.VIEW_ID);
- layout.addView(StackTraceView.VIEW_ID, IPageLayout.BOTTOM, 0.25f, PluginDataSheetView.VIEW_ID);
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/StackTraceView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/StackTraceView.java
deleted file mode 100644
index b8f1459..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/StackTraceView.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import java.io.*;
-import org.eclipse.core.tools.BaseTextView;
-
-public class StackTraceView extends BaseTextView {
-
- /** The id by which this view is known in the plug-in registry */
- public static final String VIEW_ID = StackTraceView.class.getName();
-
- public StackTraceView() {
- super();
- }
-
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- public void setInput(String stackFileName, long begin, long end) {
- if (begin == -1 || end == -1) {
- viewer.getDocument().set("No stack trace available.\nSee <eclipse install>/plugins/org.eclipse.osgi/.options"); //$NON-NLS-1$
- viewer.refresh();
- return;
- }
-
- try {
- byte[] chars = new byte[0];
- FileInputStream fis = new FileInputStream(stackFileName);
- try {
- fis.skip(begin);
- chars = new byte[(int) (end - begin)];
- fis.read(chars);
- } finally {
- fis.close();
- }
- viewer.getDocument().set(new String(chars));
- viewer.refresh();
- } catch (FileNotFoundException e) {
- // ignore
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/VMClassInfo.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/VMClassInfo.java
deleted file mode 100644
index e6badb0..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/VMClassInfo.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-public class VMClassInfo {
- String name;
- int ramSize = 0;
- int romSize = 0;
- int jitSize = 0;
-
- public VMClassInfo(String name) {
- this.name = name.replace('/', '.');
- }
-
- public int getJitSize() {
- return jitSize;
- }
-
- public String getName() {
- return name;
- }
-
- public int getRAMSize() {
- return ramSize;
- }
-
- public int getROMSize() {
- return romSize;
- }
-
- public void setJITSize(int value) {
- jitSize = value;
- }
-
- public void setRAMSize(int value) {
- ramSize = value;
- }
-
- public void setROMSize(int value) {
- romSize = value;
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/VMClassloaderInfo.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/VMClassloaderInfo.java
deleted file mode 100644
index b8946d3..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/VMClassloaderInfo.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.runtime;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class VMClassloaderInfo {
-
- protected String id;
- protected ClassLoader loader;
- protected VMClassInfo[] classes;
- protected int allocRAM = 0;
- protected int allocROM = 0;
- protected int usedRAM = 0;
- protected int usedROM = 0;
-
- public static boolean hasNatives = false;
- protected static Map loaders = new HashMap(20);
-
- public static VMClassInfo[] getBaseClasses() {
- return new VMClassInfo[0];
- }
-
- public static VMClassloaderInfo getClassloader(String id) {
- return new VMClassloaderInfo(id, null);
- }
-
- public static void refreshInfos() {
- loaders = new HashMap(20);
- }
-
- protected VMClassloaderInfo(String id, ClassLoader loader) {
- this.id = id;
- if (loader != null)
- this.loader = loader;
- }
-
- public int getAllocRAM() {
- return allocRAM;
- }
-
- public int getAllocROM() {
- return allocROM;
- }
-
- public VMClassloaderInfo getClassloader() {
- return this;
- }
-
- public int getCount() {
- return getClasses().length;
- }
-
- public int getFreeRAM() {
- return getAllocRAM() - getUsedRAM();
- }
-
- public int getFreeROM() {
- return getAllocROM() - getUsedROM();
- }
-
- public String getName() {
- return id;
- }
-
- protected int getTotal(long type, int aspect) {
- return 0;
- }
-
- public int getUsedRAM() {
- return usedRAM;
- }
-
- public int getUsedROM() {
- return usedROM;
- }
-
- protected VMClassInfo[] getClasses() {
- if (classes == null)
- initializeClasses();
- return classes;
- }
-
- public VMClassInfo getClass(String name) {
- return new VMClassInfo(name);
- }
-
- public void refresh() {
- allocRAM = 0;
- allocROM = 0;
- usedRAM = 0;
- usedROM = 0;
- classes = null;
- }
-
- public void initializeClasses() {
- return;
- }
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnreferencedFilesAction.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnreferencedFilesAction.java
deleted file mode 100644
index 9914eb3..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnreferencedFilesAction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.search;
-
-import java.util.Iterator;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.search.ui.*;
-import org.eclipse.search.ui.text.AbstractTextSearchResult;
-import org.eclipse.search2.internal.ui.text2.DefaultTextSearchQueryProvider;
-import org.eclipse.ui.*;
-
-public class FindUnreferencedFilesAction implements IObjectActionDelegate {
-
- private IStructuredSelection selection;
-
- public void setActivePart(IAction action, IWorkbenchPart part) {
- //not needed
- }
-
- public void run(IAction action) {
- try {
- for (Iterator it = selection.iterator(); it.hasNext();) {
- IResource resource = (IResource)it.next();
- findReferences(resource);
- }
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
-
- private void findReferences(IResource resource) throws CoreException {
- if (resource instanceof IContainer) {
- IResource[] children = ((IContainer)resource).members();
- for (int i = 0; i < children.length; i++) {
- findReferences(children[i]);
- }
- } else if (resource instanceof IFile) {
- String name = resource.getName();
- IRunnableContext context = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- ISearchQuery query = DefaultTextSearchQueryProvider.getPreferred().createQuery(name);
- NewSearchUI.runQueryInForeground(context, query);
- ISearchResult result = query.getSearchResult();
- if (result instanceof AbstractTextSearchResult) {
- int matches = ((AbstractTextSearchResult)result).getMatchCount();
- if (matches == 0) {
- System.out.println("Orphan file: " + resource.getFullPath());
- }
- }
- }
-
- }
-
- public void selectionChanged(IAction action, ISelection aSelection) {
- if (aSelection instanceof IStructuredSelection)
- this.selection = (IStructuredSelection) aSelection;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedMembers.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedMembers.java
deleted file mode 100644
index 5d257b9..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedMembers.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.search;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.dom.*;
-import org.eclipse.jdt.core.search.*;
-import org.eclipse.jdt.internal.corext.dom.Bindings;
-import org.eclipse.jdt.internal.corext.refactoring.RefactoringScopeFactory;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-
-/*
- * Class that removes field declarations which aren't referenced.
- */
-public class FindUnusedMembers implements IRunnableWithProgress {
-
- public static interface IResultReporter {
- void unusedElementFound(IMember member) throws CoreException;
- }
-
- public static class OutputWriter implements IResultReporter {
-
- private final Writer output;
- private IType lastType;
-
- public OutputWriter(Writer writer) {
- output = writer;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.tools.search.FindUnusedMembers.IResultReporter#unusedElementFound(org.eclipse.jdt.core.IMethod)
- */
- public void unusedElementFound(IMember member) throws CoreException {
- try {
- if (!member.getDeclaringType().equals(lastType)) {
- lastType = member.getDeclaringType();
- writeHeader(lastType);
- }
- if (member instanceof IMethod) {
- writeResult((IMethod) member);
- } else if (member instanceof IField) {
- writeResult((IField) member);
- }
- } catch (IOException e) {
- // to do
- }
- }
-
- private void writeHeader(IType type) throws IOException {
- output.write("\n\n" + type.getFullyQualifiedName()); //$NON-NLS-1$
- }
-
- private void writeResult(IField field) throws IOException, JavaModelException {
- output.write("\n\t"); //$NON-NLS-1$
- output.write(Signature.toString(field.getTypeSignature()));
- output.write(" "); //$NON-NLS-1$
- output.write(field.getElementName());
- }
-
- private void writeResult(IMethod method) throws IOException, JavaModelException {
- output.write("\n\t");//$NON-NLS-1$
- output.write(Signature.toString(method.getReturnType()));
- output.write(" "); //$NON-NLS-1$
- output.write(method.getElementName());
- output.write("("); //$NON-NLS-1$
- String[] types = method.getParameterTypes();
- for (int i = 0; i < types.length; i++) {
- output.write(Signature.toString(types[i]));
- if (i < types.length - 1)
- output.write(","); //$NON-NLS-1$
- }
- output.write(")"); //$NON-NLS-1$
- }
- }
-
- private final IResultReporter result;
- private ICompilationUnit[] units;
- protected int unusedMemberCount = 0;
-
- public FindUnusedMembers(ICompilationUnit[] units, Writer writer) {
- this(units, new OutputWriter(writer));
- }
-
- public FindUnusedMembers(ICompilationUnit[] units, IResultReporter resultReporter) {
- this.units = units;
- this.result = resultReporter;
- }
-
- private void doSearchCU(ICompilationUnit cu, IProgressMonitor monitor) throws CoreException {
- IType[] allTypes = cu.getAllTypes();
- monitor.beginTask("Processing " + cu.getElementName(), allTypes.length + 1); //$NON-NLS-1$
- try {
-
- ASTParser astParser = ASTParser.newParser(AST.JLS3);
- astParser.setResolveBindings(true);
- astParser.setProject(cu.getJavaProject());
-
- IBinding[] bindings = astParser.createBindings(allTypes, new NullProgressMonitor());
- for (int i = 0; i < bindings.length; i++) {
- if (monitor.isCanceled())
- throw new OperationCanceledException();
- ITypeBinding typeBinding = (ITypeBinding) bindings[i];
- monitor.subTask("Processing '" + typeBinding.getQualifiedName() + "'"); //$NON-NLS-1$//$NON-NLS-2$
- doSearchType(typeBinding, new NullProgressMonitor());
- }
- } finally {
- monitor.done();
- }
- }
-
- private boolean methodOverrides(IMethodBinding binding) {
- return Bindings.findOverriddenMethod(binding, true) != null;
- }
-
- public void doSearchType(ITypeBinding typeBinding, IProgressMonitor monitor) throws CoreException {
- IMethodBinding[] methods = typeBinding.getDeclaredMethods();
- IVariableBinding[] fields = typeBinding.getDeclaredFields();
-
- monitor.beginTask("Searching for references.", methods.length + fields.length); //$NON-NLS-1$
-
- try {
- for (int i = 0; i < methods.length; i++) {
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-
- IMethodBinding methodBinding = methods[i];
- if (methodOverrides(methodBinding))
- continue;
-
- IMethod method = (IMethod) methodBinding.getJavaElement();
- if (method == null)
- continue;
-
- if (hasReferences(method, new SubProgressMonitor(monitor, 1)))
- continue;
- result.unusedElementFound(method);
- unusedMemberCount++;
- }
- for (int i = 0; i < fields.length; i++) {
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-
- IVariableBinding fieldBinding = fields[i];
- IField field = (IField) fieldBinding.getJavaElement();
- if (field == null)
- continue;
- if (hasReferences(field, new SubProgressMonitor(monitor, 1)))
- continue;
- result.unusedElementFound(field);
- unusedMemberCount++;
- }
-
- if (monitor.isCanceled())
- throw new OperationCanceledException();
- } finally {
- monitor.done();
- }
- }
-
- public int getUnusedMethodCount() {
- return unusedMemberCount;
- }
-
- private boolean hasReferences(IMember member, IProgressMonitor monitor) throws JavaModelException {
-
- final class ReferenceFound extends Error {
- private static final long serialVersionUID = 1L;
- }
-
- try {
- IJavaSearchScope searchScope = RefactoringScopeFactory.create(member.getDeclaringType());
- SearchPattern pattern = SearchPattern.createPattern(member, IJavaSearchConstants.REFERENCES);
- SearchRequestor requestor = new SearchRequestor() {
- public void acceptSearchMatch(SearchMatch match) throws CoreException {
- if (match.getAccuracy() == SearchMatch.A_ACCURATE) {
- throw new ReferenceFound();
- }
- }
- };
- new SearchEngine().search(pattern, new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()}, searchScope, requestor, monitor);
- } catch (CoreException e) {
- throw new JavaModelException(e);
- } catch (ReferenceFound e) {
- return true;
- }
- return false;
- }
-
- public void process(IProgressMonitor monitor) throws CoreException {
- if (monitor == null)
- monitor = new NullProgressMonitor();
- try {
- monitor.beginTask("Searching unused members", this.units.length); //$NON-NLS-1$
- for (int i = 0; i < this.units.length; i++) {
- doSearchCU(units[i], new SubProgressMonitor(monitor, 1));
- }
- } finally {
- monitor.done();
- }
- }
-
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- process(monitor);
- } catch (OperationCanceledException e) {
- throw new InterruptedException();
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedMembersAction.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedMembersAction.java
deleted file mode 100644
index f6458db..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedMembersAction.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.search;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.util.*;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.ui.*;
-
-public class FindUnusedMembersAction implements IObjectActionDelegate {
-
- /**
- * This flag controls how the search results are presented. If <code>true</code>,
- * the results are shown in the search view. If <code>false</code>, the
- * results are written to a file.
- */
- private static final boolean SHOW_RESULTS_IN_SEARCH_VIEW = true;
- private IStructuredSelection selection;
- private IWorkbenchPart part;
-
- public void setActivePart(IAction action, IWorkbenchPart part) {
- this.part = part;
- //not needed
- }
-
- public void run(IAction action) {
- ArrayList allCus = new ArrayList();
- try {
- for (Iterator it = selection.iterator(); it.hasNext();) {
- Object element = it.next();
- if (element instanceof IJavaElement)
- collectCompilationUnits((IJavaElement) element, allCus);
- }
- } catch (JavaModelException e) {
- ErrorDialog.openError(part.getSite().getShell(), "Find Unused Members", "Problem collecting compilation units", e.getStatus()); //$NON-NLS-1$//$NON-NLS-2$
- return;
- }
-
- if (allCus.isEmpty()) {
- MessageDialog.openInformation(part.getSite().getShell(), "Find Unused Members", "No compilation units in 'internal' packages selected"); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
-
- ICompilationUnit[] cus = (ICompilationUnit[]) allCus.toArray(new ICompilationUnit[allCus.size()]);
-
- if (SHOW_RESULTS_IN_SEARCH_VIEW) {
- NewSearchUI.runQueryInBackground(new FindUnusedSearchQuery(cus));
- return;
- }
-
- //prompt the user for a file to write search results to
- FileDialog dialog = new FileDialog(part.getSite().getShell(), SWT.SAVE);
- String outFileName = dialog.open();
- if (outFileName == null)
- return;
- File outputFile = new File(outFileName);
- if (outputFile.exists())
- outputFile.delete();
-
- FileWriter writer = null;
- try {
- int unusedCount = 0;
- try {
- writer = new FileWriter(outputFile);
- FindUnusedMembers search = new FindUnusedMembers(cus, writer);
- PlatformUI.getWorkbench().getProgressService().run(true, true, search);
- unusedCount = search.getUnusedMethodCount();
- } finally {
- String summary = "Search complete. Found " + unusedCount + " unreferenced methods."; //$NON-NLS-1$ //$NON-NLS-2$
- if (writer != null) {
- writer.write("\n\n"); //$NON-NLS-1$
- writer.write(summary);
- writer.close();
- }
- MessageDialog.openInformation(part.getSite().getShell(), "Search Complete", summary); //$NON-NLS-1$
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void collectCompilationUnits(IJavaElement current, Collection res) throws JavaModelException {
- if (current instanceof IJavaProject || current instanceof IPackageFragmentRoot) {
- IJavaElement[] children = ((IParent) current).getChildren();
- for (int i = 0; i < children.length; i++) {
- collectCompilationUnits(children[i], res);
- }
- } else if (current instanceof IPackageFragment) {
- //uncomment this condition to only search API packages
-// if (current.getElementName().indexOf("internal") > 0) { //$NON-NLS-1$
- IJavaElement[] children = ((IParent) current).getChildren();
- for (int i = 0; i < children.length; i++) {
- collectCompilationUnits(children[i], res);
- }
-// }
- } else if (current instanceof ICompilationUnit)
- res.add(current);
- }
-
- public void selectionChanged(IAction action, ISelection aSelection) {
- if (aSelection instanceof IStructuredSelection)
- this.selection = (IStructuredSelection) aSelection;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedSearchQuery.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedSearchQuery.java
deleted file mode 100644
index 168155a..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedSearchQuery.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.core.tools.search;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.ISearchResult;
-
-/**
- *
- */
-public class FindUnusedSearchQuery implements ISearchQuery {
-
- private final ICompilationUnit[] fCus;
- private FindUnusedSearchResult fSearchResult;
-
- public FindUnusedSearchQuery(ICompilationUnit[] cus) {
- fCus = cus;
- fSearchResult = new FindUnusedSearchResult(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.search.ui.ISearchQuery#canRerun()
- */
- public boolean canRerun() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.search.ui.ISearchQuery#canRunInBackground()
- */
- public boolean canRunInBackground() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.search.ui.ISearchQuery#getLabel()
- */
- public String getLabel() {
- return "Find Unreferenced Members"; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.search.ui.ISearchQuery#getSearchResult()
- */
- public ISearchResult getSearchResult() {
- return fSearchResult;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.search.ui.ISearchQuery#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public IStatus run(IProgressMonitor monitor) throws OperationCanceledException {
- fSearchResult.removeAll();
-
- FindUnusedMembers search = new FindUnusedMembers(fCus, fSearchResult);
- try {
- search.process(monitor);
- } catch (CoreException e) {
- return e.getStatus();
- }
- return Status.OK_STATUS;
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedSearchResult.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedSearchResult.java
deleted file mode 100644
index 341c026..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedSearchResult.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.core.tools.search;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.tools.search.FindUnusedMembers.IResultReporter;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.ISourceRange;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.text.*;
-
-/**
- *
- */
-public class FindUnusedSearchResult extends AbstractTextSearchResult implements IResultReporter {
-
- private final FindUnusedSearchQuery fQuery;
-
- public FindUnusedSearchResult(FindUnusedSearchQuery query) {
- fQuery = query;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.search.ui.text.AbstractTextSearchResult#getEditorMatchAdapter()
- */
- public IEditorMatchAdapter getEditorMatchAdapter() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.search.ui.text.AbstractTextSearchResult#getFileMatchAdapter()
- */
- public IFileMatchAdapter getFileMatchAdapter() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.search.ui.ISearchResult#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.search.ui.ISearchResult#getLabel()
- */
- public String getLabel() {
- if (getMatchCount() == 1)
- return "1 unused element found"; //$NON-NLS-1$
- return getMatchCount() + " unused elements found"; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.search.ui.ISearchResult#getQuery()
- */
- public ISearchQuery getQuery() {
- return fQuery;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.search.ui.ISearchResult#getTooltip()
- */
- public String getTooltip() {
- return getLabel();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.tools.search.FindUnusedMembers.IResultReporter#unusedElementFound(org.eclipse.jdt.core.IMember)
- */
- public void unusedElementFound(IMember member) throws CoreException {
- ISourceRange nameRange = member.getNameRange();
- addMatch(new Match(member, nameRange.getOffset(), nameRange.getLength()));
- }
-
-}
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedSearchResultPage.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedSearchResultPage.java
deleted file mode 100644
index 3ac582f..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedSearchResultPage.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.search;
-
-import java.text.Collator;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.ui.JavaElementLabelProvider;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.search.ui.IContextMenuConstants;
-import org.eclipse.search.ui.ISearchResultPage;
-import org.eclipse.search.ui.text.*;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.IShowInTargetList;
-
-/**
- *
- */
-public class FindUnusedSearchResultPage extends AbstractTextSearchViewPage implements ISearchResultPage, IAdaptable {
-
- public class DecoratorIgnoringViewerSorter extends ViewerSorter {
-
- private Collator collator;
-
- public DecoratorIgnoringViewerSorter() {
- super(null); // lazy initialization
- collator = null;
- }
-
- public int compare(Viewer aViewer, Object e1, Object e2) {
- String name1 = labelProvider.getText(e1);
- String name2 = labelProvider.getText(e2);
- if (name1 == null)
- name1 = "";//$NON-NLS-1$
- if (name2 == null)
- name2 = "";//$NON-NLS-1$
- return getCollator().compare(name1, name2);
- }
-
- public final Collator getCollator() {
- if (collator == null) {
- collator = Collator.getInstance();
- }
- return collator;
- }
- }
-
- class SortAction extends Action {
- int order;
- SortAction(String label, int order) {
- super(label);
- this.order = order;
- }
-
- public void run() {
- setSortOrder(order);
- }
- }
-
- public static class TableContentProvider implements IStructuredContentProvider {
- private AbstractTextSearchResult fSearchResult;
- private TableViewer fTableViewer;
-
- public void clear() {
- fTableViewer.refresh();
- }
-
- public void dispose() {
- //nothing to dispose
- }
-
- public void elementsChanged(Object[] updatedElements) {
- int addCount = 0;
- int removeCount = 0;
- for (int i = 0; i < updatedElements.length; i++) {
- if (fSearchResult.getMatchCount(updatedElements[i]) > 0) {
- if (fTableViewer.testFindItem(updatedElements[i]) != null)
- fTableViewer.refresh(updatedElements[i]);
- else
- fTableViewer.add(updatedElements[i]);
- addCount++;
- } else {
- fTableViewer.remove(updatedElements[i]);
- removeCount++;
- }
- }
- }
-
- public Object[] getElements(Object inputElement) {
- if (fSearchResult != null)
- return fSearchResult.getElements();
- return new Object[0];
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- fTableViewer = (TableViewer) viewer;
- fSearchResult = (AbstractTextSearchResult) newInput;
- }
- }
-
- public static final IShowInTargetList SHOW_IN_TARGET_LIST = new IShowInTargetList() {
- public String[] getShowInTargetIds() {
- return SHOW_IN_TARGETS;
- }
- };
-
- static final String[] SHOW_IN_TARGETS = new String[] {JavaUI.ID_PACKAGES, IPageLayout.ID_RES_NAV};
-
- private static final int SORT_BY_NAME = 0;
- private static final int SORT_BY_PATH = 1;
-
- TableContentProvider contentProvider;
- JavaElementLabelProvider labelProvider;
- Action sortByName = new SortAction("Name", SORT_BY_NAME);
- Action sortByPath = new SortAction("Path", SORT_BY_PATH);
- TableViewer viewer;
-
- private int currentSortOrder = -1;
-
- public FindUnusedSearchResultPage() {
- super(AbstractTextSearchViewPage.FLAG_LAYOUT_FLAT);
- }
-
- /*
- * @see org.eclipse.search.ui.text.AbstractTextSearchViewPage#clear()
- */
- protected void clear() {
- if (contentProvider != null)
- contentProvider.clear();
- }
-
- /*
- * @see org.eclipse.search.ui.text.AbstractTextSearchViewPage#configureTableViewer(org.eclipse.jface.viewers.TableViewer)
- */
- protected void configureTableViewer(TableViewer aViewer) {
- this.viewer = aViewer;
- contentProvider = new TableContentProvider();
- aViewer.setContentProvider(contentProvider);
- setSortOrder(SORT_BY_PATH);
- aViewer.setSorter(new DecoratorIgnoringViewerSorter());
- }
-
- /*
- * @see org.eclipse.search.ui.text.AbstractTextSearchViewPage#configureTreeViewer(org.eclipse.jface.viewers.TreeViewer)
- */
- protected void configureTreeViewer(TreeViewer aViewer) {
- throw new IllegalStateException("Doesn't support tree mode.");
- }
-
- /*
- * @see org.eclipse.search.ui.text.AbstractTextSearchViewPage#elementsChanged(java.lang.Object[])
- */
- protected void elementsChanged(Object[] objects) {
- if (contentProvider != null)
- contentProvider.elementsChanged(objects);
- }
-
- protected void fillContextMenu(IMenuManager mgr) {
- super.fillContextMenu(mgr);
- MenuManager sortMenu = new MenuManager("Sort By");
- sortMenu.add(sortByName);
- sortMenu.add(sortByPath);
- sortByName.setChecked(currentSortOrder == SORT_BY_NAME);
- sortByPath.setChecked(currentSortOrder == SORT_BY_PATH);
- mgr.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, sortMenu);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (IShowInTargetList.class.equals(adapter)) {
- return SHOW_IN_TARGET_LIST;
- }
- return null;
- }
-
- void setSortOrder(int order) {
- if (currentSortOrder == order)
- return;
- currentSortOrder = order;
- int flags;
- if (order == SORT_BY_NAME) {
- flags = JavaElementLabelProvider.SHOW_POST_QUALIFIED;
- } else {
- flags = JavaElementLabelProvider.SHOW_QUALIFIED;
- }
- flags |= JavaElementLabelProvider.SHOW_PARAMETERS;
- labelProvider = new JavaElementLabelProvider(flags);
- viewer.setLabelProvider(labelProvider);
- }
-
- protected void showMatch(Match match, int currentOffset, int currentLength, boolean activate) throws PartInitException {
- try {
- Object element = match.getElement();
- if (element instanceof IJavaElement) {
- JavaUI.openInEditor((IJavaElement) element);
- }
- } catch (JavaModelException e1) {
- throw new PartInitException(e1.getStatus());
- }
- }
-
-}
diff --git a/features/org.eclipse.core.tools-feature/.project b/features/org.eclipse.core.tools-feature/.project
deleted file mode 100644
index 9cdfafd..0000000
--- a/features/org.eclipse.core.tools-feature/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.tools-feature</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/features/org.eclipse.core.tools-feature/build.properties b/features/org.eclipse.core.tools-feature/build.properties
deleted file mode 100644
index dee3413..0000000
--- a/features/org.eclipse.core.tools-feature/build.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# Copyright (c) 2004, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = feature.xml, license.html, feature.properties, epl-v10.html, *.jpg
-qualifier=context
\ No newline at end of file
diff --git a/features/org.eclipse.core.tools-feature/cpl-v10.html b/features/org.eclipse.core.tools-feature/cpl-v10.html
deleted file mode 100644
index 36aa208..0000000
--- a/features/org.eclipse.core.tools-feature/cpl-v10.html
+++ /dev/null
@@ -1,125 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-<HEAD>
-<TITLE>Common Public License - v 1.0</TITLE>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</HEAD>
-
-<BODY BGCOLOR="#FFFFFF" VLINK="#800000">
-
-
-<P ALIGN="CENTER"><B>Common Public License - v 1.0</B>
-<P><B></B><FONT SIZE="3"></FONT>
-<P><FONT SIZE="3"></FONT><FONT SIZE="2">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.</FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"><B>1. DEFINITIONS</B></FONT>
-<P><FONT SIZE="2">"Contribution" means:</FONT>
-
-<UL><FONT SIZE="2">a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and<BR CLEAR="LEFT">
-b) in the case of each subsequent Contributor:</FONT></UL>
-
-
-<UL><FONT SIZE="2">i) changes to the Program, and</FONT></UL>
-
-
-<UL><FONT SIZE="2">ii) additions to the Program;</FONT></UL>
-
-
-<UL><FONT SIZE="2">where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. </FONT><FONT SIZE="2">A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. </FONT><FONT SIZE="2">Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. </FONT></UL>
-
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">"Contributor" means any person or entity that distributes the Program.</FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. </FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2">"Program" means the Contributions distributed in accordance with this Agreement.</FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.</FONT>
-<P><FONT SIZE="2"><B></B></FONT>
-<P><FONT SIZE="2"><B>2. GRANT OF RIGHTS</B></FONT>
-
-<UL><FONT SIZE="2"></FONT><FONT SIZE="2">a) </FONT><FONT SIZE="2">Subject to the terms of this Agreement, each Contributor hereby grants</FONT><FONT SIZE="2"> Recipient a non-exclusive, worldwide, royalty-free copyright license to</FONT><FONT SIZE="2" COLOR="#FF0000"> </FONT><FONT SIZE="2">reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.</FONT></UL>
-
-
-<UL><FONT SIZE="2"></FONT></UL>
-
-
-<UL><FONT SIZE="2"></FONT><FONT SIZE="2">b) Subject to the terms of this Agreement, each Contributor hereby grants </FONT><FONT SIZE="2">Recipient a non-exclusive, worldwide,</FONT><FONT SIZE="2" COLOR="#008000"> </FONT><FONT SIZE="2">royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. </FONT></UL>
-
-
-<UL><FONT SIZE="2"></FONT></UL>
-
-
-<UL><FONT SIZE="2">c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.</FONT></UL>
-
-
-<UL><FONT SIZE="2"></FONT></UL>
-
-
-<UL><FONT SIZE="2">d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. </FONT></UL>
-
-
-<UL><FONT SIZE="2"></FONT></UL>
-
-<P><FONT SIZE="2"><B>3. REQUIREMENTS</B></FONT>
-<P><FONT SIZE="2"><B></B>A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:</FONT>
-
-<UL><FONT SIZE="2">a) it complies with the terms and conditions of this Agreement; and</FONT></UL>
-
-
-<UL><FONT SIZE="2">b) its license agreement:</FONT></UL>
-
-
-<UL><FONT SIZE="2">i) effectively disclaims</FONT><FONT SIZE="2"> on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; </FONT></UL>
-
-
-<UL><FONT SIZE="2">ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; </FONT></UL>
-
-
-<UL><FONT SIZE="2">iii)</FONT><FONT SIZE="2"> states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and</FONT></UL>
-
-
-<UL><FONT SIZE="2">iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.</FONT><FONT SIZE="2" COLOR="#0000FF"> </FONT><FONT SIZE="2" COLOR="#FF0000"></FONT></UL>
-
-
-<UL><FONT SIZE="2" COLOR="#FF0000"></FONT><FONT SIZE="2"></FONT></UL>
-
-<P><FONT SIZE="2">When the Program is made available in source code form:</FONT>
-
-<UL><FONT SIZE="2">a) it must be made available under this Agreement; and </FONT></UL>
-
-
-<UL><FONT SIZE="2">b) a copy of this Agreement must be included with each copy of the Program. </FONT></UL>
-
-<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT>
-<P><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT><FONT SIZE="2">Contributors may not remove or alter any copyright notices contained within the Program. </FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. </FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"><B>4. COMMERCIAL DISTRIBUTION</B></FONT>
-<P><FONT SIZE="2">Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.</FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.</FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"></FONT>
-<P><FONT SIZE="2" COLOR="#0000FF"></FONT><FONT SIZE="2"><B>5. NO WARRANTY</B></FONT>
-<P><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is</FONT><FONT SIZE="2"> solely responsible for determining the appropriateness of using and distributing </FONT><FONT SIZE="2">the Program</FONT><FONT SIZE="2"> and assumes all risks associated with its exercise of rights under this Agreement</FONT><FONT SIZE="2">, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, </FONT><FONT SIZE="2">programs or equipment, and unavailability or interruption of operations</FONT><FONT SIZE="2">. </FONT><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2"><B>6. DISCLAIMER OF LIABILITY</B></FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES </FONT><FONT SIZE="2">(INCLUDING WITHOUT LIMITATION LOST PROFITS),</FONT><FONT SIZE="2"> HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"><B>7. GENERAL</B></FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2">If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.</FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. </FONT><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. </FONT><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2">Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to </FONT><FONT SIZE="2">publish new versions (including revisions) of this Agreement from time to </FONT><FONT SIZE="2">time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. </FONT><FONT SIZE="2">Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new </FONT><FONT SIZE="2">version. </FONT><FONT SIZE="2">Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, </FONT><FONT SIZE="2">by implication, estoppel or otherwise</FONT><FONT SIZE="2">.</FONT><FONT SIZE="2"> All rights in the Program not expressly granted under this Agreement are reserved.</FONT>
-<P><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2">This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.</FONT>
-<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
-<P><FONT SIZE="2"></FONT>
-
-</BODY>
-
-</HTML>
\ No newline at end of file
diff --git a/features/org.eclipse.core.tools-feature/eclipse_update_120.jpg b/features/org.eclipse.core.tools-feature/eclipse_update_120.jpg
deleted file mode 100644
index 68e3e02..0000000
--- a/features/org.eclipse.core.tools-feature/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/features/org.eclipse.core.tools-feature/feature.properties b/features/org.eclipse.core.tools-feature/feature.properties
deleted file mode 100644
index 7939ce5..0000000
--- a/features/org.eclipse.core.tools-feature/feature.properties
+++ /dev/null
@@ -1,123 +0,0 @@
-###############################################################################
-# Copyright (c) 2004, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-# feature.properties
-# contains externalized strings for feature.xml
-# "%foo" in feature.xml corresponds to the key "foo" in this file
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file should be translated.
-
-# "featureName" property - name of the feature
-featureName=Eclipse Core Tools
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse.org
-
-# "updateSiteName" property - label for the update site
-updateSiteName=Platform/Core Team Update Site
-
-# "description" property - description of the feature
-description=Tools for plug-in developers by plug-in developers
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-ECLIPSE.ORG SOFTWARE USER AGREEMENT\n\
-14th August, 2003\n\
-\n\
-Usage Of Content\n\
-\n\
-ECLIPSE.ORG MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by Eclipse.org\n\
-is provided to you under the terms and conditions of the Common Public\n\
-License Version 1.0 ("CPL"). A copy of the CPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/cpl-v10.html.\n\
-For purposes of the CPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
-Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments\n\
-("Fragments"), and features ("Features"). A Feature is a bundle of one or\n\
-more Plug-ins and/or Fragments and associated material. Files named\n\
-"feature.xml" may contain a list of the names and version numbers of the\n\
-Plug-ins and/or Fragments associated with a Feature. Plug-ins and Fragments\n\
-are located in directories named "plugins" and Features are located in\n\
-directories named "features".\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Subdirectories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by Eclipse.org is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE CPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact Eclipse.org to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n
-########### end of license property ##########################################
diff --git a/features/org.eclipse.core.tools-feature/feature.xml b/features/org.eclipse.core.tools-feature/feature.xml
deleted file mode 100644
index 04dcf82..0000000
--- a/features/org.eclipse.core.tools-feature/feature.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.core.tools"
- label="%featureName"
- version="1.4.0.qualifier"
- provider-name="%providerName"
- image="eclipse_update_120.jpg">
-
- <description>
- %description
- </description>
-
- <license url="%licenseURL">
- %license
- </license>
-
- <url>
- <update label="%updateSiteName" url="http://eclipse.org/eclipse/platform-core/updates"/>
- </url>
-
- <plugin
- id="org.eclipse.core.tools"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.core.tools.resources"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.core.resources.spysupport"
- download-size="0"
- install-size="0"
- version="0.0.0"
- fragment="true"
- unpack="false"/>
-
-</feature>
diff --git a/features/org.eclipse.core.tools-feature/license.html b/features/org.eclipse.core.tools-feature/license.html
deleted file mode 100644
index af8c380..0000000
--- a/features/org.eclipse.core.tools-feature/license.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<title>Eclipse.org Software User Agreement</title>
-</head>
-
-<body lang="EN-US" link=blue vlink=purple>
-<h2>Eclipse.org Software User Agreement</h2>
-<p>14th August, 2003</p>
-
-<h3>Usage Of Content</h3>
-
-<p>ECLIPSE.ORG MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
- (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
- CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
- OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
- NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
- CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
-
-<h3>Applicable Licenses</h3>
-
-<p>Unless otherwise indicated, all Content made available by Eclipse.org is provided to you under the terms and conditions of the Common Public License Version 1.0
- ("CPL"). A copy of the CPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
- For purposes of the CPL, "Program" will mean the Content.</p>
-
-<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS
- modules ("Modules") and made available as downloadable archives ("Downloads").</p>
-
-<p>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features"). A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins and/or Fragments associated with a Feature. Plug-ins and Fragments are located in directories
- named "plugins" and Features are located in directories named "features".</p>
-
-<p>Features may also include other Features ("Included Features"). Files named "feature.xml" may contain a list of the names and version numbers of Included Features.</p>
-
-<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
-Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
-including, but not limited to the following locations:</p>
-
-<ul>
- <li>The top-level (root) directory</li>
- <li>Plug-in and Fragment directories</li>
- <li>Subdirectories of the directory named "src" of certain Plug-ins</li>
- <li>Feature directories</li>
-</ul>
-
-<p>Note: if a Feature made available by Eclipse.org is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the
-installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
-inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties".
-Such Abouts, Feature Licenses and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
-that directory.</p>
-
-<p>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE CPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
-
-<ul>
- <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
- <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
- <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
- <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
-</ul>
-
-<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is provided, please
-contact Eclipse.org to determine what terms and conditions govern that particular Content.</p>
-
-<h3>Cryptography</h3>
-
-<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
- another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
- possession, or use, and re-export of encryption software, to see if this is permitted.</p>
-</body>
-</html>
\ No newline at end of file
diff --git a/tests/org.eclipse.core.expressions.tests/.classpath b/tests/org.eclipse.core.expressions.tests/.classpath
deleted file mode 100644
index ce73933..0000000
--- a/tests/org.eclipse.core.expressions.tests/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/tests/org.eclipse.core.expressions.tests/.cvsignore b/tests/org.eclipse.core.expressions.tests/.cvsignore
deleted file mode 100644
index fe99505..0000000
--- a/tests/org.eclipse.core.expressions.tests/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-bin
-
diff --git a/tests/org.eclipse.core.expressions.tests/.project b/tests/org.eclipse.core.expressions.tests/.project
deleted file mode 100644
index 17924fb..0000000
--- a/tests/org.eclipse.core.expressions.tests/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.expressions.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/tests/org.eclipse.core.expressions.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.core.expressions.tests/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 8a093dd..0000000
--- a/tests/org.eclipse.core.expressions.tests/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,66 +0,0 @@
-#Tue Apr 18 15:48:16 CEST 2006
-eclipse.preferences.version=1
-org.eclipse.jdt.core.builder.cleanOutputFolder=clean
-org.eclipse.jdt.core.builder.duplicateResourceTask=warning
-org.eclipse.jdt.core.builder.invalidClasspath=abort
-org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
-org.eclipse.jdt.core.circularClasspath=error
-org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
-org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.3
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.source=1.3
-org.eclipse.jdt.core.incompatibleJDKLevel=ignore
-org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/tests/org.eclipse.core.expressions.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/org.eclipse.core.expressions.tests/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index cab6fa8..0000000
--- a/tests/org.eclipse.core.expressions.tests/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,6 +0,0 @@
-#Tue Apr 18 15:48:17 CEST 2006
-eclipse.preferences.version=1
-internal.default.compliance=user
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=java;javax;junit;org.eclipse.core.runtime;org.eclipse.core.expressions;org.eclipse.core.internal.expressions;org.eclipse.core.internal.expressions.tests;
-org.eclipse.jdt.ui.ondemandthreshold=99
diff --git a/tests/org.eclipse.core.expressions.tests/.settings/org.eclipse.pde.prefs b/tests/org.eclipse.core.expressions.tests/.settings/org.eclipse.pde.prefs
deleted file mode 100644
index eab969f..0000000
--- a/tests/org.eclipse.core.expressions.tests/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,15 +0,0 @@
-#Mon Jan 29 10:51:35 CET 2007
-compilers.incompatible-environment=1
-compilers.p.build=0
-compilers.p.deprecated=1
-compilers.p.missing-packages=0
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=2
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=0
-compilers.p.unknown-element=0
-compilers.p.unknown-resource=0
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.use-project=true
-eclipse.preferences.version=1
diff --git a/tests/org.eclipse.core.expressions.tests/.template b/tests/org.eclipse.core.expressions.tests/.template
deleted file mode 100644
index f3bcd41..0000000
--- a/tests/org.eclipse.core.expressions.tests/.template
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<form>
- <p/><p><b>Tips on working with this plug-in project</b></p><li>For the view of the new plug-in at a glance, go to the <img href="pageImage"/><a href="OverviewPage">Overview</a>.</li><li>You can test the contributions of this plug-in by launching another instance of the workbench. On the <b>Run</b> menu, click <b>Run As</b> and choose <img href="runTimeWorkbenchImage"/><a href="action.run">Run-time Workbench</a> from the available choices.</li><li>You can add more functionality to this plug-in by adding extensions using the <a href="action.newExtension">New Extension Wizard</a>.</li><li>The plug-in project contains Java code that you can debug. Place breakpoints in Java classes. On the <b>Run</b> menu, select <b>Debug As</b> and choose <img href="runTimeWorkbenchImage"/><a href="action.debug">Run-time Workbench</a> from the available choices.</li>
-</form>
diff --git a/tests/org.eclipse.core.expressions.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.core.expressions.tests/META-INF/MANIFEST.MF
deleted file mode 100644
index 18365e4..0000000
--- a/tests/org.eclipse.core.expressions.tests/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,17 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.core.expressions.tests; singleton:=true
-Bundle-Version: 3.3.0.qualifier
-Bundle-ClassPath: expressionstests.jar
-Bundle-Activator: org.eclipse.core.internal.expressions.tests.ExpressionTestPlugin
-Bundle-ActivationPolicy: lazy
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Export-Package:
- org.eclipse.core.internal.expressions.tests
-Require-Bundle:
- org.eclipse.core.expressions;bundle-version="[3.3.100,4.0.0)",
- org.eclipse.core.runtime;bundle-version="[3.3.100,4.0.0)",
- org.junit;bundle-version="[3.8.2,3.9.0)"
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/tests/org.eclipse.core.expressions.tests/about.html b/tests/org.eclipse.core.expressions.tests/about.html
deleted file mode 100644
index 4602330..0000000
--- a/tests/org.eclipse.core.expressions.tests/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/tests/org.eclipse.core.expressions.tests/build.properties b/tests/org.eclipse.core.expressions.tests/build.properties
deleted file mode 100644
index 6bc4d37..0000000
--- a/tests/org.eclipse.core.expressions.tests/build.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = plugin.xml,\
- test.xml,\
- about.html,\
- plugin.properties,\
- *.jar,\
- META-INF/
-src.includes = about.html
-source.expressionstests.jar = src/
diff --git a/tests/org.eclipse.core.expressions.tests/plugin.properties b/tests/org.eclipse.core.expressions.tests/plugin.properties
deleted file mode 100644
index 012395d..0000000
--- a/tests/org.eclipse.core.expressions.tests/plugin.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-pluginName= Expression Language Tests
-providerName= Eclipse.org
-
-testParticipant= Test Participant
diff --git a/tests/org.eclipse.core.expressions.tests/plugin.xml b/tests/org.eclipse.core.expressions.tests/plugin.xml
deleted file mode 100644
index 65c9468..0000000
--- a/tests/org.eclipse.core.expressions.tests/plugin.xml
+++ /dev/null
@@ -1,231 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
-
- <extension point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- namespace="org.eclipse.core.internal.expressions.tests"
- properties="simple, overridden, ordering, chainOrdering"
- type="org.eclipse.core.internal.expressions.tests.A"
- class="org.eclipse.core.internal.expressions.tests.A_TypeExtender"
- id="org.eclipse.core.internal.expressions.tests.A_TypeExtender">
- </propertyTester>
- <propertyTester
- namespace="org.eclipse.core.internal.expressions.tests"
- properties="chaining, chainOrdering"
- type="org.eclipse.core.internal.expressions.tests.A"
- class="org.eclipse.core.internal.expressions.tests.A_TypeExtender2"
- id="org.eclipse.core.internal.expressions.tests.A_TypeExtender2">
- </propertyTester>
- <propertyTester
- namespace="org.eclipse.core.internal.expressions.tests"
- properties="overridden"
- type="org.eclipse.core.internal.expressions.tests.B"
- class="org.eclipse.core.internal.expressions.tests.B_TypeExtender"
- id="org.eclipse.core.internal.expressions.tests.B_TypeExtender">
- </propertyTester>
- <propertyTester
- namespace="org.eclipse.core.internal.expressions.tests"
- properties="ordering"
- type="org.eclipse.core.internal.expressions.tests.I"
- class="org.eclipse.core.internal.expressions.tests.I_TypeExtender"
- id="org.eclipse.core.internal.expressions.tests.I_TypeExtender">
- </propertyTester>
-
- <propertyTester
- namespace="org.eclipse.core.internal.expressions.tests2"
- properties="differentNamespace"
- type="org.eclipse.core.internal.expressions.tests.A"
- class="org.eclipse.core.internal.expressions.tests.A_TypeExtender3"
- id="org.eclipse.core.internal.expressions.tests.A_TypeExtender">
- </propertyTester>
- </extension>
-
- <extension point="org.eclipse.core.runtime.adapters">
- <factory
- class="org.eclipse.core.internal.expressions.tests.TestAdapterFactory"
- adaptableType="org.eclipse.core.internal.expressions.tests.Adaptee">
- <adapter type="org.eclipse.core.internal.expressions.tests.Adapter"/>
- </factory>
- <factory
- adaptableType="org.eclipse.core.internal.expressions.tests.ExpressionTests$CollectionWrapper"
- class="org.eclipse.core.internal.expressions.tests.CollectionAdapterFactory">
- <adapter type="org.eclipse.core.expressions.IIterable"/>
- <adapter type="org.eclipse.core.expressions.ICountable"/>
- </factory>
- </extension>
-
- <extension-point id="testParticipants" name="%testParticipant" schema="schema/testParticipants.exsd"/>
-
- <extension point="org.eclipse.core.expressions.tests.testParticipants">
- <testParticipant id="test1">
- <enablement>
- <and>
- <and/>
- <or/>
- <not><count value="1"/></not>
- <instanceof value="org.eclipse.core.expressions.Expression"/>
- <test property="namespace.isDefault"/>
- <systemTest property="isDefault" value="xx"/>
- <equals value= "string"/>
- <count value="1"/>
- <with variable="eclipse"/>
- <resolve variable="eclipse"/>
- <adapt type="org.eclipse.core.expressions.Expression"/>
- <iterate/>
- </and>
- <or>
- <and/>
- <or/>
- <not><count value="1"/></not>
- <instanceof value="org.eclipse.core.expressions.Expression"/>
- <test property="namespace.isDefault"/>
- <systemTest property="isDefault" value="xx"/>
- <equals value= "string"/>
- <count value="1"/>
- <with variable="eclipse"/>
- <resolve variable="eclipse"/>
- <adapt type="org.eclipse.core.expressions.Expression"/>
- <iterate/>
- </or>
- <not><count value="1"/></not>
- <instanceof value="org.eclipse.core.expressions.Expression"/>
- <test property="namespace.isDefault"/>
- <test property="namespace.isDefault" value="default"/>
- <test property="namespace.isDefault" args="'arg1', 'arg2'" value="default"/>
- <test property="namespace.isDefault" forcePluginActivation="true"/>
- <systemTest property="isDefault" value="xx"/>
- <equals value= "string"/>
- <count value="1"/>
- <with variable= "element">
- <and/>
- <or/>
- <not><count value="1"/></not>
- <instanceof value="org.eclipse.core.expressions.Expression"/>
- <test property="namespace.isDefault"/>
- <systemTest property="isDefault" value="xx"/>
- <equals value= "string"/>
- <count value="1"/>
- <with variable="eclipse"/>
- <resolve variable="eclipse"/>
- <adapt type="org.eclipse.core.expressions.Expression"/>
- <iterate/>
- </with>
- <resolve variable="eclipse">
- <and/>
- <or/>
- <not><count value="1"/></not>
- <instanceof value="org.eclipse.core.expressions.Expression"/>
- <test property="namespace.isDefault"/>
- <systemTest property="isDefault" value="xx"/>
- <equals value= "string"/>
- <count value="1"/>
- <with variable="eclipse"/>
- <resolve variable="eclipse"/>
- <adapt type="org.eclipse.core.expressions.Expression"/>
- <iterate/>
- </resolve>
- <resolve variable="eclipse" args="1, true"/>
- <adapt type="org.eclipse.core.expressions.Expression">
- <and/>
- <or/>
- <not><count value="1"/></not>
- <instanceof value="org.eclipse.core.expressions.Expression"/>
- <test property="namespace.isDefault"/>
- <systemTest property="isDefault" value="xx"/>
- <equals value= "string"/>
- <count value="1"/>
- <with variable="eclipse"/>
- <resolve variable="eclipse"/>
- <adapt type="org.eclipse.core.expressions.Expression"/>
- <iterate/>
- </adapt>
- <iterate>
- <and/>
- <or/>
- <not><count value="1"/></not>
- <instanceof value="org.eclipse.core.expressions.Expression"/>
- <test property="namespace.isDefault"/>
- <systemTest property="isDefault" value="xx"/>
- <equals value= "string"/>
- <count value="1"/>
- <with variable="eclipse"/>
- <resolve variable="eclipse"/>
- <adapt type="org.eclipse.core.expressions.Expression"/>
- <iterate/>
- </iterate>
- </enablement>
- </testParticipant>
- </extension>
-
- <extension point="org.eclipse.core.expressions.tests.testParticipants">
- <testParticipant id="test2">
- <enablement>
- <test property="namespace.isDefault" forcePluginActivation="true"/>
- <test property="namespace.isDefault" forcePluginActivation="false"/>
- <test property="namespace.isDefault"/>
- </enablement>
- </testParticipant>
- </extension>
-
- <extension point="org.eclipse.core.expressions.tests.testParticipants">
- <testParticipant id="test3">
- <enablement>
- <and>
- <test property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.core.expressions"/>
- <not>
- <test property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.core.expressions.invalid.bundle.name"/>
- </not>
- <not>
- <test property="org.eclipse.core.runtime.product" value="org.eclipse.core.expressions.invalid.product.name"/>
- </not>
- </and>
- </enablement>
- </testParticipant>
- </extension>
- <extension
- point="org.eclipse.core.expressions.definitions">
- <definition
- id="org.eclipse.core.expressions.tests.activeProblemsView">
- <with
- variable="activePartId">
- <equals
- value="org.eclipse.ui.views.ProblemsView">
- </equals>
- </with>
- </definition>
- <definition
- id="org.eclipse.core.expressions.tests.expressionSelection">
- <iterate ifEmpty="false">
- <instanceof
- value="org.eclipse.core.expressions.Expression">
- </instanceof>
- </iterate>
- </definition>
- </extension>
- <extension
- point="org.eclipse.core.expressions.tests.testParticipants">
- <testParticipant
- id="refTest1">
- <enablement>
- <reference
- definitionId="org.eclipse.core.expressions.tests.activeProblemsView">
- </reference>
- </enablement>
- </testParticipant>
- <testParticipant
- id="refTest2">
- <enablement>
- <and>
- <reference
- definitionId="org.eclipse.core.expressions.tests.activeProblemsView">
- </reference>
- <reference
- definitionId="org.eclipse.core.expressions.tests.expressionSelection">
- </reference>
- </and>
- </enablement>
- </testParticipant>
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.expressions.tests/schema/testParticipants.exsd b/tests/org.eclipse.core.expressions.tests/schema/testParticipants.exsd
deleted file mode 100644
index 4c03369..0000000
--- a/tests/org.eclipse.core.expressions.tests/schema/testParticipants.exsd
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="ore.eclipse.core.expressions">
-<annotation>
- <appInfo>
- <meta.schema plugin="ore.eclipse.core.expressions" id="testParticipants" name="Test Participants"/>
- </appInfo>
- <documentation>
- This extension point is used to test the expression language.
- </documentation>
- </annotation>
-
- <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="testParticipant" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="testParticipant">
- <complexType>
- <all>
- <element ref="enablement"/>
- </all>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2001, 2004 IBM Corporation and others.<br>
-All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A.java
deleted file mode 100644
index 979a173..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-
-public class A {
-
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender.java
deleted file mode 100644
index c923803..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import org.eclipse.core.runtime.Assert;
-
-import org.eclipse.core.expressions.PropertyTester;
-
-public class A_TypeExtender extends PropertyTester {
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if ("simple".equals(property)) { //$NON-NLS-1$
- return "simple".equals(expectedValue); //$NON-NLS-1$
- } else if ("overridden".equals(property)) { //$NON-NLS-1$
- return "A".equals(expectedValue); //$NON-NLS-1$
- } else if ("ordering".equals(property)) { //$NON-NLS-1$
- return "A".equals(expectedValue); //$NON-NLS-1$
- } else if ("chainOrdering".equals(property)) { //$NON-NLS-1$
- return "A".equals(expectedValue); //$NON-NLS-1$
- }
- Assert.isTrue(false);
- return false;
- }
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender2.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender2.java
deleted file mode 100644
index 17516b3..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender2.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import org.eclipse.core.runtime.Assert;
-
-import org.eclipse.core.expressions.PropertyTester;
-
-public class A_TypeExtender2 extends PropertyTester {
-
- public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
- if ("chaining".equals(method)) { //$NON-NLS-1$
- return "A2".equals(expectedValue); //$NON-NLS-1$
- } else if ("chainOrdering".equals(method)) { //$NON-NLS-1$
- return "A2".equals(expectedValue); //$NON-NLS-1$
- }
- Assert.isTrue(false);
- return false;
- }
-
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender3.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender3.java
deleted file mode 100644
index 777bec4..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender3.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import org.eclipse.core.runtime.Assert;
-
-import org.eclipse.core.expressions.PropertyTester;
-
-public class A_TypeExtender3 extends PropertyTester {
-
- public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
- if ("differentNamespace".equals(method)) { //$NON-NLS-1$
- return "A3".equals(expectedValue); //$NON-NLS-1$
- }
- Assert.isTrue(false);
- return false;
- }
-
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/Adaptee.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/Adaptee.java
deleted file mode 100644
index ec7ba8f..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/Adaptee.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-
-public class Adaptee {
-
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/Adapter.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/Adapter.java
deleted file mode 100644
index a738566..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/Adapter.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-
-public class Adapter {
-
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/AllTests.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/AllTests.java
deleted file mode 100644
index 09c9d96..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/AllTests.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class AllTests {
-
- public static Test suite() {
- TestSuite suite= new TestSuite("All Expression Language Tests"); //$NON-NLS-1$
- suite.addTest(PropertyTesterTests.suite());
- suite.addTest(ExpressionTests.suite());
- suite.addTest(ExpressionInfoTests.suite());
- return suite;
- }
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/B.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/B.java
deleted file mode 100644
index 78f91f8..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/B.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-
-public class B extends A implements I {
-
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/B_TypeExtender.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/B_TypeExtender.java
deleted file mode 100644
index a1c064c..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/B_TypeExtender.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import org.eclipse.core.runtime.Assert;
-
-import org.eclipse.core.expressions.PropertyTester;
-
-public class B_TypeExtender extends PropertyTester {
-
- public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
- if ("overridden".equals(method)) { //$NON-NLS-1$
- return "B".equals(expectedValue); //$NON-NLS-1$
- }
- Assert.isTrue(false);
- return false;
- }
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/CollectionAdapterFactory.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/CollectionAdapterFactory.java
deleted file mode 100644
index 87df052..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/CollectionAdapterFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-
-import org.eclipse.core.expressions.ICountable;
-import org.eclipse.core.expressions.IIterable;
-
-
-public class CollectionAdapterFactory implements IAdapterFactory {
-
- public Object getAdapter(final Object adaptableObject, Class adapterType) {
- if (adapterType.equals(IIterable.class) && adaptableObject instanceof ExpressionTests.CollectionWrapper) {
- return new IIterable() {
- public Iterator iterator() {
- return ((ExpressionTests.CollectionWrapper)adaptableObject).collection.iterator();
- }
- };
- }
- if (adapterType.equals(ICountable.class) && adaptableObject instanceof ExpressionTests.CollectionWrapper) {
- return new ICountable() {
- public int count() {
- return ((ExpressionTests.CollectionWrapper)adaptableObject).collection.size();
- }
- };
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return new Class[] {Collection.class};
- }
-
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionInfoTests.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionInfoTests.java
deleted file mode 100644
index f40786d..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionInfoTests.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.expressions.ExpressionInfo;
-
-import org.eclipse.core.internal.expressions.AdaptExpression;
-import org.eclipse.core.internal.expressions.AndExpression;
-import org.eclipse.core.internal.expressions.CountExpression;
-import org.eclipse.core.internal.expressions.EqualsExpression;
-import org.eclipse.core.internal.expressions.InstanceofExpression;
-import org.eclipse.core.internal.expressions.IterateExpression;
-import org.eclipse.core.internal.expressions.NotExpression;
-import org.eclipse.core.internal.expressions.ResolveExpression;
-import org.eclipse.core.internal.expressions.SystemTestExpression;
-import org.eclipse.core.internal.expressions.TestExpression;
-import org.eclipse.core.internal.expressions.WithExpression;
-
-
-public class ExpressionInfoTests extends TestCase {
-
- public static Test suite() {
- return new TestSuite(ExpressionInfoTests.class);
- }
-
- // ---- test merging ------------------------------------------------------------------------
-
- public void testMergeEmpty() {
- ExpressionInfo info= new ExpressionInfo();
- info.merge(new ExpressionInfo());
- assertNoAccess(info);
- }
-
- public void testMergeDefaultVariable() {
- ExpressionInfo info;
- ExpressionInfo other;
-
- info= new ExpressionInfo();
- info.markDefaultVariableAccessed();
- info.merge(new ExpressionInfo());
- assertDefaultAccessOnly(info);
-
- info= new ExpressionInfo();
- other= new ExpressionInfo();
- other.markDefaultVariableAccessed();
- info.merge(other);
- assertDefaultAccessOnly(info);
-
- info= new ExpressionInfo();
- other= new ExpressionInfo();
- info.markDefaultVariableAccessed();
- other.markDefaultVariableAccessed();
- info.merge(other);
- assertDefaultAccessOnly(info);
- }
-
- public void testMergeSystemProperty() {
- ExpressionInfo info;
- ExpressionInfo other;
-
- info= new ExpressionInfo();
- info.markSystemPropertyAccessed();
- info.merge(new ExpressionInfo());
- assertSystemPropertyOnly(info);
-
- info= new ExpressionInfo();
- other= new ExpressionInfo();
- other.markSystemPropertyAccessed();
- info.merge(other);
- assertSystemPropertyOnly(info);
-
- info= new ExpressionInfo();
- other= new ExpressionInfo();
- info.markSystemPropertyAccessed();
- other.markSystemPropertyAccessed();
- info.merge(other);
- assertSystemPropertyOnly(info);
- }
-
- public void testMergeVariableNames() {
- ExpressionInfo info;
- ExpressionInfo other;
-
- info= new ExpressionInfo();
- info.addVariableNameAccess("variable");
- info.merge(new ExpressionInfo());
- assertVariableAccess(info, "variable");
-
- info= new ExpressionInfo();
- other= new ExpressionInfo();
- other.addVariableNameAccess("variable");
- info.merge(other);
- assertVariableAccess(info, "variable");
-
- info= new ExpressionInfo();
- info.addVariableNameAccess("variable");
- other= new ExpressionInfo();
- other.addVariableNameAccess("variable");
- info.merge(other);
- assertVariableAccess(info, "variable");
-
- info= new ExpressionInfo();
- info.addVariableNameAccess("variable_one");
- other= new ExpressionInfo();
- other.addVariableNameAccess("variable_two");
- info.merge(other);
- assertVariableAccess(info, new String[] {"variable_one", "variable_two"});
- }
-
- public void testMergePropertyNames() {
- ExpressionInfo info;
- ExpressionInfo other;
-
- info = new ExpressionInfo();
- info.addAccessedPropertyName("property");
- info.merge(new ExpressionInfo());
- assertPropertyAccess(info, "property", false);
-
- info = new ExpressionInfo();
- other = new ExpressionInfo();
- other.addAccessedPropertyName("property");
- info.merge(other);
- assertPropertyAccess(info, "property", false);
-
- info = new ExpressionInfo();
- other = new ExpressionInfo();
- info.addAccessedPropertyName("property");
- other.addAccessedPropertyName("property");
- info.merge(other);
- assertPropertyAccess(info, "property", false);
-
- info = new ExpressionInfo();
- other = new ExpressionInfo();
- info.addAccessedPropertyName("prop1");
- other.addAccessedPropertyName("prop2");
- info.merge(other);
- assertPropertyAccess(info, new String[] { "prop1", "prop2" }, false);
- }
-
- public void testMergeMisbehavingExpressionTypes() {
- ExpressionInfo info;
- ExpressionInfo other;
-
- info= new ExpressionInfo();
- info.addMisBehavingExpressionType(WithExpression.class);
- info.merge(new ExpressionInfo());
- assertMisbehavedExpressionTypes(info, new Class[] {WithExpression.class});
-
- info= new ExpressionInfo();
- other= new ExpressionInfo();
- other.addMisBehavingExpressionType(WithExpression.class);
- info.merge(other);
- assertMisbehavedExpressionTypes(info, new Class[] {WithExpression.class});
-
- info= new ExpressionInfo();
- info.addMisBehavingExpressionType(WithExpression.class);
- other= new ExpressionInfo();
- other.addMisBehavingExpressionType(WithExpression.class);
- info.merge(other);
- assertMisbehavedExpressionTypes(info, new Class[] {WithExpression.class});
-
- info= new ExpressionInfo();
- info.addMisBehavingExpressionType(WithExpression.class);
- other= new ExpressionInfo();
- other.addMisBehavingExpressionType(ResolveExpression.class);
- info.merge(other);
- assertMisbehavedExpressionTypes(info, new Class[] {WithExpression.class, ResolveExpression.class});
- }
-
- // ---- test expression ---------------------------------------------------------------------
-
- public void testCountExpression() {
- assertDefaultAccessOnly((new CountExpression("10")).computeExpressionInfo());
- }
-
- public void testEqualsExpression() {
- assertDefaultAccessOnly((new EqualsExpression(new Object())).computeExpressionInfo());
- }
-
- public void testInstanceofExpression() {
- assertDefaultAccessOnly((new InstanceofExpression("java.lang.Object")).computeExpressionInfo());
- }
-
- public void testNotExpression() {
- assertDefaultAccessOnly((new NotExpression(new CountExpression("10"))).computeExpressionInfo());
- }
-
- public void testSystemExpression() {
- assertSystemPropertyOnly((new SystemTestExpression("property", "value")).computeExpressionInfo());
- }
-
- public void testTestExpression() {
- assertPropertyAccess((new TestExpression("namespace", "property", null,
- new Object())).computeExpressionInfo(), "namespace.property", true);
- }
-
- // ---- composite expressions ---------------------------------------------------------
-
- public void testAdaptExpression() throws Exception {
- assertDefaultAccessOnly(new AdaptExpression("java.lang.Object").computeExpressionInfo());
- }
-
- public void testAndExpression() throws Exception {
- AndExpression and= new AndExpression();
- assertNoAccess(and.computeExpressionInfo());
- and.add(new CountExpression("10"));
- assertDefaultAccessOnly(and.computeExpressionInfo());
- }
-
- public void testIterateExpression() throws Exception {
- assertDefaultAccessOnly(new IterateExpression("or").computeExpressionInfo());
- }
-
- public void testResolveExpression() {
- ResolveExpression resolve= new ResolveExpression("variable", null);
- assertNoAccess(resolve.computeExpressionInfo());
- resolve.add(new CountExpression("10"));
- assertVariableAccess(resolve.computeExpressionInfo(), "variable");
- }
-
- public void testWithExpression() {
- WithExpression with= new WithExpression("variable");
- assertNoAccess(with.computeExpressionInfo());
- with.add(new CountExpression("10"));
- assertVariableAccess(with.computeExpressionInfo(), "variable");
- }
-
- private void assertDefaultAccessOnly(ExpressionInfo info) {
- assertTrue("Accesses default variable", info.hasDefaultVariableAccess());
- assertFalse("Doesn't accesses system property", info.hasSystemPropertyAccess());
- assertTrue("No variable accesses", info.getAccessedVariableNames().length == 0);
- assertNull("No misbehaving expression types", info.getMisbehavingExpressionTypes());
- assertEquals("No properties accessed", 0, info.getAccessedPropertyNames().length);
- }
-
- private void assertSystemPropertyOnly(ExpressionInfo info) {
- assertFalse("Doesn't accesses default variable", info.hasDefaultVariableAccess());
- assertTrue("Accesses system property", info.hasSystemPropertyAccess());
- assertTrue("No variable accesses", info.getAccessedVariableNames().length == 0);
- assertNull("No misbehaving expression types", info.getMisbehavingExpressionTypes());
- assertEquals("No properties accessed", 0, info.getAccessedPropertyNames().length);
- }
-
- private void assertNoAccess(ExpressionInfo info) {
- assertFalse("Doesn't accesses default variable", info.hasDefaultVariableAccess());
- assertFalse("Doesn't accesses system property", info.hasSystemPropertyAccess());
- assertTrue("No variable accesses", info.getAccessedVariableNames().length == 0);
- assertNull("No misbehaving expression types", info.getMisbehavingExpressionTypes());
- assertEquals("No properties accessed", 0, info.getAccessedPropertyNames().length);
- }
-
- private void assertVariableAccess(ExpressionInfo info, String variable) {
- assertFalse("Doesn't accesses default variable", info.hasDefaultVariableAccess());
- assertFalse("Doesn't accesses system property", info.hasSystemPropertyAccess());
- String[] accessedVariableNames= info.getAccessedVariableNames();
- assertEquals("One variable accessed", 1, accessedVariableNames.length);
- assertEquals("Variable accessed", variable, accessedVariableNames[0]);
- assertNull("No misbehaving expression types", info.getMisbehavingExpressionTypes());
- assertEquals("No properties accessed", 0, info.getAccessedPropertyNames().length);
- }
-
- private void assertVariableAccess(ExpressionInfo info, String[] variables) {
- assertFalse("Doesn't accesses default variable", info.hasDefaultVariableAccess());
- assertFalse("Doesn't accesses system property", info.hasSystemPropertyAccess());
- Set accessedVariableNames= new HashSet(Arrays.asList(info.getAccessedVariableNames()));
- assertEquals("All variable accessed", variables.length, accessedVariableNames.size());
- for (int i= 0; i < variables.length; i++) {
- assertTrue("Variable accessed", accessedVariableNames.contains(variables[i]));
- }
- assertNull("No misbehaving expression types", info.getMisbehavingExpressionTypes());
- assertEquals("No properties accessed", 0, info.getAccessedPropertyNames().length);
- }
-
- private void assertPropertyAccess(ExpressionInfo info, String property, boolean defaultVariable) {
- assertEquals("Accesses default variable", defaultVariable, info.hasDefaultVariableAccess());
- assertFalse("Doesn't accesses system property", info.hasSystemPropertyAccess());
- String[] accessedPropertyNames= info.getAccessedPropertyNames();
- assertEquals("One property accessed", 1, accessedPropertyNames.length);
- assertEquals("Property accessed", property, accessedPropertyNames[0]);
- assertNull("No misbehaving expression types", info.getMisbehavingExpressionTypes());
- assertEquals("No variable accesses", 0, info.getAccessedVariableNames().length);
- }
-
- private void assertPropertyAccess(ExpressionInfo info, String[] properties, boolean defaultVariable) {
- assertEquals("Accesses default variable", defaultVariable, info.hasDefaultVariableAccess());
- assertFalse("Doesn't accesses system property", info.hasSystemPropertyAccess());
- Set accessedPropertyNames= new HashSet(Arrays.asList(info.getAccessedPropertyNames()));
- assertEquals("All properties accessed", properties.length, accessedPropertyNames.size());
- for (int i= 0; i < properties.length; i++) {
- assertTrue("Property accessed", accessedPropertyNames.contains(properties[i]));
- }
- assertNull("No misbehaving expression types", info.getMisbehavingExpressionTypes());
- assertEquals("No variable accesses", 0, info.getAccessedVariableNames().length);
- }
-
- private void assertMisbehavedExpressionTypes(ExpressionInfo info, Class[] types) {
- assertFalse("Doesn't accesses default variable", info.hasDefaultVariableAccess());
- assertFalse("Doesn't accesses system property", info.hasSystemPropertyAccess());
- assertTrue("No variable accesses", info.getAccessedVariableNames().length == 0);
- assertEquals("No properties accessed", 0, info.getAccessedPropertyNames().length);
- Set misbehavedTypes= new HashSet(Arrays.asList(info.getMisbehavingExpressionTypes()));
- assertEquals("All types accessed", types.length, misbehavedTypes.size());
- for (int i= 0; i < types.length; i++) {
- assertTrue("Type collected", misbehavedTypes.contains(types[i]));
- }
- }
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTestPlugin.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTestPlugin.java
deleted file mode 100644
index 5c6ec45..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTestPlugin.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import org.eclipse.core.runtime.Plugin;
-
-public class ExpressionTestPlugin extends Plugin {
-
- private static ExpressionTestPlugin fgDefault;
-
- public ExpressionTestPlugin() {
- fgDefault= this;
- }
-
- public static ExpressionTestPlugin getDefault() {
- return fgDefault;
- }
-
- public static String getPluginId() {
- return "org.eclipse.core.expressions.tests"; //$NON-NLS-1$
- }
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTests.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTests.java
deleted file mode 100644
index ae4f925..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTests.java
+++ /dev/null
@@ -1,962 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionConverter;
-import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.core.expressions.IVariableResolver;
-
-import org.eclipse.core.internal.expressions.AdaptExpression;
-import org.eclipse.core.internal.expressions.AndExpression;
-import org.eclipse.core.internal.expressions.CountExpression;
-import org.eclipse.core.internal.expressions.EnablementExpression;
-import org.eclipse.core.internal.expressions.EqualsExpression;
-import org.eclipse.core.internal.expressions.ExpressionStatus;
-import org.eclipse.core.internal.expressions.Expressions;
-import org.eclipse.core.internal.expressions.InstanceofExpression;
-import org.eclipse.core.internal.expressions.IterateExpression;
-import org.eclipse.core.internal.expressions.NotExpression;
-import org.eclipse.core.internal.expressions.OrExpression;
-import org.eclipse.core.internal.expressions.ResolveExpression;
-import org.eclipse.core.internal.expressions.SystemTestExpression;
-import org.eclipse.core.internal.expressions.TestExpression;
-import org.eclipse.core.internal.expressions.WithExpression;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-
-public class ExpressionTests extends TestCase {
-
- public static class CollectionWrapper {
- public Collection collection;
- }
-
- public static Test suite() {
- return new TestSuite(ExpressionTests.class);
- }
-
- public void testEscape() throws Exception {
- assertEquals("Str'ing", Expressions.unEscapeString("Str''ing")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("'", Expressions.unEscapeString("''")); //$NON-NLS-1$ //$NON-NLS-2$
- boolean caught= false;
- try {
- Expressions.unEscapeString("'"); //$NON-NLS-1$
- } catch (CoreException e) {
- caught= true;
- }
- assertTrue(caught);
- }
-
- public void testArgumentConversion() throws Exception {
- assertNull(Expressions.convertArgument(null));
- assertEquals("", Expressions.convertArgument("")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", Expressions.convertArgument("''")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("eclipse", Expressions.convertArgument("eclipse")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("e'clips'e", Expressions.convertArgument("e'clips'e")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("eclipse", Expressions.convertArgument("'eclipse'")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("'ecl'ipse'", Expressions.convertArgument("'''ecl''ipse'''")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("true", Expressions.convertArgument("'true'")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("1.7", Expressions.convertArgument("'1.7'")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("007", Expressions.convertArgument("'007'")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(Boolean.TRUE, Expressions.convertArgument("true")); //$NON-NLS-1$
- assertEquals(Boolean.FALSE, Expressions.convertArgument("false")); //$NON-NLS-1$
- assertEquals(new Integer(100), Expressions.convertArgument("100")); //$NON-NLS-1$
- assertEquals(new Float(1.7f), Expressions.convertArgument("1.7")); //$NON-NLS-1$
- }
-
- public void testArgumentParsing() throws Exception {
- Object[] result= null;
-
- result= Expressions.parseArguments(""); //$NON-NLS-1$
- assertEquals("", result[0]); //$NON-NLS-1$
-
- result= Expressions.parseArguments("s1"); //$NON-NLS-1$
- assertEquals("s1", result[0]); //$NON-NLS-1$
-
- result= Expressions.parseArguments(" s1 "); //$NON-NLS-1$
- assertEquals("s1", result[0]); //$NON-NLS-1$
-
- result= Expressions.parseArguments("s1,s2"); //$NON-NLS-1$
- assertEquals("s1", result[0]); //$NON-NLS-1$
- assertEquals("s2", result[1]); //$NON-NLS-1$
-
- result= Expressions.parseArguments(" s1 , s2 "); //$NON-NLS-1$
- assertEquals("s1", result[0]); //$NON-NLS-1$
- assertEquals("s2", result[1]); //$NON-NLS-1$
-
- result= Expressions.parseArguments("' s1 ',' s2 '"); //$NON-NLS-1$
- assertEquals(" s1 ", result[0]); //$NON-NLS-1$
- assertEquals(" s2 ", result[1]); //$NON-NLS-1$
-
- result= Expressions.parseArguments(" s1 , ' s2 '"); //$NON-NLS-1$
- assertEquals("s1", result[0]); //$NON-NLS-1$
- assertEquals(" s2 ", result[1]); //$NON-NLS-1$
-
- result= Expressions.parseArguments("' s1 ', s2 "); //$NON-NLS-1$
- assertEquals(" s1 ", result[0]); //$NON-NLS-1$
- assertEquals("s2", result[1]); //$NON-NLS-1$
-
- result= Expressions.parseArguments("''''"); //$NON-NLS-1$
- assertEquals("'", result[0]); //$NON-NLS-1$
-
- result= Expressions.parseArguments("''',''',','"); //$NON-NLS-1$
- assertEquals("','", result[0]); //$NON-NLS-1$
- assertEquals(",", result[1]); //$NON-NLS-1$
-
- result= Expressions.parseArguments("' s1 ', true "); //$NON-NLS-1$
- assertEquals(" s1 ", result[0]); //$NON-NLS-1$
- assertEquals(Boolean.TRUE, result[1]);
-
- boolean caught= false;
- try {
- Expressions.parseArguments("' s1"); //$NON-NLS-1$
- } catch (CoreException e) {
- caught= true;
- }
- assertTrue(caught);
- caught= false;
- try {
- Expressions.parseArguments("'''s1"); //$NON-NLS-1$
- } catch (CoreException e) {
- caught= true;
- }
- assertTrue(caught);
- }
-
- public void testSystemProperty() throws Exception {
- SystemTestExpression expression= new SystemTestExpression("os.name", System.getProperty("os.name")); //$NON-NLS-1$ //$NON-NLS-2$
- EvaluationResult result= expression.evaluate(new EvaluationContext(null, new Object()));
- assertTrue(result == EvaluationResult.TRUE);
- }
-
- public void testAdaptExpression() throws Exception {
- AdaptExpression expression= new AdaptExpression("org.eclipse.core.internal.expressions.tests.Adapter"); //$NON-NLS-1$
- expression.add(new InstanceofExpression("org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- EvaluationResult result= expression.evaluate(new EvaluationContext(null, new Adaptee()));
- assertTrue(result == EvaluationResult.TRUE);
- }
-
- public void testAdaptExpressionNotEqual() throws Exception {
- AdaptExpression expression1 = new AdaptExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter"); //$NON-NLS-1$
- expression1.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter1")); //$NON-NLS-1$
- AdaptExpression expression2 = new AdaptExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter"); //$NON-NLS-1$
- expression2.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter2")); //$NON-NLS-1$
- assertTrue("These adapt expressions should not be equal", !expression1
- .equals(expression2));
- }
-
- public void testAdaptExpressionHashCode() throws Exception {
- AdaptExpression expression1 = new AdaptExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter"); //$NON-NLS-1$
- expression1.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- AdaptExpression expression2 = new AdaptExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter"); //$NON-NLS-1$
- expression2.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- assertEquals("Equal expressions should have the same hash code",
- expression1.hashCode(), expression2.hashCode());
- }
-
- public void testAdaptExpressionFail() throws Exception {
- AdaptExpression expression= new AdaptExpression("org.eclipse.core.internal.expressions.tests.NotExisting"); //$NON-NLS-1$
- EvaluationResult result= expression.evaluate(new EvaluationContext(null, new Adaptee()));
- assertTrue(result == EvaluationResult.FALSE);
- }
-
- public void testAdaptExpressionFail2() throws Exception {
- AdaptExpression expression= new AdaptExpression("org.eclipse.core.internal.expressions.tests.Adapter"); //$NON-NLS-1$
- expression.add(new InstanceofExpression("org.eclipse.core.internal.expressions.tests.NotExisting")); //$NON-NLS-1$
- EvaluationResult result= expression.evaluate(new EvaluationContext(null, new Adaptee()));
- assertTrue(result == EvaluationResult.FALSE);
- }
-
- public void testAndExpressionNotEqual() throws Exception {
- AndExpression expression1 = new AndExpression();
- expression1.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter1")); //$NON-NLS-1$
- AndExpression expression2 = new AndExpression();
- expression2.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter2")); //$NON-NLS-1$
- assertTrue("These and expressions should not be equal", !expression1
- .equals(expression2));
- }
-
- public void testAndExpressionHashCode() throws Exception {
- AndExpression expression1 = new AndExpression();
- expression1.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- AndExpression expression2 = new AndExpression();
- expression2.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- assertEquals("Equal expressions should have the same hash code",
- expression1.hashCode(), expression2.hashCode());
- }
-
- public void testCountExpressionNotEqual() throws Exception {
- CountExpression expression1 = new CountExpression("+");
- CountExpression expression2 = new CountExpression("!");
- assertTrue("These count expressions should not be equal", !expression1
- .equals(expression2));
- }
-
- public void testCountExpressionHashCode() throws Exception {
- CountExpression expression1 = new CountExpression("*");
- CountExpression expression2 = new CountExpression("*");
- assertEquals("Equal expressions should have the same hash code",
- expression1.hashCode(), expression2.hashCode());
- }
-
- public void testEnablementExpressionNotEqual() throws Exception {
- EnablementExpression expression1 = new EnablementExpression((IConfigurationElement)null);
- expression1.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter1")); //$NON-NLS-1$
- EnablementExpression expression2 = new EnablementExpression((IConfigurationElement)null);
- expression2.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter2")); //$NON-NLS-1$
- assertTrue("These enablement expressions should not be equal",
- !expression1.equals(expression2));
- }
-
- public void testEnablementExpressionHashCode() throws Exception {
- EnablementExpression expression1 = new EnablementExpression((IConfigurationElement)null);
- expression1.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- EnablementExpression expression2 = new EnablementExpression((IConfigurationElement)null);
- expression2.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- assertEquals("Equal expressions should have the same hash code",
- expression1.hashCode(), expression2.hashCode());
- }
-
- public void testEqualsExpressionNotEqual() throws Exception {
- EqualsExpression expression1 = new EqualsExpression("+");
- EqualsExpression expression2 = new EqualsExpression("!");
- assertTrue("These equals expressions should not be equal", !expression1
- .equals(expression2));
- }
-
- public void testEqualsExpressionHashCode() throws Exception {
- EqualsExpression expression1 = new EqualsExpression("*");
- EqualsExpression expression2 = new EqualsExpression("*");
- assertEquals("Equal expressions should have the same hash code",
- expression1.hashCode(), expression2.hashCode());
- }
-
- public void testInstanceOfExpressionNotEqual() throws Exception {
- InstanceofExpression expression1 = new InstanceofExpression("+");
- InstanceofExpression expression2 = new InstanceofExpression("!");
- assertTrue("These instance of expressions should not be equal",
- !expression1.equals(expression2));
- }
-
- public void testInstanceOfExpressionHashCode() throws Exception {
- InstanceofExpression expression1 = new InstanceofExpression("*");
- InstanceofExpression expression2 = new InstanceofExpression("*");
- assertEquals("Equal expressions should have the same hash code",
- expression1.hashCode(), expression2.hashCode());
- }
-
- public void testIterateExpressionNotEqual() throws Exception {
- IterateExpression expression1 = new IterateExpression("or");
- expression1.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- IterateExpression expression2 = new IterateExpression("and");
- expression2.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- assertTrue("These iterate expressions should not be equal",
- !expression1.equals(expression2));
- }
-
- public void testIterateExpressionHashCode() throws Exception {
- IterateExpression expression1 = new IterateExpression("and");
- expression1.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- IterateExpression expression2 = new IterateExpression("and");
- expression2.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- assertEquals("Equal expressions should have the same hash code",
- expression1.hashCode(), expression2.hashCode());
- }
-
- public void testNotExpressionNotEqual() throws Exception {
- NotExpression expression1 = new NotExpression(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter1"));
- NotExpression expression2 = new NotExpression(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter2"));
- assertTrue("These not expressions should not be equal", !expression1
- .equals(expression2));
- }
-
- public void testNotExpressionHashCode() throws Exception {
- NotExpression expression1 = new NotExpression(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter"));
- NotExpression expression2 = new NotExpression(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter"));
- assertEquals("Equal expressions should have the same hash code",
- expression1.hashCode(), expression2.hashCode());
- }
-
- public void testOrExpressionNotEqual() throws Exception {
- OrExpression expression1 = new OrExpression();
- expression1.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter1")); //$NON-NLS-1$
- OrExpression expression2 = new OrExpression();
- expression2.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter2")); //$NON-NLS-1$
- assertTrue("These or expressions should not be equal", !expression1
- .equals(expression2));
- }
-
- public void testOrExpressionHashCode() throws Exception {
- OrExpression expression1 = new OrExpression();
- expression1.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- OrExpression expression2 = new OrExpression();
- expression2.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- assertEquals("Equal expressions should have the same hash code",
- expression1.hashCode(), expression2.hashCode());
- }
-
- public void testResolveExpressionNotEqual() throws Exception {
- ResolveExpression expression1 = new ResolveExpression("variable1",
- new Object[0]);
- expression1.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter1")); //$NON-NLS-1$
- ResolveExpression expression2 = new ResolveExpression("variable2",
- new Object[0]);
- expression2.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter2")); //$NON-NLS-1$
- assertTrue("These resolve expressions should not be equal",
- !expression1.equals(expression2));
- }
-
- public void testResolveExpressionHashCode() throws Exception {
- ResolveExpression expression1 = new ResolveExpression("variable",
- new Object[0]);
- expression1.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- ResolveExpression expression2 = new ResolveExpression("variable",
- new Object[0]);
- expression2.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- assertEquals("Equal expressions should have the same hash code",
- expression1.hashCode(), expression2.hashCode());
- }
-
- public void testSystemTestExpressionNotEqual() throws Exception {
- SystemTestExpression expression1 = new SystemTestExpression("prop",
- "value1");
- SystemTestExpression expression2 = new SystemTestExpression("prop",
- "value2");
- assertTrue("These system test expressions should not be equal",
- !expression1.equals(expression2));
- }
-
- public void testSystemTestExpressionHashCode() throws Exception {
- SystemTestExpression expression1 = new SystemTestExpression("prop",
- "value");
- SystemTestExpression expression2 = new SystemTestExpression("prop",
- "value");
- assertEquals("Equal expressions should have the same hash code",
- expression1.hashCode(), expression2.hashCode());
- }
-
- public void testTestExpressionNotEqual() throws Exception {
- TestExpression expression1 = new TestExpression("namespace", "prop",
- new Object[0], "value1");
- TestExpression expression2 = new TestExpression("namespace", "prop",
- new Object[0], "value2");
- assertTrue("These system test expressions should not be equal",
- !expression1.equals(expression2));
- }
-
- public void testTestExpressionHashCode() throws Exception {
- TestExpression expression1 = new TestExpression("namespace", "prop",
- new Object[0], "value");
- TestExpression expression2 = new TestExpression("namespace", "prop",
- new Object[0], "value");
- assertEquals("Equal expressions should have the same hash code",
- expression1.hashCode(), expression2.hashCode());
- }
-
- public void testWithExpressionNotEqual() throws Exception {
- WithExpression expression1 = new WithExpression("variable1");
- expression1.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter1")); //$NON-NLS-1$
- WithExpression expression2 = new WithExpression("variable2");
- expression2.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter2")); //$NON-NLS-1$
- assertTrue("These with expressions should not be equal",
- !expression1.equals(expression2));
- }
-
- public void testWithExpressionHashCode() throws Exception {
- WithExpression expression1 = new WithExpression("variable");
- expression1.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- WithExpression expression2 = new WithExpression("variable");
- expression2.add(new InstanceofExpression(
- "org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
- assertEquals("Equal expressions should have the same hash code",
- expression1.hashCode(), expression2.hashCode());
- }
-
- public void testWithExpressionNoVariable() throws Exception {
- WithExpression expr = new WithExpression("variable");
- expr.add(new EqualsExpression(new Object()));
- EvaluationContext context = new EvaluationContext(null, new Object());
- try {
- expr.evaluate(context);
- fail("Should throw exceptoin");
- } catch (CoreException e) {
- // this is success
- }
- }
-
- public void testWithExpressionUndefinedVariable() throws Exception {
- WithExpression expr = new WithExpression("variable");
- expr.add(new EqualsExpression(new Object()));
- EvaluationContext context = new EvaluationContext(null, new Object());
- context.addVariable("variable", IEvaluationContext.UNDEFINED_VARIABLE);
- assertEquals(EvaluationResult.FALSE, expr.evaluate(context));
- }
-
- public void testVariableResolver() throws Exception {
- final Object result= new Object();
- IVariableResolver resolver= new IVariableResolver() {
- public Object resolve(String name, Object[] args) throws CoreException {
- assertEquals("variable", name); //$NON-NLS-1$
- assertEquals("arg1", args[0]); //$NON-NLS-1$
- assertEquals(Boolean.TRUE, args[1]);
- return result;
- }
- };
- EvaluationContext context= new EvaluationContext(null, new Object(), new IVariableResolver[] { resolver });
- assertTrue(result == context.resolveVariable("variable", new Object[] {"arg1", Boolean.TRUE})); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testEqualsExpression() throws Exception {
- EqualsExpression exp= new EqualsExpression("name"); //$NON-NLS-1$
- EvaluationContext context= new EvaluationContext(null, "name"); //$NON-NLS-1$
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
- exp= new EqualsExpression(Boolean.TRUE);
- context= new EvaluationContext(null, Boolean.TRUE);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
- exp= new EqualsExpression("name"); //$NON-NLS-1$
- context= new EvaluationContext(null, Boolean.TRUE);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
- }
-
- public void testCountExpressionAnyNumber() throws Exception {
- CountExpression exp= new CountExpression("*"); //$NON-NLS-1$
-
- List list= new ArrayList();
- EvaluationContext context= new EvaluationContext(null, list);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
- list.clear();
- list.add("one"); //$NON-NLS-1$
- context= new EvaluationContext(null, list);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
- list.clear();
- list.add("one"); //$NON-NLS-1$
- list.add("two"); //$NON-NLS-1$
- list.add("three"); //$NON-NLS-1$
- context= new EvaluationContext(null, list);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
- }
-
- public void testCountExpressionExact() throws Exception {
- CountExpression exp= new CountExpression("2"); //$NON-NLS-1$
-
- List list= new ArrayList();
- list.add("one"); //$NON-NLS-1$
- EvaluationContext context= new EvaluationContext(null, list);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
-
- list.clear();
- list.add("one"); //$NON-NLS-1$
- list.add("two"); //$NON-NLS-1$
- context= new EvaluationContext(null, list);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
- list.clear();
- list.add("one"); //$NON-NLS-1$
- list.add("two"); //$NON-NLS-1$
- list.add("three"); //$NON-NLS-1$
- context= new EvaluationContext(null, list);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
- }
-
- public void testCountExpressionNoneOrOne() throws Exception {
- CountExpression exp= new CountExpression("?"); //$NON-NLS-1$
-
- List list= new ArrayList();
- EvaluationContext context= new EvaluationContext(null, list);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
- list.clear();
- list.add("one"); //$NON-NLS-1$
- context= new EvaluationContext(null, list);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
- list.clear();
- list.add("one"); //$NON-NLS-1$
- list.add("two"); //$NON-NLS-1$
- context= new EvaluationContext(null, list);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
- }
-
- public void testCountExpressionOneOrMore() throws Exception {
- CountExpression exp= new CountExpression("+"); //$NON-NLS-1$
-
- List list= new ArrayList();
- EvaluationContext context= new EvaluationContext(null, list);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
-
- list.clear();
- list.add("one"); //$NON-NLS-1$
- context= new EvaluationContext(null, list);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
- list.clear();
- list.add("one"); //$NON-NLS-1$
- list.add("two"); //$NON-NLS-1$
- context= new EvaluationContext(null, list);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
- }
-
- public void testCountExpressionNone() throws Exception {
- CountExpression exp= new CountExpression("!"); //$NON-NLS-1$
-
- List list= new ArrayList();
- EvaluationContext context= new EvaluationContext(null, list);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
- list.clear();
- list.add("one"); //$NON-NLS-1$
- context= new EvaluationContext(null, list);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
-
- list.clear();
- list.add("one"); //$NON-NLS-1$
- list.add("two"); //$NON-NLS-1$
- context= new EvaluationContext(null, list);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
- }
-
- public void testCountExpressionNoneWithAdapterManager() throws Exception {
- CountExpression exp= new CountExpression("!"); //$NON-NLS-1$
-
- List list= new ArrayList();
- CollectionWrapper wrapper= new CollectionWrapper();
- wrapper.collection= list;
-
- EvaluationContext context= new EvaluationContext(null, wrapper);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
- list.clear();
- list.add("one"); //$NON-NLS-1$
- context= new EvaluationContext(null, wrapper);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
-
- list.clear();
- list.add("one"); //$NON-NLS-1$
- list.add("two"); //$NON-NLS-1$
- context= new EvaluationContext(null, wrapper);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
- }
-
- public void testCountExpressionFailure() throws Exception {
- CountExpression exp= new CountExpression("!"); //$NON-NLS-1$
-
- EvaluationContext context= new EvaluationContext(null, new Object());
- try {
- EvaluationResult result= exp.evaluate(context);
- fail("Count should've failed for non-Collection variable. Result = " +
-
- result.toString());
- } catch (CoreException e) {
- assertEquals(ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION, e.getStatus().getCode());
- }
- }
-
- public void testInstanceofTrue() throws Exception {
- B b= new B();
- EvaluationContext context= new EvaluationContext(null, b);
-
- InstanceofExpression exp= new InstanceofExpression("org.eclipse.core.internal.expressions.tests.B"); //$NON-NLS-1$
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
- exp= new InstanceofExpression("org.eclipse.core.internal.expressions.tests.A"); //$NON-NLS-1$
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
- exp= new InstanceofExpression("org.eclipse.core.internal.expressions.tests.I"); //$NON-NLS-1$
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
- }
-
- public void testInstanceofFalse() throws Exception {
- A a= new A();
- EvaluationContext context= new EvaluationContext(null, a);
-
- InstanceofExpression exp= new InstanceofExpression("org.eclipse.core.internal.expressions.tests.B"); //$NON-NLS-1$
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
- }
-
- public void testIterateExpressionAndTrue() throws Exception {
- final List result= new ArrayList();
- Expression myExpression= new Expression() {
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- result.add(context.getDefaultVariable());
- return EvaluationResult.TRUE;
- }
- };
- IterateExpression exp= new IterateExpression("and"); //$NON-NLS-1$
- exp.add(myExpression);
- List input= new ArrayList();
- input.add("one"); //$NON-NLS-1$
- input.add("two"); //$NON-NLS-1$
- EvaluationContext context= new EvaluationContext(null, input);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
- assertTrue(result.equals(input));
- }
-
- public void testIterateExpressionAndFalse() throws Exception {
- final List result= new ArrayList();
- Expression myExpression= new Expression() {
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- result.add(context.getDefaultVariable());
- return EvaluationResult.FALSE;
- }
- };
- IterateExpression exp= new IterateExpression("and"); //$NON-NLS-1$
- exp.add(myExpression);
- List input= new ArrayList();
- input.add("one"); //$NON-NLS-1$
- input.add("two"); //$NON-NLS-1$
- EvaluationContext context= new EvaluationContext(null, input);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
- assertTrue(result.size() == 1 && result.get(0).equals("one")); //$NON-NLS-1$
- }
-
- public void testIterateExpressionOrTrue() throws Exception {
- final List result= new ArrayList();
- Expression myExpression= new Expression() {
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- result.add(context.getDefaultVariable());
- return EvaluationResult.TRUE;
- }
- };
- IterateExpression exp= new IterateExpression("or"); //$NON-NLS-1$
- exp.add(myExpression);
- List input= new ArrayList();
- input.add("one"); //$NON-NLS-1$
- input.add("two"); //$NON-NLS-1$
- EvaluationContext context= new EvaluationContext(null, input);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
- assertTrue(result.size() == 1 && result.get(0).equals("one")); //$NON-NLS-1$
- }
-
- public void testIterateExpressionOrFalse() throws Exception {
- final List result= new ArrayList();
- Expression myExpression= new Expression() {
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- result.add(context.getDefaultVariable());
- return EvaluationResult.FALSE;
- }
- };
- IterateExpression exp= new IterateExpression("or"); //$NON-NLS-1$
- exp.add(myExpression);
- List input= new ArrayList();
- input.add("one"); //$NON-NLS-1$
- input.add("two"); //$NON-NLS-1$
- EvaluationContext context= new EvaluationContext(null, input);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
- assertTrue(result.equals(input));
- }
-
- public void testIterateExpressionEmptyOr() throws Exception {
- IterateExpression exp= new IterateExpression("or"); //$NON-NLS-1$
- List input= new ArrayList();
- EvaluationContext context= new EvaluationContext(null, input);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
- }
-
- public void testIterateExpressionEmptyAnd() throws Exception {
- IterateExpression exp= new IterateExpression("and"); //$NON-NLS-1$
- List input= new ArrayList();
- EvaluationContext context= new EvaluationContext(null, input);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
- }
-
- public void testIterateExpressionAnd_IfEmptyTrue() throws Exception {
- IterateExpression exp= new IterateExpression("and", "true"); //$NON-NLS-1$
- List input= new ArrayList();
- EvaluationContext context= new EvaluationContext(null, input);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
- }
-
- public void testIterateExpressionAnd_IfEmptyFalse() throws Exception {
- IterateExpression exp= new IterateExpression("and", "false"); //$NON-NLS-1$
- List input= new ArrayList();
- EvaluationContext context= new EvaluationContext(null, input);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
- }
-
- public void testIterateExpressionOr_IfEmptyTrue() throws Exception {
- IterateExpression exp= new IterateExpression("or", "true"); //$NON-NLS-1$
- List input= new ArrayList();
- EvaluationContext context= new EvaluationContext(null, input);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
- }
-
- public void testIterateExpressionOr_IfEmptyFalse() throws Exception {
- IterateExpression exp= new IterateExpression("or", "false"); //$NON-NLS-1$
- List input= new ArrayList();
- EvaluationContext context= new EvaluationContext(null, input);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
- }
-
- public void testIterateExpressionWithAdapterManager() throws Exception {
- final List result= new ArrayList();
- Expression myExpression= new Expression() {
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- result.add(context.getDefaultVariable());
- return EvaluationResult.FALSE;
- }
- };
- IterateExpression exp= new IterateExpression("or"); //$NON-NLS-1$
- exp.add(myExpression);
- final List input= new ArrayList();
- input.add("one"); //$NON-NLS-1$
- input.add("two"); //$NON-NLS-1$
- CollectionWrapper wrapper= new CollectionWrapper();
- wrapper.collection= input;
- EvaluationContext context= new EvaluationContext(null, wrapper);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
- assertTrue(result.equals(input));
- }
-
- public void testIterateExpressionWithAdapterManagerEmptyAnd() throws Exception {
- IterateExpression exp= new IterateExpression("and"); //$NON-NLS-1$
- final List input= new ArrayList();
- CollectionWrapper wrapper= new CollectionWrapper();
- wrapper.collection= input;
- EvaluationContext context= new EvaluationContext(null, wrapper);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
- }
-
- public void testIterateExpressionWithAdapterManagerEmptyOr() throws Exception {
- IterateExpression exp= new IterateExpression("or"); //$NON-NLS-1$
- final List input= new ArrayList();
- CollectionWrapper wrapper= new CollectionWrapper();
- wrapper.collection= input;
- EvaluationContext context= new EvaluationContext(null, wrapper);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
- }
-
- public void testIterateExpressionWithAdapterManagerIfEmptyFalse() throws Exception {
- IterateExpression exp= new IterateExpression("or", "false"); //$NON-NLS-1$
- final List input= new ArrayList();
- CollectionWrapper wrapper= new CollectionWrapper();
- wrapper.collection= input;
- EvaluationContext context= new EvaluationContext(null, wrapper);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
- }
-
- public void testIterateExpressionWithAdapterManagerIfEmptyTrue() throws Exception {
- IterateExpression exp= new IterateExpression("or", "true"); //$NON-NLS-1$
- final List input= new ArrayList();
- CollectionWrapper wrapper= new CollectionWrapper();
- wrapper.collection= input;
- EvaluationContext context= new EvaluationContext(null, wrapper);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
- }
-
- public void testIterateExpressionFailure() throws Exception {
- IterateExpression exp= new IterateExpression((String)null);
-
- EvaluationContext context= new EvaluationContext(null, new Object());
- try {
- EvaluationResult result= exp.evaluate(context);
- fail("Count should've failed for non-Collection variable. Result = " +
-
- result.toString());
- } catch (CoreException e) {
- assertEquals(ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION, e.getStatus().getCode());
- }
- }
-
- public void testReadXMLExpression() throws Exception {
- IExtensionRegistry registry= Platform.getExtensionRegistry();
- IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions.tests", "testParticipants"); //$NON-NLS-1$ //$NON-NLS-2$
-
- IConfigurationElement enable= findExtension(ces, "test1").getChildren("enablement")[0]; //$NON-NLS-1$ //$NON-NLS-2$
- Expression exp= ExpressionConverter.getDefault().perform(enable);
- ref(exp);
- }
-
- public void testReadDOMExpression() throws Exception {
- IExtensionRegistry registry= Platform.getExtensionRegistry();
- IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions.tests", "testParticipants"); //$NON-NLS-1$ //$NON-NLS-2$
-
- DocumentBuilder builder= DocumentBuilderFactory.newInstance().newDocumentBuilder();
- URL url= ExpressionTestPlugin.getDefault().getBundle().getEntry("plugin.xml");
- Document document= builder.parse(url.openStream());
- NodeList testParticipants= document.getElementsByTagName("testParticipant");
- for (int i= 0; i < testParticipants.getLength(); i++) {
- Element elem= (Element)testParticipants.item(i);
- String id = elem.getAttribute("id");
- Element enable1= (Element)elem.getElementsByTagName("enablement").item(0);
- IConfigurationElement enable2= findExtension(ces, id).getChildren("enablement")[0]; //$NON-NLS-1$
-
- Expression exp1= ExpressionConverter.getDefault().perform(enable1);
- Expression exp2= ExpressionConverter.getDefault().perform(enable2);
- assertEquals(exp1, exp2);
- }
- }
-
- public void testForcePluginActivation() throws Exception {
- IExtensionRegistry registry= Platform.getExtensionRegistry();
- IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions.tests", "testParticipants"); //$NON-NLS-1$ //$NON-NLS-2$
-
- IConfigurationElement enable= findExtension(ces, "test2").getChildren("enablement")[0]; //$NON-NLS-1$ //$NON-NLS-2$
- EnablementExpression exp= (EnablementExpression) ExpressionConverter.getDefault().perform(enable);
- Expression[] children= exp.getChildren();
- assertTrue(children.length == 3);
- TestExpression test= (TestExpression) children[0];
- assertTrue(test.testGetForcePluginActivation());
- test= (TestExpression) children[1];
- assertTrue(!test.testGetForcePluginActivation());
- test= (TestExpression) children[2];
- assertTrue(!test.testGetForcePluginActivation());
- }
-
- public void testPlatformPropertyTester() throws Exception {
- IExtensionRegistry registry= Platform.getExtensionRegistry();
- IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions.tests", "testParticipants"); //$NON-NLS-1$ //$NON-NLS-2$
-
- IConfigurationElement enable= findExtension(ces, "test3").getChildren("enablement")[0]; //$NON-NLS-1$ //$NON-NLS-2$
- Expression exp= ExpressionConverter.getDefault().perform(enable);
- EvaluationContext context = new EvaluationContext(null, Platform.class);
- assertEquals(EvaluationResult.TRUE, exp.evaluate(context));
- }
-
- private IConfigurationElement findExtension(IConfigurationElement[] ces, String id) {
- for (int i= 0; i < ces.length; i++) {
- if (id.equals(ces[i].getAttribute("id"))) //$NON-NLS-1$
- return ces[i];
- }
- return null;
- }
-
- protected void ref(Expression exp) {
- }
-
-
- public void testDefinitionExpression() throws Exception {
- IExtensionRegistry registry= Platform.getExtensionRegistry();
- IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions", "definitions");
- IConfigurationElement expr= findExtension(ces, "org.eclipse.core.expressions.tests.activeProblemsView");
- assertNotNull(expr);
- Expression probExpr= ExpressionConverter.getDefault().perform(expr.getChildren()[0]);
- EvaluationContext context= new EvaluationContext(null, Collections.EMPTY_LIST);
- try {
- probExpr.evaluate(context);
- fail("Should report error with no variable");
- } catch (CoreException e) {
- // correct, throw exception
- }
- context.addVariable("activePartId", "org.eclipse.ui.views.TasksView");
- assertEquals(EvaluationResult.FALSE, probExpr.evaluate(context));
-
- context.addVariable("activePartId", "org.eclipse.ui.views.ProblemsView");
- assertEquals(EvaluationResult.TRUE, probExpr.evaluate(context));
- }
-
- public void testReferenceExpression() throws Exception {
- IExtensionRegistry registry= Platform.getExtensionRegistry();
- IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions.tests", "testParticipants"); //$NON-NLS-1$ //$NON-NLS-2$
-
- IConfigurationElement enable= findExtension(ces, "refTest1").getChildren("enablement")[0]; //$NON-NLS-1$ //$NON-NLS-2$
- EnablementExpression probExpr= (EnablementExpression)ExpressionConverter.getDefault().perform(enable);
- EvaluationContext context= new EvaluationContext(null, Collections.EMPTY_LIST);
-
- try {
- probExpr.evaluate(context);
- fail("Should report error with no variable");
- } catch (CoreException e) {
- // correct, throw exception
- }
- context.addVariable("activePartId", "org.eclipse.ui.views.TasksView");
- assertEquals(EvaluationResult.FALSE, probExpr.evaluate(context));
-
- context.addVariable("activePartId", "org.eclipse.ui.views.ProblemsView");
- assertEquals(EvaluationResult.TRUE, probExpr.evaluate(context));
- }
-
- public void testTwoReferences() throws Exception {
- IExtensionRegistry registry= Platform.getExtensionRegistry();
- IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions.tests", "testParticipants"); //$NON-NLS-1$ //$NON-NLS-2$
-
- IConfigurationElement enable= findExtension(ces, "refTest2").getChildren("enablement")[0]; //$NON-NLS-1$ //$NON-NLS-2$
- EnablementExpression probExpr= (EnablementExpression)ExpressionConverter.getDefault().perform(enable);
- EvaluationContext context= new EvaluationContext(null, Collections.EMPTY_LIST);
-
- try {
- probExpr.evaluate(context);
- fail("Should report error with no variable");
- } catch (CoreException e) {
- // correct, throw exception
- }
- context.addVariable("activePartId", "org.eclipse.ui.views.TasksView");
- assertEquals(EvaluationResult.FALSE, probExpr.evaluate(context));
-
- context.addVariable("activePartId", "org.eclipse.ui.views.ProblemsView");
- // we still have no selection in the default variable
- assertEquals(EvaluationResult.FALSE, probExpr.evaluate(context));
-
- context= new EvaluationContext(context, Collections.singletonList(probExpr));
- assertEquals(EvaluationResult.TRUE, probExpr.evaluate(context));
- }
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/I.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/I.java
deleted file mode 100644
index 04b442c..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/I.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-
-public interface I {
-
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/I_TypeExtender.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/I_TypeExtender.java
deleted file mode 100644
index cc37ec5..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/I_TypeExtender.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import org.eclipse.core.runtime.Assert;
-
-import org.eclipse.core.expressions.PropertyTester;
-
-public class I_TypeExtender extends PropertyTester {
-
- public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
- if ("ordering".equals(method)) { //$NON-NLS-1$
- return "I".equals(expectedValue); //$NON-NLS-1$
- }
- Assert.isTrue(false);
- return false;
- }
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/PropertyTesterTests.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/PropertyTesterTests.java
deleted file mode 100644
index 35d7b8f..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/PropertyTesterTests.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-
-import org.eclipse.core.internal.expressions.Property;
-import org.eclipse.core.internal.expressions.TestExpression;
-import org.eclipse.core.internal.expressions.TypeExtensionManager;
-
-import org.osgi.framework.Bundle;
-
-public class PropertyTesterTests extends TestCase {
-
- private A a;
- private B b;
- private I i;
-
- private static final TypeExtensionManager fgManager= new TypeExtensionManager("propertyTesters"); //$NON-NLS-1$
-
- // Needs additional local test plug-ins
- private static final boolean TEST_DYNAMIC_AND_ACTIVATION= false;
-
- public static Test suite() {
- return new TestSuite(PropertyTesterTests.class);
- }
-
- protected void setUp() throws Exception {
- a= new A();
- b= new B();
- i= b;
- }
-
- public void testSimple() throws Exception {
- assertTrue(test(a, "simple", null,"simple")); //$NON-NLS-1$ //$NON-NLS-2$
- // second pass to check if cache is populated correctly
- assertTrue(test(a, "simple", null,"simple")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testInherited() throws Exception {
- assertTrue(test(b, "simple", null, "simple")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(test(i, "simple", null, "simple")); //$NON-NLS-1$ //$NON-NLS-2$
- // second pass to check if cache is populated correctly
- assertTrue(test(b, "simple", null, "simple")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(test(i, "simple", null, "simple")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testUnknown() throws Exception {
- try {
- test(a, "unknown", null, null); //$NON-NLS-1$
- } catch (CoreException e) {
- return;
- }
- assertTrue(false);
- }
-
- public void testOverridden() throws Exception {
- assertTrue(test(a, "overridden", null, "A")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(test(b, "overridden", null, "B")); //$NON-NLS-1$ //$NON-NLS-2$
- A b_as_a= b;
- assertTrue(test(b_as_a, "overridden", null, "B")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(test(i, "overridden", null, "B")); //$NON-NLS-1$ //$NON-NLS-2$
- // second pass to check if cache is populated correctly
- assertTrue(test(a, "overridden", null, "A")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(test(b, "overridden", null, "B")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(test(b_as_a, "overridden", null, "B")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(test(i, "overridden", null, "B")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testOdering() throws Exception {
- assertTrue(test(b, "ordering", null, "A")); //$NON-NLS-1$ //$NON-NLS-2$
- I other= new I() {};
- assertTrue(test(other, "ordering", null, "I")); //$NON-NLS-1$ //$NON-NLS-2$
- // second pass to check if cache is populated correctly
- assertTrue(test(b, "ordering", null, "A")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(test(other, "ordering", null, "I")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testChaining() throws Exception {
- assertTrue(test(a, "chaining", null, "A2")); //$NON-NLS-1$ //$NON-NLS-2$
- // second pass to check if cache is populated correctly
- assertTrue(test(a, "chaining", null, "A2")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // This test is questionable. It depends on if core runtime can
- // guaratee any ordering in the plug-in registry.
- public void testChainOrdering() throws Exception {
- assertTrue(test(a, "chainOrdering", null, "A")); //$NON-NLS-1$ //$NON-NLS-2$
- // second pass to check if cache is populated correctly
- assertTrue(test(a, "chainOrdering", null, "A")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testWrongNameSpace() throws Exception {
- try {
- test(a, "differentNamespace", null, null); //$NON-NLS-1$
- } catch (CoreException e) {
- return;
- }
- assertTrue(false);
- }
-
- public void testDynamicPlugin() throws Exception {
- if (!TEST_DYNAMIC_AND_ACTIVATION)
- return;
-
- A receiver= new A();
- Property p= fgManager.getProperty(receiver, "org.eclipse.core.expressions.tests.dynamic", "testing"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(!p.isInstantiated());
- Bundle bundle= Platform.getBundle("org.eclipse.core.expressions.tests.dynamic"); //$NON-NLS-1$
- bundle.start();
- p= fgManager.getProperty(receiver, "org.eclipse.core.expressions.tests.dynamic", "testing"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(p.isInstantiated());
- bundle.stop();
- bundle.uninstall();
- boolean exception= false;
- try {
- p= fgManager.getProperty(receiver, "org.eclipse.core.expressions.tests.dynamic", "testing"); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (CoreException e) {
- exception= true;
- } catch (InvalidRegistryObjectException e) {
- // The uninstall events are sent out in a separate thread.
- // So the type extension registry might not be flushed even
- // though the bundle has already been uninstalled.
- exception= true;
- }
- assertTrue("Core exception not thrown", exception);
- }
-
- public void testPluginActivation() throws Exception {
- if (!TEST_DYNAMIC_AND_ACTIVATION)
- return;
-
- Bundle bundle= Platform.getBundle("org.eclipse.core.expressions.tests.forceActivation"); //$NON-NLS-1$
- assertTrue(bundle.getState() == Bundle.RESOLVED);
-
- A receiver= new A();
- TestExpression exp= new TestExpression("org.eclipse.core.expressions.tests.forceActivation", "testing", null, null, true);
- EvaluationContext context= new EvaluationContext(null, receiver);
- EvaluationResult result= exp.evaluate(context);
- assertTrue(result == EvaluationResult.NOT_LOADED);
- assertTrue(bundle.getState() == Bundle.RESOLVED);
- Property p= TestExpression.testGetTypeExtensionManager().getProperty(receiver, "org.eclipse.core.expressions.tests.forceActivation", "testing", false); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(!p.isInstantiated());
-
- context.setAllowPluginActivation(true);
- exp.evaluate(context);
- assertTrue(bundle.getState() == Bundle.ACTIVE);
- p= TestExpression.testGetTypeExtensionManager().getProperty(receiver, "org.eclipse.core.expressions.tests.forceActivation", "testing", false); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(p.isInstantiated());
- }
-
- public void testDifferentNameSpace() throws Exception {
- assertTrue(test("org.eclipse.core.internal.expressions.tests2", a, "differentNamespace", null, "A3")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- private boolean test(Object receiver, String property, Object[] args, Object expectedValue) throws CoreException {
- Property p= fgManager.getProperty(receiver, "org.eclipse.core.internal.expressions.tests", property); //$NON-NLS-1$
- assertTrue(p.isInstantiated());
- return p.test(receiver, args, expectedValue);
- }
-
- private boolean test(String namespace, Object receiver, String property, Object[] args, Object expectedValue) throws CoreException {
- Property p= fgManager.getProperty(receiver, namespace, property);
- assertTrue(p.isInstantiated());
- return p.test(receiver, args, expectedValue);
- }
-}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/TestAdapterFactory.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/TestAdapterFactory.java
deleted file mode 100644
index 2e57a01..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/TestAdapterFactory.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-
-public class TestAdapterFactory implements IAdapterFactory {
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (Adapter.class.equals(adapterType))
- return new Adapter();
- return null;
- }
-
- public Class[] getAdapterList() {
- return new Class[] { Adapter.class };
- }
-}
diff --git a/tests/org.eclipse.core.expressions.tests/test.xml b/tests/org.eclipse.core.expressions.tests/test.xml
deleted file mode 100644
index e651fb1..0000000
--- a/tests/org.eclipse.core.expressions.tests/test.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="testsuite" default="run" basedir=".">
- <!-- The property ${eclipse-home} should be passed into this script -->
- <!-- Set a meaningful default value for when it is not. -->
- <property name="eclipse-home" value="${basedir}\..\.."/>
-
- <!-- sets the properties eclipse-home, and library-file -->
- <property name="plugin-name" value="org.eclipse.core.expressions.tests"/>
- <property name="library-file"
- value="${eclipse-home}/plugins/org.eclipse.test/library.xml"/>
-
- <!-- This target holds all initialization code that needs to be done for -->
- <!-- all tests that are to be run. Initialization for individual tests -->
- <!-- should be done within the body of the suite target. -->
- <target name="init">
- <tstamp/>
- <delete>
- <fileset dir="${eclipse-home}" includes="org*.xml"/>
- </delete>
- </target>
-
- <!-- This target defines the tests that need to be run. -->
- <target name="suite">
- <property name="expressions-folder"
- value="${eclipse-home}/expressions_folder"/>
- <delete dir="${expressions-folder}" quiet="true"/>
- <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${expressions-folder}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname"
- value="org.eclipse.core.internal.expressions.tests.AllTests"/>
- </ant>
- </target>
-
- <!-- This target holds code to cleanup the testing environment after -->
- <!-- after all of the tests have been run. You can use this target to -->
- <!-- delete temporary files that have been created. -->
- <target name="cleanup">
- </target>
-
- <!-- This target runs the test suite. Any actions that need to happen -->
- <!-- after all the tests have been run should go here. -->
- <target name="run" depends="init,suite,cleanup">
- <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
- <property name="includes" value="org*.xml"/>
- <property name="output-file" value="${plugin-name}.xml"/>
- </ant>
- </target>
-
- <target name="performance">
- </target>
-
-</project>
diff --git a/tests/org.eclipse.core.tests.runtime/.classpath b/tests/org.eclipse.core.tests.runtime/.classpath
deleted file mode 100644
index 751c8f2..0000000
--- a/tests/org.eclipse.core.tests.runtime/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/tests/org.eclipse.core.tests.runtime/.cvsignore b/tests/org.eclipse.core.tests.runtime/.cvsignore
deleted file mode 100644
index c5e82d7..0000000
--- a/tests/org.eclipse.core.tests.runtime/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
\ No newline at end of file
diff --git a/tests/org.eclipse.core.tests.runtime/.project b/tests/org.eclipse.core.tests.runtime/.project
deleted file mode 100644
index add46bf..0000000
--- a/tests/org.eclipse.core.tests.runtime/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.tests.runtime</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.core.resources.prefs b/tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 134146c..0000000
--- a/tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue May 25 14:59:47 EDT 2004
-encoding/<project>=ISO-8859-1
-eclipse.preferences.version=1
diff --git a/tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index cab35bd..0000000
--- a/tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,332 +0,0 @@
-#Fri Feb 23 16:59:24 EST 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.builder.cleanOutputFolder=clean
-org.eclipse.jdt.core.builder.duplicateResourceTask=warning
-org.eclipse.jdt.core.builder.invalidClasspath=abort
-org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
-org.eclipse.jdt.core.circularClasspath=error
-org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
-org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=false
-org.eclipse.jdt.core.formatter.comment.format_comments=false
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=80
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=800
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.incompatibleJDKLevel=ignore
-org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.jdt.ui.prefs b/tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index a6e9728..0000000
--- a/tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,9 +0,0 @@
-#Fri Feb 23 16:59:23 EST 2007
-eclipse.preferences.version=1
-formatter_profile=_core
-formatter_settings_version=11
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=;
-org.eclipse.jdt.ui.ondemandthreshold=3
-org.eclipse.jdt.ui.staticondemandthreshold=99
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return Returns the ${bare_field_name}.\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} The ${bare_field_name} to set.\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Copyright (c) ${year} IBM Corporation and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n ******************************************************************************/\r\n</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @since 3.2\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="New classes and interfaces" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} IBM Corporation and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n *******************************************************************************/\r\n${filecomment}\r\n${package_declaration}\r\n\r\n/**\r\n * \r\n */\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">fail("4.99", ${exception_var});</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.pde.prefs b/tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.pde.prefs
deleted file mode 100644
index ed2baf9..0000000
--- a/tests/org.eclipse.core.tests.runtime/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,17 +0,0 @@
-#Mon Mar 24 15:14:37 EDT 2008
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.deprecated=1
-compilers.p.discouraged-class=1
-compilers.p.missing-bundle-classpath-entries=1
-compilers.p.missing-packages=1
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=2
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=1
-compilers.p.unresolved-import=0
-compilers.use-project=true
-eclipse.preferences.version=1
diff --git a/tests/org.eclipse.core.tests.runtime/All Runtime Tests.launch b/tests/org.eclipse.core.tests.runtime/All Runtime Tests.launch
deleted file mode 100644
index 0a52d96..0000000
--- a/tests/org.eclipse.core.tests.runtime/All Runtime Tests.launch
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
-<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
-<booleanAttribute key="askclear" value="false"/>
-<booleanAttribute key="automaticAdd" value="true"/>
-<booleanAttribute key="automaticValidate" value="false"/>
-<stringAttribute key="bootstrap" value=""/>
-<stringAttribute key="checked" value="[NONE]"/>
-<booleanAttribute key="clearConfig" value="true"/>
-<booleanAttribute key="clearws" value="true"/>
-<stringAttribute key="configLocation" value=""/>
-<booleanAttribute key="default" value="true"/>
-<booleanAttribute key="includeFragments" value="false"/>
-<booleanAttribute key="includeOptional" value="true"/>
-<stringAttribute key="location" value="c:\temp\runtime-test-workspace"/>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.core.tests.runtime"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
-<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.core.tests.runtime.AutomatedTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.core.tests.runtime"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="pde.version" value="3.3"/>
-<stringAttribute key="product" value="org.eclipse.platform.ide"/>
-<stringAttribute key="templateConfig" value="${workspace_loc:Configuration/config.ini}"/>
-<booleanAttribute key="tracing" value="false"/>
-<booleanAttribute key="useDefaultConfig" value="true"/>
-<booleanAttribute key="useDefaultConfigArea" value="true"/>
-<booleanAttribute key="useProduct" value="false"/>
-</launchConfiguration>
diff --git a/tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF
deleted file mode 100644
index a7dad5f..0000000
--- a/tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,24 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Eclipse Core Tests Runtime
-Bundle-SymbolicName: org.eclipse.core.tests.runtime; singleton:=true
-Bundle-Version: 3.4.0.qualifier
-Bundle-ClassPath: runtimetests.jar
-Bundle-Activator: org.eclipse.core.tests.runtime.RuntimeTestsPlugin
-Bundle-Vendor: Eclipse.org
-Export-Package: org.eclipse.core.tests.internal.preferences,
- org.eclipse.core.tests.internal.registry,
- org.eclipse.core.tests.internal.runtime,
- org.eclipse.core.tests.runtime,
- org.eclipse.core.tests.runtime.compatibility,
- org.eclipse.core.tests.runtime.content,
- org.eclipse.core.tests.runtime.jobs,
- org.eclipse.core.tests.runtime.model,
- org.eclipse.core.tests.runtime.perf,
- org.eclipse.core.tests.runtime.session
-Require-Bundle: org.eclipse.core.tests.harness;bundle-version="3.4.0",
- org.junit,
- org.eclipse.test.performance;resolution:=optional,
- org.eclipse.core.runtime.compatibility.auth,
- org.eclipse.core.runtime.compatibility
-Eclipse-LazyStart: true
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/A/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/A/META-INF/MANIFEST.MF
deleted file mode 100644
index 333363b..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/A/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,8 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Adaptor dynamic test
-Bundle-SymbolicName: adaptorDynamicTestA;singleton:=true
-Bundle-Version: 1.0.0
-Require-Bundle: org.eclipse.core.runtime
-Eclipse-LazyStart: true
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/A/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/A/plugin.xml
deleted file mode 100644
index 835736b..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/A/plugin.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
-
- <extension
- id="testA"
- point="org.eclipse.core.runtime.adapters">
- <factory class="sampleClassA1" adaptableType="org.eclipse.core.tests.runtime.TestAdaptable">
- <adapter type="abc.SomethingElseA1"/>
- </factory>
- </extension>
-
- <extension point="org.eclipse.core.runtime.adapters">
- <factory class="sampleClass2" adaptableType="org.eclipse.core.tests.runtime.TestAdaptable">
- <adapter type="abc.SomethingElseA2"/>
- </factory>
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/B/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/B/META-INF/MANIFEST.MF
deleted file mode 100644
index cff9808..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/B/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,8 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Adaptor dynamic test
-Bundle-SymbolicName: adaptorDynamicTestB;singleton:=true
-Bundle-Version: 1.0.0
-Require-Bundle: org.eclipse.core.runtime
-Eclipse-LazyStart: true
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/B/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/B/plugin.xml
deleted file mode 100644
index 358b298..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/dynamic/B/plugin.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
-
- <extension
- id="testB"
- point="org.eclipse.core.runtime.adapters">
- <factory class="sampleClassB1" adaptableType="org.eclipse.core.tests.runtime.TestAdaptable">
- <adapter type="abc.SomethingElseB1"/>
- </factory>
- </extension>
-
- <extension point="org.eclipse.core.runtime.adapters">
- <factory class="sampleClassB2" adaptableType="org.eclipse.core.tests.runtime.TestAdaptable">
- <adapter type="abc.SomethingElseB2"/>
- </factory>
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/META-INF/MANIFEST.MF
deleted file mode 100644
index 08001c3..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,9 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: AdapterLoader Test Plug-in
-Bundle-SymbolicName: testAdapter;singleton:=true
-Bundle-Version: 1.0.0
-Require-Bundle: org.eclipse.core.tests.runtime
-Export-Package: testAdapter
-Eclipse-LazyStart: false
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/plugin.xml
deleted file mode 100644
index 13a53f2..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/plugin.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension
- point="org.eclipse.core.tests.runtime.factoryLoaderTest">
- <AdapterClass
- name="testAdapter.testUnknown">
- </AdapterClass>
- </extension>
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/src/testAdapter/testUnknown.java b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/src/testAdapter/testUnknown.java
deleted file mode 100644
index 73c00d1..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/src/testAdapter/testUnknown.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package testAdapter;
-
-public class testUnknown {
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/testAdapter/testUnknown.class b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/testAdapter/testUnknown.class
deleted file mode 100644
index e065ebf..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/adapters/testAdapter_1.0.0/testAdapter/testUnknown.class
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/compatibility/bundle01/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/compatibility/bundle01/plugin.xml
deleted file mode 100644
index 94892f7..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/compatibility/bundle01/plugin.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<!-- no runtime libraries -->
-<plugin
- name="bundle01"
- id="bundle01"
- provider-name="Eclipse.org"
- version="1.0"
- />
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle01/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle01/plugin.xml
deleted file mode 100644
index 5430366..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle01/plugin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- name="org.eclipse.bundle01"
- id="org.eclipse.bundle01"
- version="1.0"
- provider-name="Eclipse.org">
- <extension point="org.eclipse.core.runtime.contentTypes">
- <content-type id="missing" name="Missing"/>
- </extension>
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle02/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle02/plugin.xml
deleted file mode 100644
index 85dbfde..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle02/plugin.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- name="org.eclipse.bundle02"
- id="org.eclipse.bundle02"
- version="1.0"
- provider-name="Eclipse.org">
- <extension point="org.eclipse.core.runtime.contentTypes">
- <content-type id="missing-target" name="Missing alias target"
- file-extensions="missing-target"/>
- </extension>
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle03/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle03/plugin.xml
deleted file mode 100644
index b0f0f90..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle03/plugin.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- name="org.eclipse.bundle03"
- id="org.eclipse.bundle03"
- version="1.0"
- provider-name="Eclipse.org">
- <requires>
- <import plugin="org.eclipse.core.tests.runtime"/>
- </requires>
- <extension point="org.eclipse.core.runtime.contentTypes">
- <!-- this content type has an invalid describer, it should never be picked on content-based content type lookup -->
- <content-type
- name="Invalid Describer"
- id="invalid-describer"
- file-names="invalid.describer"
- describer="a_non_existant_class_expected_to_cause_failure.class"/>
- <content-type
- id="invalid-missing-name"
- file-names="invalid.missing.name"/>
- <content-type
- name="Invalid (Missing identifier)"
- file-names="invalid.missing.identifier"/>
- </extension>
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle04/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle04/plugin.xml
deleted file mode 100644
index 82f8cb8..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/content/bundle04/plugin.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- name="org.eclipse.bundle04"
- id="org.eclipse.bundle04"
- version="1.0"
- provider-name="Eclipse.org">
- <extension point="org.eclipse.core.runtime.contentTypes">
- <content-type id="empty_extension1" name="Empty Extension 1" file-extensions=""/>
- <content-type id="empty_extension2" name="Empty Extension 2" file-extensions="foo,"/>
- <content-type id="empty_extension3" name="Empty Extension 3" file-extensions=",foo"/>
- <content-type id="empty_extension4" name="Empty Extension 4" file-extensions="foo,,bar"/>
- <content-type id="non_empty_extension" name="Non-Empty Extension" file-extensions="non-empty"/>
- </extension>
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator.nl/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator.nl/META-INF/MANIFEST.MF
deleted file mode 100644
index 074ef97..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator.nl/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,6 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: fileLocator test NL Fragment
-Bundle-SymbolicName: fileLocatorTest.nl
-Bundle-Version: 1.0.0
-Fragment-Host: fileLocatorTest;bundle-version="1.0.0"
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator.nl/nl/aa/BB/intro/messages.properties b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator.nl/nl/aa/BB/intro/messages.properties
deleted file mode 100644
index e69de29..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator.nl/nl/aa/BB/intro/messages.properties
+++ /dev/null
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator.nl/nl/aa/intro/messages.properties b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator.nl/nl/aa/intro/messages.properties
deleted file mode 100644
index e69de29..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator.nl/nl/aa/intro/messages.properties
+++ /dev/null
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/META-INF/MANIFEST.MF
deleted file mode 100644
index 65ae065..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,5 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: fileLocator test
-Bundle-SymbolicName: fileLocatorTest
-Bundle-Version: 1.0.0
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/intro/messages.properties b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/intro/messages.properties
deleted file mode 100644
index e69de29..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/intro/messages.properties
+++ /dev/null
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/nl/aa/BB/intro/messages.properties b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/nl/aa/BB/intro/messages.properties
deleted file mode 100644
index e69de29..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/nl/aa/BB/intro/messages.properties
+++ /dev/null
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/nl/aa/intro/messages.properties b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/nl/aa/intro/messages.properties
deleted file mode 100644
index e69de29..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocator/nl/aa/intro/messages.properties
+++ /dev/null
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocatorGetRootFile/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocatorGetRootFile/META-INF/MANIFEST.MF
deleted file mode 100644
index 2505a83..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/fileLocator/testFileLocatorGetRootFile/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,5 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: fileLocator test
-Bundle-SymbolicName: fileLocatorTestGetRootFile
-Bundle-Version: 1.0.0
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/71826/fragmentF/fragment.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/71826/fragmentF/fragment.xml
deleted file mode 100644
index 2a2187f..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/71826/fragmentF/fragment.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<fragment
- id="71826F"
- name="Test71826 Plug-in"
- version="1.0.0"
-
- plugin-id="71826A"
- plugin-version="1.0.0">
-
- <extension point="71826A.xptE" id="F1">
- </extension>
-
-</fragment>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/71826/pluginA/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/71826/pluginA/plugin.xml
deleted file mode 100644
index cb22930..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/71826/pluginA/plugin.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="71826A"
- name="71826A Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension-point id="xptE" name="Label xptE" schema="schema/xptE.exsd"/>
-
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/71826/pluginB/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/71826/pluginB/plugin.xml
deleted file mode 100644
index 1392729..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/71826/pluginB/plugin.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="71826B"
- name="71826B Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension point="71826A.xptE" id="B1">
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/contributors/A/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/contributors/A/plugin.xml
deleted file mode 100644
index 29cfd40..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/contributors/A/plugin.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testContributors"
- name="Test Contributors Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension-point id="xptContibutorsA" name="Label xptContributorsA" schema="schema/xptContributorsA.exsd"/>
-
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/contributors/B/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/contributors/B/META-INF/MANIFEST.MF
deleted file mode 100644
index 7e7a6e9..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/contributors/B/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,8 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Fragment Contributor Test
-Bundle-SymbolicName: FragmentContributorTest; singleton := true
-Bundle-Version: 1.0.0
-Bundle-ClassPath: jar.jar
-Fragment-Host: testContributors;bundle-version="[1.0.0,2.0.0)"
-Bundle-Localization: plugin
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/contributors/B/fragment.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/contributors/B/fragment.xml
deleted file mode 100644
index 9cb747d..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/contributors/B/fragment.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<fragment>
- <extension-point id="contrFragment" name="Contributed by Fragment" schema="schema/fargment.exsd"/>
-
-</fragment>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/A/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/A/plugin.xml
deleted file mode 100644
index ce601cc..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/A/plugin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin id="testByContributorsA" name="Test Elements By Contributors A" version="1.0.0" provider-name="">
- <extension-point id="org.eclipse.test.registryByContrib.PointA"
- name="By Contributors PointA"
- schema="schema/PointA.exsd"/>
- <extension id="org.eclipse.test.registryByContrib.ExtensionA"
- name="Extension A"
- point="org.eclipse.test.registryByContrib.PointA">
- </extension>
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/Afragment/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/Afragment/META-INF/MANIFEST.MF
deleted file mode 100644
index 59f9d05..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/Afragment/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,8 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Fragment Contributor Test
-Bundle-SymbolicName: testByContributorsFragmentA; singleton := true
-Bundle-Version: 1.0.0
-Bundle-ClassPath: jar.jar
-Fragment-Host: testByContributorsA
-Bundle-Localization: plugin
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/Afragment/fragment.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/Afragment/fragment.xml
deleted file mode 100644
index 328c204..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/Afragment/fragment.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<fragment>
- <extension-point id="org.eclipse.test.registryByContrib.PointFA"
- name="By Contributors PointFA"
- schema="schema/PointFA.exsd"/>
- <extension id="org.eclipse.test.registryByContrib.ExtensionFA"
- name="Extension FA"
- point="org.eclipse.test.registryByContrib.PointFA">
- </extension>
-</fragment>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/B/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/B/plugin.xml
deleted file mode 100644
index a299232..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/elementsByContributor/B/plugin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin id="testByContributorsB" name="Test Elements By Contributors B" version="1.0.0" provider-name="">
- <extension-point id="org.eclipse.test.registryByContrib.PointB"
- name="By Contributors PointB"
- schema="schema/PointB.exsd"/>
- <extension id="org.eclipse.test.registryByContrib.ExtensionB"
- name="Extension B"
- point="org.eclipse.test.registryByContrib.PointB">
- </extension>
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/bad/extension/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/bad/extension/plugin.xml
deleted file mode 100644
index 34d966d..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/bad/extension/plugin.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin id="testErrorHandling" name="Test XML Error Handling" version="1.0.0" provider-name="">
-
- <extension-point id="xptErrorTestA" name="Label xptErrorTestA" schema="schema/xptErrorTestA.exsd"/>
-
- <extension point="xptErrorTestA" id="testExtA">
- <test testAttr="valueA">
- </extension>
-
- <extension point="xptErrorTestA" id="testExtB">
- <test testAttr="valueB"> <
- </extension>
-
- <extension point="xptErrorTestA" id="testExtC">
- <test testAttr="valueC">
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/bad/point/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/bad/point/plugin.xml
deleted file mode 100644
index 7449c1e..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/bad/point/plugin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin id="testErrorHandling" name="Test XML Error Handling" version="1.0.0" provider-name="">
-
- <extension-point id="xptErrorTestA" name="Label xptErrorTestA" schema="schema/xptErrorTestA.exsd"/>
-
- <extension-point id="xptErrorTestB" name bad="Label xptErrorTestB"/>
-
- <extension-point id="xptErrorTestB" name="Label xptErrorTestB" schema="schema/xptErrorTestB.exsd"/>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/good/extension/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/good/extension/plugin.xml
deleted file mode 100644
index 2396ea7..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/good/extension/plugin.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin id="testErrorHandling" name="Test XML Error Handling" version="1.0.0" provider-name="">
-
- <extension-point id="xptErrorTestA" name="Label xptErrorTestA" schema="schema/xptErrorTestA.exsd"/>
-
- <extension point="xptErrorTestA" id="testExtA">
- <test testAttr="valueGoodA"/>
- </extension>
-
- <extension point="xptErrorTestA" id="testExtB">
- <test testAttr="valueGoodB"/>
- </extension>
-
- <extension point="xptErrorTestA" id="testExtC">
- <test testAttr="valueGoodC"/>
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/good/point/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/good/point/plugin.xml
deleted file mode 100644
index 8ff17d2..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/errorHandling/good/point/plugin.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin id="testErrorHandling" name="Test XML Error Handling" version="1.0.0" provider-name="">
-
- <extension-point id="xptErrorTestA" name="Label xptErrorTestA" schema="schema/xptErrorTestA.exsd"/>
- <extension-point id="xptErrorTestB" name="Label xptErrorTestB" schema="schema/xptErrorTestB.exsd"/>
-
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/fragmentToNonSingleton/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/fragmentToNonSingleton/META-INF/MANIFEST.MF
deleted file mode 100644
index de8b967..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/fragmentToNonSingleton/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,8 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: FragmentToNonSingleton Fragment
-Bundle-SymbolicName: FragmentToNonSingleton; singleton := true
-Bundle-Version: 1.0.0
-Bundle-ClassPath: FragmentToNonSingleton.jar
-Fragment-Host: NonSingleton;bundle-version="[1.0.0,2.0.0)"
-Bundle-Localization: plugin
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/fragmentToNonSingleton/fragment.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/fragmentToNonSingleton/fragment.xml
deleted file mode 100644
index 992aa6c..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/fragmentToNonSingleton/fragment.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<fragment>
- <extension-point id="Bar" name="bar name" schema="schema/Bar.exsd"/>
-
-</fragment>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingleton/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingleton/META-INF/MANIFEST.MF
deleted file mode 100644
index b3417eb..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingleton/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,9 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: NonSingleton Plug-in
-Bundle-SymbolicName: NonSingleton
-Bundle-Version: 1.0.0
-Bundle-ClassPath: NonSingleton.jar
-Bundle-Localization: plugin
-Eclipse-AutoStart: true
-Require-Bundle: org.eclipse.core.runtime
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingleton/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingleton/plugin.xml
deleted file mode 100644
index c887044..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingleton/plugin.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <extension-point id="ExtensionPoint" name="extension point" schema="schema/ExtensionPoint.exsd"/>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingletonFragment/fragment/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingletonFragment/fragment/META-INF/MANIFEST.MF
deleted file mode 100644
index 5d70242..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingletonFragment/fragment/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,8 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: NonSingletonFragment Fragment
-Bundle-SymbolicName: NonSingletonFragment
-Bundle-Version: 1.0.0
-Bundle-ClassPath: a.jar
-Fragment-Host: Regular;bundle-version="[1.0.0,2.0.0)"
-Bundle-Localization: plugin
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingletonFragment/fragment/fragment.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingletonFragment/fragment/fragment.xml
deleted file mode 100644
index 992aa6c..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingletonFragment/fragment/fragment.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<fragment>
- <extension-point id="Bar" name="bar name" schema="schema/Bar.exsd"/>
-
-</fragment>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingletonFragment/plugin/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingletonFragment/plugin/META-INF/MANIFEST.MF
deleted file mode 100644
index 86cac4f..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/nonSingletonFragment/plugin/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,9 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Regular Plug-in
-Bundle-SymbolicName: Regular; singleton:=true
-Bundle-Version: 1.0.0
-Bundle-ClassPath: NonSingleton.jar
-Bundle-Localization: plugin
-Eclipse-AutoStart: true
-Require-Bundle: org.eclipse.core.runtime
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testA/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testA/plugin.xml
deleted file mode 100644
index c8afd24..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testA/plugin.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testA"
- name="TestA Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension-point id="xptA" name="Label xptA" schema="schema/xptA.exsd"/>
-
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testB/1/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testB/1/plugin.xml
deleted file mode 100644
index 6705192..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testB/1/plugin.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testB1"
- name="TestB1 Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension point="testB2.xptB2" id="ext1">
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testB/2/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testB/2/plugin.xml
deleted file mode 100644
index 85263ba..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testB/2/plugin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testB2"
- name="TestB2 Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension-point id="xptB2" name="Label xptB2" schema="schema/xptB2.exsd"/>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testC/1/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testC/1/plugin.xml
deleted file mode 100644
index a144d9a..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testC/1/plugin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testC1"
- name="TestC1 Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension-point id="xptC1" name="Label xptC1" schema="schema/xptC1.exsd"/>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testC/2/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testC/2/plugin.xml
deleted file mode 100644
index 335a404..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testC/2/plugin.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testC2"
- name="TestC2 Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension point="testC1.xptC1" id="ext1">
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testD/1/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testD/1/plugin.xml
deleted file mode 100644
index 3f01241..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testD/1/plugin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testD1"
- name="TestD1 Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension-point id="xptD1" name="Label xptD1" schema="schema/xptD1.exsd"/>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testD/2/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testD/2/plugin.xml
deleted file mode 100644
index 2cf991f..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testD/2/plugin.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testD2"
- name="TestD2 Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension point="testD1.xptD1" id="ext1">
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testE/1/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testE/1/plugin.xml
deleted file mode 100644
index ac74089..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testE/1/plugin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testE1"
- name="TestE1 Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension-point id="xptE1" name="Label xptE1" schema="schema/xptE1.exsd"/>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testE/2/fragment.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testE/2/fragment.xml
deleted file mode 100644
index 50d2953..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testE/2/fragment.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<fragment
- id="testE2"
- name="TestE2 Plug-in"
- version="1.0.0"
-
- plugin-id="testE1"
- plugin-version="1.0.0">
-
- <extension point="testE1.xptE1" id="ext1">
- </extension>
-
-</fragment>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testF/1/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testF/1/plugin.xml
deleted file mode 100644
index d806541..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testF/1/plugin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testF1"
- name="TesF1 Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension-point id="xptF1" name="Label xptF1" schema="schema/xptF1.exsd"/>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testF/2/fragment.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testF/2/fragment.xml
deleted file mode 100644
index 1851cab..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testF/2/fragment.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<fragment
- id="testF2"
- name="TestF2 Plug-in"
- version="1.0.0"
-
- plugin-id="testF1"
- plugin-version="1.0.0">
-
- <extension point="testF1.xptF1" id="ext1">
- </extension>
-
-</fragment>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testG/1/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testG/1/plugin.xml
deleted file mode 100644
index 7a55ad5..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testG/1/plugin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testG1"
- name="TesG1 Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension-point id="unused" name="unused in tests" schema="schema/xptH1.exsd"/>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testG/2/fragment.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testG/2/fragment.xml
deleted file mode 100644
index 70645da..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testG/2/fragment.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<fragment
- id="testG2"
- name="TestG2 Plug-in"
- version="1.0.0"
-
- plugin-id="testG1"
- plugin-version="1.0.0">
-
- <extension-point id="xptG2" name="Label xptG2" schema="schema/xptG2.exsd"/>
-
-</fragment>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testH/1/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testH/1/plugin.xml
deleted file mode 100644
index 136f57f..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testH/1/plugin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testH1"
- name="TesH1 Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension-point id="xptH1" name="Label xptH1" schema="schema/xptH1.exsd"/>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testH/2/fragment.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testH/2/fragment.xml
deleted file mode 100644
index 8db6037..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testH/2/fragment.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<fragment
- id="testH2"
- name="TestH2 Plug-in"
- version="1.0.0"
-
- plugin-id="testH3"
- plugin-version="1.0.0">
-
- <extension point="testH1.xptH1" id="ext1">
- </extension>
-</fragment>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testH/3/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testH/3/plugin.xml
deleted file mode 100644
index 755d4b8..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testH/3/plugin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testH3"
- name="TesH3 Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension-point id="unused" name="unused in tests" schema="schema/xptH1.exsd"/>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testI/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testI/plugin.xml
deleted file mode 100644
index 14b8e06..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testI/plugin.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testI"
- name="TestI Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension-point id="xptI" name="Label xptI" schema="schema/xptI.exsd"/>
-
- <extension point="xptI" id="ext1">
- <ce level="1">
- value level one
- <ce2 level="2">
- <ce3 level="3">
- <ce4 level="4">
- value level four
- </ce4>
- </ce3>
- <ce3 level="threebis"/>
- </ce2>
- </ce>
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/1/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/1/plugin.xml
deleted file mode 100644
index f1d044b..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/1/plugin.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin id="testNamespace1" name="TestNamespace Plug-in1" version="1.0.0" provider-name="">
-
- <extension-point id="org.abc.xptNS1" name="Label xptNS1" schema="schema/xptNS1.exsd"/>
-
- <extension point="org.abc.xptNS1" id="org.abc.extNS1">
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/2/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/2/plugin.xml
deleted file mode 100644
index cfc5029..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/2/plugin.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin id="testNamespace2" name="TestNamespace Plug-in2" version="1.0.0" provider-name="">
-
- <extension-point id="org.abc.xptNS2" name="Label xptNS2" schema="schema/xptNS2.exsd"/>
-
- <extension point="org.abc.xptNS2" id="org.abc.extNS2">
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DuplicatePoints1.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DuplicatePoints1.xml
deleted file mode 100644
index c7ce8fc..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DuplicatePoints1.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension-point id="testDuplicates.duplicateExtensionPoint" name="Test11" schema="schema.exsd"/>
- <extension
- id="testDuplicates.duplicateExtension"
- point="testDuplicates.duplicateExtensionPoint">
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DuplicatePoints2.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DuplicatePoints2.xml
deleted file mode 100644
index 4f993f7..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DuplicatePoints2.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension-point id="testDuplicates.duplicateExtensionPoint" name="Test21" schema="schema.exsd"/>
- <extension-point id="testDuplicates.nonDuplicateExtensionPoint" name="Test22" schema="schema.exsd"/>
- <extension
- id="testDuplicates.duplicateExtension"
- point="testDuplicates.duplicateExtensionPoint">
- </extension>
- <extension
- id="testDuplicates.nonDuplicateExtension"
- point="testDuplicates.duplicateExtensionPoint">
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DuplicatePointsSame.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DuplicatePointsSame.xml
deleted file mode 100644
index 08694da..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DuplicatePointsSame.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension-point id="testSame.duplicateExtensionPointSame" name="Test31" schema="schema.exsd"/>
- <extension-point id="testSame.duplicateExtensionPointSame" name="Test32" schema="schema.exsd"/>
- <extension
- id="testSame.duplicateExtensionSame"
- point="testSame.duplicateExtensionPointSame">
- </extension>
- <extension
- id="testSame.duplicateExtensionSame"
- point="testSame.duplicateExtensionPointSame">
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DynamicExtension.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DynamicExtension.xml
deleted file mode 100644
index c9fc37b..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/DynamicExtension.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<CitrateSynthase>
-
- <extension-point id="XMLDirectExtPoint" name="XML Extension Point" schema="schema/ExtensionPointTest.exsd"/>
-
- <extension id="XMLDirectExtensionID" name="XML Direct Extension" point="XMLDirectExtPoint">
- <description class="org.eclipse.core.tests.internal.registry.simple.utils.ExecutableRegistryObject"/>
- </extension>
-
-</CitrateSynthase>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/ExecutableExtension.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/ExecutableExtension.xml
deleted file mode 100644
index b031a74..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/ExecutableExtension.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
-
- <extension-point id="XMLExecutableExtPoint" name="Testing XML Executable Extension Point" schema="schema/ExtensionPointTest.exsd"/>
-
- <extension id="TestExeExtensionId" point="XMLExecutableExtPoint">
- <description class="org.eclipse.core.tests.internal.registry.simple.utils.ExecutableRegistryObject"/>
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/Extension.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/Extension.xml
deleted file mode 100644
index 3bdc57d..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/Extension.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <extension id="XMLDirectExtensionID" name="XML Direct Extension" point="XMLDirectExtPoint">
- <StorageDevice deviceURL="theShienneMountain">
- <BackupDevice backupURL="SkyLab"/>
- <BackupDevice backupURL="OceanFloor"/>
- </StorageDevice>
- </extension>
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/ExtensionPoint.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/ExtensionPoint.xml
deleted file mode 100644
index 677a17c..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/ExtensionPoint.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <extension-point id="XMLDirectExtPoint" name="XML Extension Point" schema="schema/ExtensionPointTest.exsd"/>
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/MergeDynamic.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/MergeDynamic.xml
deleted file mode 100644
index 422cfad..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/MergeDynamic.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <extension id="MergeDynamicExt1" name="Contribution merge Dynamic test1" point="MergeStatic">
- <someTag someData="theData">
- </someTag>
- </extension>
-
- <extension id="MergeDynamicExt2" name="Contribution merge Dynamic test2" point="MergeStatic">
- <someTag someData="theData">
- </someTag>
- </extension>
-
- <extension id="MergeDynamicExt3" name="Contribution merge Dynamic test3" point="MergeStatic">
- <someTag someData="theData">
- </someTag>
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/MergeStatic.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/MergeStatic.xml
deleted file mode 100644
index fe73caa..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/MergeStatic.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <extension-point id="MergeStatic" name="Contribution merge test" schema="schema/ExtensionPointTest.exsd"/>
-
- <extension id="MergeStaticExt1" name="Contribution merge test1" point="MergeStatic">
- <someTag someData="theData">
- </someTag>
- </extension>
-
- <extension id="MergeStaticExt2" name="Contribution merge test2" point="MergeStatic">
- <someTag someData="theData">
- </someTag>
- </extension>
-
- <extension id="MergeStaticExt3" name="Contribution merge test3" point="MergeStatic">
- <someTag someData="theData">
- </someTag>
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/RemovalTest.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/RemovalTest.xml
deleted file mode 100644
index fe642bf..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testSimple/RemovalTest.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <extension-point id="PointA" name="Test Point A" schema="schema/schema.exsd"/>
- <extension-point id="PointB" name="Test Point B" schema="schema/schema.exsd"/>
-
- <extension id="TestExtensionA1" point="PointA"></extension>
- <extension id="TestExtensionA2" point="PointA"></extension>
-
- <extension id="TestExtensionB1" point="PointB"></extension>
- <extension id="TestExtensionB2" point="PointB"></extension>
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testStale1/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testStale1/plugin.xml
deleted file mode 100644
index 14dfbf5..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testStale1/plugin.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testStale"
- name="TestStale Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension-point id="xptB2" name="Label xptB2" schema="schema/xptB2.exsd"/>
-
- <extension point="xptB2" id="ext1">
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testStale2/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testStale2/plugin.xml
deleted file mode 100644
index ba13c75..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testStale2/plugin.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="testStale2"
- name="TestStale2 Plug-in"
- version="1.0.0"
- provider-name="">
-
- <extension-point id="xptB2" name="Label xptB2" schema="schema/xptB2.exsd"/>
-
- <extension point="xptB2" id="ext1">
- <myCE name="bar"/>
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle01/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle01/META-INF/MANIFEST.MF
deleted file mode 100644
index 5da7062..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle01/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,3 +0,0 @@
-Bundle-SymbolicName: bundle01
-Bundle-Version: 1.0.0
-
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle01/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle01/plugin.xml
deleted file mode 100644
index f609213..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle01/plugin.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<plugin>
- <extension-point id="xp1" name="Extension Point 1"/>
-</plugin>
\ No newline at end of file
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle02/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle02/META-INF/MANIFEST.MF
deleted file mode 100644
index ed5f6a0..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle02/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,3 +0,0 @@
-Bundle-SymbolicName: bundle02
-Bundle-Version: 1.0.0
-
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle02/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle02/plugin.xml
deleted file mode 100644
index a06c330..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryEvents/bundle02/plugin.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<plugin>
- <extension point="bundle01.xp1" id="ext1">
- <configElement1/>
- <configElement2/>
- <configElement3/>
- </extension>
-</plugin>
\ No newline at end of file
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle01/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle01/META-INF/MANIFEST.MF
deleted file mode 100644
index e2a565a..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle01/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,3 +0,0 @@
-Bundle-SymbolicName: bundle01;singleton=true
-Bundle-Version: 1.0.0
-
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle01/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle01/plugin.xml
deleted file mode 100644
index f609213..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle01/plugin.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<plugin>
- <extension-point id="xp1" name="Extension Point 1"/>
-</plugin>
\ No newline at end of file
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle02/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle02/META-INF/MANIFEST.MF
deleted file mode 100644
index 1b3866e..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle02/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,3 +0,0 @@
-Bundle-SymbolicName: bundle02;singleton=true
-Bundle-Version: 1.0.0
-
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle02/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle02/plugin.xml
deleted file mode 100644
index a06c330..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundle02/plugin.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<plugin>
- <extension point="bundle01.xp1" id="ext1">
- <configElement1/>
- <configElement2/>
- <configElement3/>
- </extension>
-</plugin>
\ No newline at end of file
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundleMultiple/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundleMultiple/META-INF/MANIFEST.MF
deleted file mode 100644
index fd62942..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundleMultiple/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,3 +0,0 @@
-Bundle-SymbolicName: bundleMultiple;singleton=true
-Bundle-Version: 1.0.0
-
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundleMultiple/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundleMultiple/plugin.xml
deleted file mode 100644
index f3e42ba..0000000
--- a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registryListener/bundleMultiple/plugin.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<plugin>
- <extension-point id="xp1" name="Extension Point 1"/>
- <extension-point id="xp2" name="Extension Point 2"/>
-
- <extension point="xp1" id="ext11">
- <configElement1/>
- <configElement2/>
- </extension>
-
- <extension point="xp1" id="ext12">
- <configElement1/>
- <configElement2/>
- </extension>
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/about.html b/tests/org.eclipse.core.tests.runtime/about.html
deleted file mode 100644
index 4602330..0000000
--- a/tests/org.eclipse.core.tests.runtime/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/tests/org.eclipse.core.tests.runtime/build.properties b/tests/org.eclipse.core.tests.runtime/build.properties
deleted file mode 100644
index e5e0eda..0000000
--- a/tests/org.eclipse.core.tests.runtime/build.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.runtimetests.jar = src/
-bin.includes = plugin.xml,\
- *.jar,\
- Plugin_Testing/,\
- about.html,\
- META-INF/,\
- test.xml
-src.includes = about.html
-
diff --git a/tests/org.eclipse.core.tests.runtime/plugin.xml b/tests/org.eclipse.core.tests.runtime/plugin.xml
deleted file mode 100644
index 6a80ed5..0000000
--- a/tests/org.eclipse.core.tests.runtime/plugin.xml
+++ /dev/null
@@ -1,298 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
-
- <extension
- id="test-preferences"
- name="test-preferences"
- point="org.eclipse.core.runtime.preferences">
- <scope
- name="test"
- class="org.eclipse.core.tests.internal.preferences.TestScope"/>
- </extension>
- <extension
- point="org.eclipse.core.runtime.contentTypes">
- <content-type
- name="My Content Type"
- id="myContent"
- file-names=" myContent.mc1 , myContent.mc2 "
- file-extensions=" myContent1, myContent2 "
- describer="org.eclipse.core.tests.runtime.content.MyContentDescriber"/>
- <!-- content types for content/name matching tests -->
- <content-type
- name="BinaryBase"
- id="binary_base"
- file-extensions="mybinary">
- <describer
- class="org.eclipse.core.runtime.content.BinarySignatureDescriber">
- <parameter name="signature" value="0A, 0B"/>
- <parameter name="required" value="false"/>
- </describer>
- </content-type>
- <content-type
- name="BinaryDerived1"
- id="binary_derived1"
- file-names="foo.mybinary"
- file-extensions="mybinary"
- base-type="binary_base">
- <describer
- class="org.eclipse.core.runtime.content.BinarySignatureDescriber">
- <parameter name="signature" value="0A, 0B, 0C"/>
- <parameter name="required" value="false"/>
- </describer>
- </content-type>
- <content-type
- name="BinaryDerived2"
- id="binary_derived2"
- base-type="binary_base">
- <describer
- class="org.eclipse.core.runtime.content.BinarySignatureDescriber">
- <parameter name="signature" value="0A, 0B, 0D"/>
- <parameter name="required" value="false"/>
- </describer>
- </content-type>
- <!-- A base type and a sub-type are in conflict. Sub type should be picked. -->
- <content-type
- file-extensions="conflict1"
- name="Conflict 1"
- id="base_conflict1"/>
- <content-type
- base-type="base_conflict1"
- name="Specialized Conflict 1"
- id="sub_conflict1"/>
- <!--
- A base type and a sub-type (that restates file-spec) are in conflict.
- Base type still should be picked.
- -->
- <content-type
- file-extensions="conflict2"
- name="Conflict 2"
- id="base_conflict2"/>
- <content-type
- base-type="base_conflict2"
- file-extensions="conflict2"
- name="Specialized Conflict 2"
- id="sub_conflict2"/>
- <!--
- Two unrelated types (sub_conflict3 and unrelated conflict3) are in conflict.
- Order will be arbitrary.
- -->
- <content-type
- id="base_conflict3"
- file-extensions="base_conflict3"
- name="Conflict 3"/>
- <content-type
- id="sub_conflict3"
- base-type="base_conflict3"
- file-extensions="conflict3"
- name="Deeper Conflict 3"/>
- <content-type
- id="unrelated_conflict3"
- file-extensions="conflict3"
- name="Unrelated Conflict 3"/>
- <!-- end of conflict-related content types -->
- <content-type
- file-extensions="tzt"
- name="My Text"
- id="mytext">
- <property name="property1" default="value1"/>
- <!-- declares property for documentation purposes only -->
- <property name="property2"/>
- <property name="property3" default="value3"/>
- <!-- overrides (non-local) parent property definition -->
- <property name="org.eclipse.core.runtime.charset" default="BAR"/>
- </content-type>
- <content-type
- base-type="mytext"
- file-extensions="tzt1"
- name="My Text1"
- id="mytext1">
- <!-- overrides parent property definition by assigning a default value -->
- <property name="property2" default="value2"/>
- <!-- overrides parent property definition by clearing the default value -->
- <property name="property3"/>
- <property name="property4" default="value4"/>
- </content-type>
- <!-- overrides parent charset definition by clearing the default value -->
- <!-- Here we really want to use the deprecated way for defining charsets. -->
- <content-type
- base-type="mytext"
- file-extensions="tzt2"
- default-charset=""
- name="My Text2"
- id="mytext2">
- <property name="property1"/>
- <property name="property2"/>
- <property name="property3"/>
- <property name="property4"/>
- <!-- Use a local property name clashing with an inherited one -->
- <property name="charset" default="mytext2"/>
- </content-type>
- <content-type
- file-names="foo.bar"
- file-extensions="bar"
- name="Foo Bar"
- id="fooBar"/>
- <content-type
- base-type="fooBar"
- name="Sub Foo Bar"
- id="subFooBar"/>
- <content-type
- file-extensions="xml2"
- base-type="org.eclipse.core.runtime.xml"
- name="XML Based with Different Extension"
- id="xml-based-different-extension">
- </content-type>
- <content-type
- file-names="xml-based.xml"
- base-type="org.eclipse.core.runtime.xml"
- name="XML Based with Specific Name"
- id="xml-based-specific-name"/>
- <content-type
- file-extensions="samplebin1"
- name="Sample Binary 1"
- id="sample-binary1">
- <describer
- class="org.eclipse.core.runtime.content.BinarySignatureDescriber">
- <parameter name="signature" value="10, AB, CD, FF"/>
- <parameter name="offset" value="5"/>
- </describer>
- </content-type>
- <content-type
- file-extensions="samplebin2"
- name="Sample Binary 2"
- id="sample-binary2">
- <describer
- class="org.eclipse.core.runtime.content.BinarySignatureDescriber">
- <parameter name="signature" value="10, AB, CD, EF"/>
- </describer>
- </content-type>
- <content-type
- file-extensions="class"
- name="Java Class file"
- id="javaClass">
- <describer
- class="org.eclipse.core.runtime.content.BinarySignatureDescriber">
- <parameter name="signature" value="CA, FE, BA, BE"/>
- </describer>
- </content-type>
-
- <!-- content types for association tests -->
- <content-type
- id="assoc1"
- name="Association Test 1"
- base-type="org.eclipse.core.runtime.text"
- describer="org.eclipse.core.tests.runtime.content.NaySayerContentDescriber"/>
- <content-type
- id="assoc2"
- name="Association Test 2"
- base-type="org.eclipse.core.runtime.text"
- file-extensions="txt_assoc2builtin"
- describer="org.eclipse.core.tests.runtime.content.NaySayerContentDescriber"/>
- <file-association
- file-extensions="txt_assoc1pluginadded"
- content-type="org.eclipse.core.tests.runtime.assoc1"/>
- <file-association
- file-extensions="txt_assoc2pluginadded"
- content-type="org.eclipse.core.tests.runtime.assoc2"/>
- <file-association
- file-extensions="txt_pluginadded"
- content-type="org.eclipse.core.runtime.text"/>
-
- <!-- content types for orphan tests -->
- <content-type
- file-names="foo.orphan"
- file-extensions="orphan"
- base-type="org.eclipse.bundle01.missing"
- name="Orphan Type"
- id="orphan"/>
- <file-association
- file-extensions="orphan2"
- content-type="org.eclipse.bundle01.missing"/>
- <!-- content types for alias tests -->
- <content-type
- id="alias"
- name="Alias Type"
- file-extensions="missing-target"
- alias-for="org.eclipse.bundle02.missing-target"/>
- <content-type
- id="derived-from-alias"
- name="Derived from Alias Type"
- base-type="alias"/>
- <!-- content types for content describer tests -->
- <content-type
- base-type="org.eclipse.core.runtime.xml"
- name="Root Element"
- id="root-element"
- describer="org.eclipse.core.runtime.content.XMLRootElementContentDescriber:org.eclipse.core.runtime.tests.root-element"/>
- <content-type
- base-type="org.eclipse.core.runtime.xml"
- name="Root Element in namespace"
- id="ns-root-element">
- <describer
- class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber2">
- <parameter name="element" value="{urn:eclipse.core.runtime.ns1}rootElement1"/>
- <parameter name="element" value="{urn:eclipse.core.runtime.ns2}rootElement2"/>
- </describer>
- </content-type>
- <content-type
- base-type="org.eclipse.core.runtime.xml"
- name="Wildcard element in namespace"
- id="ns-wildcard">
- <describer
- class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber2">
- <parameter name="element" value="*/org.eclipse.core.runtime.tests.some.dtd3"/>
- <parameter name="element" value="{urn:eclipse.core.runtime.nsWild}*"/>
- </describer>
- </content-type>
- <content-type
- base-type="org.eclipse.core.runtime.xml"
- id="empty-ns-root-element"
- name="Root Element in empty namespace">
- <describer
- class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber2">
- <parameter
- name="element"
- value="{}rootElement">
- </parameter>
- </describer>
- </content-type>
- <content-type
- base-type="org.eclipse.core.runtime.xml"
- name="DTD"
- id="dtd">
- <describer
- class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber">
- <parameter name="dtd" value="org.eclipse.core.runtime.tests.some.dtd"/>
- </describer>
- </content-type>
- <!-- this content type is used by the content description tests -->
- <content-type
- name="Void content type"
- id="void"/>
- <content-type
- base-type="org.eclipse.core.runtime.xml"
- file-extensions="xml2"
- id="xml-based-different-extension-low-priority"
- name="XML Based with Different Extension and Low Priority"
- priority="low">
- </content-type>
- </extension>
- <extension
- point="org.eclipse.core.runtime.adapters">
- <factory
- class="org.eclipse.core.tests.runtime.TestAdapterFactory"
- adaptableType="org.eclipse.core.tests.runtime.TestAdaptable">
- <adapter
- type="org.eclipse.core.tests.runtime.TestAdapter">
- </adapter>
- </factory>
- </extension>
- <extension-point id="factoryLoaderTest" name="factoryLoaderTest" schema="schema/factoryLoaderTest.exsd"/>
- <extension point="org.eclipse.core.runtime.adapters">
- <factory class="org.eclipse.core.tests.runtime.TestAdapterFactoryLoader"
- adaptableType="org.eclipse.core.tests.runtime.TestAdaptable">
- <adapter type="testAdapter.testUnknown"/>
- </factory>
- </extension>
-</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/schema/factoryLoaderTest.exsd b/tests/org.eclipse.core.tests.runtime/schema/factoryLoaderTest.exsd
deleted file mode 100644
index 8ec220c..0000000
--- a/tests/org.eclipse.core.tests.runtime/schema/factoryLoaderTest.exsd
+++ /dev/null
@@ -1,94 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="adaptorFactoryA">
-<annotation>
- <appInfo>
- <meta.schema plugin="adaptorFactoryA" id="factoryLoaderTest" name="factoryLoaderTest"/>
- </appInfo>
- <documentation>
- [Enter description of this extension point.]
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="AdapterClass"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="AdapterClass">
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- [Enter the first release in which this extension point appears.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
-
-</schema>
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/AllTests.java
deleted file mode 100644
index f8e2ef4..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/AllTests.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.preferences;
-
-import junit.framework.*;
-
-public class AllTests extends TestCase {
- /**
- * AllTests constructor comment.
- * @param name java.lang.String
- */
- public AllTests() {
- super(null);
- }
-
- /**
- * AllTests constructor comment.
- * @param name java.lang.String
- */
- public AllTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AllTests.class.getName());
- suite.addTest(EclipsePreferencesTest.suite());
- suite.addTest(PreferencesServiceTest.suite());
- suite.addTest(IScopeContextTest.suite());
- suite.addTest(ListenerRegistryTest.suite());
- return suite;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/EclipsePreferencesTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/EclipsePreferencesTest.java
deleted file mode 100644
index af0cfaf..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/EclipsePreferencesTest.java
+++ /dev/null
@@ -1,1225 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.preferences;
-
-import java.io.*;
-import java.util.*;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.internal.preferences.EclipsePreferences;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.preferences.*;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-import org.osgi.framework.Bundle;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * Test suite for API class org.eclipse.core.runtime.Preferences
- */
-public class EclipsePreferencesTest extends RuntimeTest {
-
- class NodeTracer implements IEclipsePreferences.INodeChangeListener {
- StringBuffer log = new StringBuffer();
-
- public void added(IEclipsePreferences.NodeChangeEvent event) {
- log.append("[A:");
- log.append(event.getParent().absolutePath());
- log.append(',');
- log.append(event.getChild().absolutePath());
- log.append(']');
- }
-
- public void removed(IEclipsePreferences.NodeChangeEvent event) {
- log.append("[R:");
- log.append(event.getParent().absolutePath());
- log.append(',');
- log.append(event.getChild().absolutePath());
- log.append(']');
- }
- }
-
- class PreferenceTracer implements IEclipsePreferences.IPreferenceChangeListener {
- public StringBuffer log = new StringBuffer();
-
- private String typeCode(Object value) {
- if (value == null)
- return "";
- if (value instanceof Boolean)
- return "B";
- if (value instanceof Integer)
- return "I";
- if (value instanceof Long)
- return "L";
- if (value instanceof Float)
- return "F";
- if (value instanceof Double)
- return "D";
- if (value instanceof String)
- return "S";
- if (value instanceof byte[])
- return "b";
- assertTrue("0.0: " + value, false);
- return null;
- }
-
- public void preferenceChange(IEclipsePreferences.PreferenceChangeEvent event) {
- log.append("[");
- log.append(event.getKey());
- log.append(":");
- log.append(typeCode(event.getOldValue()));
- log.append(event.getOldValue() == null ? "null" : event.getOldValue());
- log.append("->");
- log.append(typeCode(event.getNewValue()));
- log.append(event.getNewValue() == null ? "null" : event.getNewValue());
- log.append("]");
- }
- }
-
- public EclipsePreferencesTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- // all test methods are named "test..."
- return new TestSuite(EclipsePreferencesTest.class);
- // TestSuite suite = new TestSuite();
- // suite.addTest(new EclipsePreferencesTest("testFileFormat"));
- // return suite;
- }
-
- private IEclipsePreferences getScopeRoot() {
- return (IEclipsePreferences) Platform.getPreferencesService().getRootNode().node(TestScope.SCOPE);
- }
-
- public void testString() {
- String qualifier = getUniqueString();
- Preferences prefs = getScopeRoot().node(qualifier);
- final String key = "key1";
- final String defaultValue = null;
- final String[] values = {"", "hello", " x ", "\n"};
-
- try {
-
- // nothing there so expect the default
- assertEquals("1.1", defaultValue, prefs.get(key, defaultValue));
-
- // try for each value in the set
- for (int i = 0; i < values.length; i++) {
- String v1 = values[i];
- String v2 = values[i] + "x";
- prefs.put(key, v1);
- assertEquals("1.2." + i, v1, prefs.get(key, defaultValue));
- prefs.put(key, v2);
- assertEquals("1.3." + i, v2, prefs.get(key, defaultValue));
- prefs.remove(key);
- assertEquals("1.4." + i, defaultValue, prefs.get(key, defaultValue));
- }
-
- // spec'd to throw a NPE if key is null
- try {
- prefs.get(null, defaultValue);
- fail("1.5.0");
- } catch (NullPointerException e) {
- // expected
- }
-
- // spec'd to throw a NPE if key is null
- try {
- prefs.put(null, defaultValue);
- fail("1.5.1");
- } catch (NullPointerException e) {
- // expected
- }
-
- // spec'd to throw a NPE if value is null
- try {
- prefs.put(key, null);
- fail("1.5.2");
- } catch (NullPointerException e) {
- // expected
- }
- } finally {
- // clean-up
- try {
- prefs.removeNode();
- } catch (BackingStoreException e) {
- fail("0.99", e);
- }
- }
-
- // spec'd to throw IllegalStateException if node has been removed
- try {
- prefs.get(key, defaultValue);
- fail("1.6");
- } catch (IllegalStateException e) {
- // expected
- }
- }
-
- public void testLong() {
- String qualifier = getUniqueString();
- Preferences prefs = getScopeRoot().node(qualifier);
- final String key = "key1";
- final long defaultValue = 42L;
- final long[] values = {-12345L, 0L, 12345L, Long.MAX_VALUE, Long.MIN_VALUE};
-
- try {
-
- // nothing there so expect the default
- assertEquals("1.1", defaultValue, prefs.getLong(key, defaultValue));
-
- // try for each value in the set
- for (int i = 0; i < values.length; i++) {
- long v1 = values[i];
- long v2 = 54L;
- prefs.putLong(key, v1);
- assertEquals("1.2." + i, v1, prefs.getLong(key, defaultValue));
- prefs.putLong(key, v2);
- assertEquals("1.3." + i, v2, prefs.getLong(key, defaultValue));
- prefs.remove(key);
- assertEquals("1.4." + i, defaultValue, prefs.getLong(key, defaultValue));
- }
-
- String stringValue = "foo";
- prefs.put(key, stringValue);
- assertEquals("1.5", stringValue, prefs.get(key, null));
- assertEquals("1.6", defaultValue, prefs.getLong(key, defaultValue));
-
- // spec'd to throw a NPE if key is null
- try {
- prefs.getLong(null, defaultValue);
- fail("2.0");
- } catch (NullPointerException e) {
- // expected
- }
-
- // spec'd to throw a NPE if key is null
- try {
- prefs.putLong(null, defaultValue);
- fail("2.1");
- } catch (NullPointerException e) {
- // expected
- }
- } finally {
- // clean-up
- try {
- prefs.removeNode();
- } catch (BackingStoreException e) {
- fail("0.99", e);
- }
- }
-
- // spec'd to throw IllegalStateException if node has been removed
- try {
- prefs.getLong(key, defaultValue);
- fail("3.0");
- } catch (IllegalStateException e) {
- // expected
- }
- }
-
- public void testBoolean() {
- String qualifier = getUniqueString();
- Preferences prefs = getScopeRoot().node(qualifier);
- final String key = "key1";
- final boolean defaultValue = false;
-
- try {
-
- // nothing there so expect the default
- assertEquals("1.1", defaultValue, prefs.getBoolean(key, defaultValue));
-
- prefs.putBoolean(key, true);
- assertEquals("1.2", true, prefs.getBoolean(key, defaultValue));
- prefs.putBoolean(key, false);
- assertEquals("1.3", false, prefs.getBoolean(key, defaultValue));
- prefs.remove(key);
- assertEquals("1.4", defaultValue, prefs.getBoolean(key, defaultValue));
-
- String stringValue = "foo";
- prefs.put(key, stringValue);
- assertEquals("1.5", stringValue, prefs.get(key, null));
- assertEquals("1.6", defaultValue, prefs.getBoolean(key, defaultValue));
-
- // spec'd to throw a NPE if key is null
- try {
- prefs.getBoolean(null, defaultValue);
- fail("2.0");
- } catch (NullPointerException e) {
- // expected
- }
-
- // spec'd to throw a NPE if key is null
- try {
- prefs.putBoolean(null, defaultValue);
- fail("2.1");
- } catch (NullPointerException e) {
- // expected
- }
- } finally {
- // clean-up
- try {
- prefs.removeNode();
- } catch (BackingStoreException e) {
- fail("0.99", e);
- }
- }
-
- // spec'd to throw IllegalStateException if node has been removed
- try {
- prefs.getBoolean(key, defaultValue);
- fail("3.0");
- } catch (IllegalStateException e) {
- // expected
- }
- }
-
- private byte[][] getByteValues() {
- ArrayList result = new ArrayList();
- result.add(new byte[0]);
- result.add(new byte[] {127});
- result.add(new byte[] {-128});
- result.add(new byte[] {0});
- result.add(new byte[] {5});
- result.add(new byte[] {-23});
- return (byte[][]) result.toArray(new byte[result.size()][]);
- }
-
- public void testBytes() {
- String qualifier = getUniqueString();
- Preferences prefs = getScopeRoot().node(qualifier);
- final String key = "key1";
- final byte[] defaultValue = new byte[] {42};
- final byte[][] values = getByteValues();
-
- try {
-
- // nothing there so expect the default
- assertEquals("1.1", defaultValue, prefs.getByteArray(key, defaultValue));
-
- // try for each value in the set
- for (int i = 0; i < values.length; i++) {
- byte[] v1 = values[i];
- byte[] v2 = new byte[] {54};
- prefs.putByteArray(key, v1);
- assertEquals("1.2." + i, v1, prefs.getByteArray(key, defaultValue));
- prefs.putByteArray(key, v2);
- assertEquals("1.3." + i, v2, prefs.getByteArray(key, defaultValue));
- prefs.remove(key);
- assertEquals("1.4." + i, defaultValue, prefs.getByteArray(key, defaultValue));
- }
-
- // spec'd to throw a NPE if key is null
- try {
- prefs.getByteArray(null, defaultValue);
- fail("2.0");
- } catch (NullPointerException e) {
- // expected
- }
-
- // spec'd to throw a NPE if key is null
- try {
- prefs.putByteArray(null, defaultValue);
- fail("2.1");
- } catch (NullPointerException e) {
- // expected
- }
-
- // spec'd to throw a NPE if key is null
- try {
- prefs.putByteArray(key, null);
- fail("2.2");
- } catch (NullPointerException e) {
- // expected
- }
- } finally {
- // clean-up
- try {
- prefs.removeNode();
- } catch (BackingStoreException e) {
- fail("0.99", e);
- }
- }
-
- // spec'd to throw IllegalStateException if node has been removed
- try {
- prefs.getByteArray(key, defaultValue);
- fail("3.0");
- } catch (IllegalStateException e) {
- // expected
- }
- }
-
- public void testFloat() {
- String qualifier = getUniqueString();
- Preferences prefs = getScopeRoot().node(qualifier);
- final String key = "key1";
- final float defaultValue = 42f;
- final float[] values = {-12345f, 0f, 12345f, Float.MAX_VALUE, Float.MIN_VALUE};
- final float tol = 1.0e-20f;
-
- try {
-
- // nothing there so expect the default
- assertEquals("1.1", defaultValue, prefs.getFloat(key, defaultValue), tol);
-
- // try for each value in the set
- for (int i = 0; i < values.length; i++) {
- float v1 = values[i];
- float v2 = 54f;
- prefs.putFloat(key, v1);
- assertEquals("1.2." + i, v1, prefs.getFloat(key, defaultValue), tol);
- prefs.putFloat(key, v2);
- assertEquals("1.3." + i, v2, prefs.getFloat(key, defaultValue), tol);
- prefs.remove(key);
- assertEquals("1.4." + i, defaultValue, prefs.getFloat(key, defaultValue), tol);
- }
-
- String stringValue = "foo";
- prefs.put(key, stringValue);
- assertEquals("1.5", stringValue, prefs.get(key, null));
- assertEquals("1.6", defaultValue, prefs.getFloat(key, defaultValue), tol);
-
- // spec'd to throw a NPE if key is null
- try {
- prefs.getFloat(null, defaultValue);
- fail("2.0");
- } catch (NullPointerException e) {
- // expected
- }
-
- // spec'd to throw a NPE if key is null
- try {
- prefs.putFloat(null, defaultValue);
- fail("2.1");
- } catch (NullPointerException e) {
- // expected
- }
- } finally {
- // clean-up
- try {
- prefs.removeNode();
- } catch (BackingStoreException e) {
- fail("0.99", e);
- }
- }
-
- // spec'd to throw IllegalStateException if node has been removed
- try {
- prefs.getFloat(key, defaultValue);
- fail("3.0");
- } catch (IllegalStateException e) {
- // expected
- }
- }
-
- public void testDouble() {
- String qualifier = getUniqueString();
- Preferences prefs = getScopeRoot().node(qualifier);
- final String key = "key1";
- final double defaultValue = 42.0;
- final double[] values = {0.0, 1002.5, -201788.55, Double.MAX_VALUE, Double.MIN_VALUE};
- final double tol = 1.0e-20;
-
- try {
-
- // nothing there so expect the default
- assertEquals("1.1", defaultValue, prefs.getDouble(key, defaultValue), tol);
-
- // try for each value in the set
- for (int i = 0; i < values.length; i++) {
- double v1 = values[i];
- double v2 = 54.0;
- prefs.putDouble(key, v1);
- assertEquals("1.2." + i, v1, prefs.getDouble(key, defaultValue), tol);
- prefs.putDouble(key, v2);
- assertEquals("1.3." + i, v2, prefs.getDouble(key, defaultValue), tol);
- prefs.remove(key);
- assertEquals("1.4." + i, defaultValue, prefs.getDouble(key, defaultValue), tol);
- }
-
- String stringValue = "foo";
- prefs.put(key, stringValue);
- assertEquals("1.5", stringValue, prefs.get(key, null));
- assertEquals("1.6", defaultValue, prefs.getDouble(key, defaultValue), tol);
-
- // spec'd to throw a NPE if key is null
- try {
- prefs.getDouble(null, defaultValue);
- fail("2.0");
- } catch (NullPointerException e) {
- // expected
- }
-
- // spec'd to throw a NPE if key is null
- try {
- prefs.putDouble(null, defaultValue);
- fail("2.1");
- } catch (NullPointerException e) {
- // expected
- }
- } finally {
- // clean-up
- try {
- prefs.removeNode();
- } catch (BackingStoreException e) {
- fail("0.99", e);
- }
- }
-
- // spec'd to throw IllegalStateException if node has been removed
- try {
- prefs.getDouble(key, defaultValue);
- fail("3.0");
- } catch (IllegalStateException e) {
- // expected
- }
- }
-
- public void testInt() {
- String qualifier = getUniqueString();
- Preferences prefs = getScopeRoot().node(qualifier);
- final String key = "key1";
- final int defaultValue = 42;
- final int[] values = {0, 1002, -201788, Integer.MAX_VALUE, Integer.MIN_VALUE};
-
- try {
-
- // nothing there so expect the default
- assertEquals("1.1", defaultValue, prefs.getInt(key, defaultValue));
-
- // try for each value in the set
- for (int i = 0; i < values.length; i++) {
- int v1 = values[i];
- int v2 = 54;
- prefs.putInt(key, v1);
- assertEquals("1.2." + i, v1, prefs.getInt(key, defaultValue));
- prefs.putInt(key, v2);
- assertEquals("1.3." + i, v2, prefs.getInt(key, defaultValue));
- prefs.remove(key);
- assertEquals("1.4." + i, defaultValue, prefs.getInt(key, defaultValue));
- }
-
- String stringValue = "foo";
- prefs.put(key, stringValue);
- assertEquals("1.5", stringValue, prefs.get(key, null));
- assertEquals("1.6", defaultValue, prefs.getInt(key, defaultValue));
-
- // spec'd to throw a NPE if key is null
- try {
- prefs.getInt(null, defaultValue);
- fail("2.0");
- } catch (NullPointerException e) {
- // expected
- }
-
- // spec'd to throw a NPE if key is null
- try {
- prefs.putInt(null, defaultValue);
- fail("2.1");
- } catch (NullPointerException e) {
- // expected
- }
- } finally {
- // clean-up
- try {
- prefs.removeNode();
- } catch (BackingStoreException e) {
- fail("0.99", e);
- }
- }
-
- // spec'd to throw IllegalStateException if node has been removed
- try {
- prefs.getInt(key, defaultValue);
- fail("3.0");
- } catch (IllegalStateException e) {
- // expected
- }
- }
-
- public void testRemoveNode() {
- Preferences root = getScopeRoot();
- ArrayList list = new ArrayList();
- for (int i = 0; i < 5; i++)
- list.add(root.node(getUniqueString()));
-
- // all exist
- for (Iterator i = list.iterator(); i.hasNext();) {
- Preferences node = (Preferences) i.next();
- try {
- assertTrue("1." + i, node.nodeExists(""));
- } catch (BackingStoreException e) {
- fail("1.99." + i, e);
- }
- }
-
- // remove each
- for (Iterator i = list.iterator(); i.hasNext();) {
- Preferences node = (Preferences) i.next();
- try {
- node.removeNode();
- assertTrue("2." + i, !node.nodeExists(""));
- } catch (BackingStoreException e) {
- fail("2.99." + i, e);
- }
- }
- }
-
- public void testName() {
- Preferences node = Platform.getPreferencesService().getRootNode();
-
- assertEquals("1.0", "", node.name());
- node = node.node(TestScope.SCOPE);
- assertEquals("2.0", TestScope.SCOPE, node.name());
- node = node.node("foo");
- assertEquals("3.0", "foo", node.name());
- }
-
- public void testNode() {
- Preferences node = Platform.getPreferencesService().getRootNode();
-
- // root node
- assertNotNull("1.0", node);
- assertEquals("1.1", "", node.name());
- assertEquals("1.2", "/", node.absolutePath());
- // Bug 57150 [runtime] prefs: root.node("/") should return root
- assertEquals("1.3", node, node.node("/"));
-
- // scope root
- node = node.node(TestScope.SCOPE);
- assertNotNull("2.0", node);
- assertEquals("2.1", TestScope.SCOPE, node.name());
- assertEquals("2.2", "/" + TestScope.SCOPE, node.absolutePath());
-
- // child
- String name = getUniqueString();
- node = node.node(name);
- assertNotNull("3.0", node);
- assertEquals("3.1", name, node.name());
- assertEquals("3.2", "/" + TestScope.SCOPE + "/" + name, node.absolutePath());
- }
-
- public void testParent() {
- // parent of the root is null
- assertNull("1.0", Platform.getPreferencesService().getRootNode().parent());
-
- // parent of the scope root is the root
- Preferences node = Platform.getPreferencesService().getRootNode().node(TestScope.SCOPE);
- Preferences parent = node.parent();
- assertEquals("2.0", "/", parent.absolutePath());
-
- // parent of a child is the scope root
- node = getScopeRoot().node(getUniqueString());
- parent = node.parent();
- assertEquals("2.0", "/" + TestScope.SCOPE, parent.absolutePath());
- }
-
- public void testKeys() {
- String[] keys = new String[] {"foo", "bar", "quux"};
- Preferences node = getScopeRoot().node(getUniqueString());
-
- // ensure nothing exists to begin with
- for (int i = 0; i < keys.length; i++) {
- String key = keys[i];
- assertNull("1.0." + i, node.get(key, null));
- }
-
- // set all keys
- for (int i = 0; i < keys.length; i++) {
- String key = keys[i];
- node.put(key, getUniqueString());
- }
-
- // get the key list
- try {
- String[] result = node.keys();
- assertEquals("2.0", keys, result, false);
- } catch (BackingStoreException e) {
- fail("0.99", e);
- }
- }
-
- private void assertEquals(String message, byte[] one, byte[] two) {
- if (one == null && two == null)
- return;
- if (one == two)
- return;
- assertNotNull(message + ".1", one);
- assertNotNull(message + ".2", two);
- assertEquals(message + ".3", one.length, two.length);
- for (int i = 0; i < one.length; i++)
- assertEquals(message + ".4." + i, one[i], two[i]);
- }
-
- public void testChildrenNames() {
- String[] childrenNames = new String[] {"foo", "bar", "quux"};
- Preferences node = getScopeRoot().node(getUniqueString());
- String[] result = null;
-
- // no children to start
- try {
- result = node.childrenNames();
- } catch (BackingStoreException e) {
- fail("1.0", e);
- }
- assertEquals("1.1", 0, result.length);
-
- // add children
- for (int i = 0; i < childrenNames.length; i++)
- node.node(childrenNames[i]);
- try {
- result = node.childrenNames();
- } catch (BackingStoreException e) {
- fail("2.0", e);
- }
- assertEquals("2.1", childrenNames, result, false);
-
- }
-
- public void testNodeExists() {
- Preferences parent = null;
- Preferences node = Platform.getPreferencesService().getRootNode();
- String[] childrenNames = new String[] {"foo", "bar", "quux"};
- String fake = "fake";
-
- // check the root node
- try {
- assertTrue("1.0", node.nodeExists(""));
- assertTrue("1.1", !node.nodeExists(fake));
- } catch (BackingStoreException e) {
- fail("1.99", e);
- }
-
- // check the scope root
- parent = node;
- node = getScopeRoot();
- try {
- assertTrue("2.0", parent.nodeExists(node.name()));
- assertTrue("2.1", node.nodeExists(""));
- assertTrue("2.2", !parent.nodeExists(fake));
- assertTrue("2.3", !node.nodeExists(fake));
- } catch (BackingStoreException e) {
- fail("2.99", e);
- }
-
- // check a child
- parent = node;
- node = parent.node(getUniqueString());
- try {
- assertTrue("3.0", parent.nodeExists(node.name()));
- assertTrue("3.1", node.nodeExists(""));
- assertTrue("3.2", !parent.nodeExists(fake));
- assertTrue("3.3", !node.nodeExists(fake));
- } catch (BackingStoreException e) {
- fail("3.99", e);
- }
-
- // create some more children and check
- parent = node;
- Preferences[] nodes = new Preferences[childrenNames.length];
- for (int i = 0; i < childrenNames.length; i++)
- nodes[i] = parent.node(childrenNames[i]);
- for (int i = 0; i < childrenNames.length; i++)
- try {
- assertTrue("4.0", parent.nodeExists(childrenNames[i]));
- assertTrue("4.1", !parent.nodeExists(fake));
- } catch (BackingStoreException e) {
- fail("4.99", e);
- }
- for (int i = 0; i < nodes.length; i++)
- try {
- assertTrue("4.2", nodes[i].nodeExists(""));
- } catch (BackingStoreException e) {
- fail("4.100", e);
- }
-
- // remove children and check
- for (int i = 0; i < nodes.length; i++) {
- try {
- nodes[i].removeNode();
- assertTrue("5.1", !parent.nodeExists(nodes[i].name()));
- assertTrue("5.2", !nodes[i].nodeExists(""));
- } catch (BackingStoreException e) {
- fail("5.99", e);
- }
- }
- }
-
- public void testClear() {
- Preferences node = getScopeRoot().node(getUniqueString());
- String[] keys = new String[] {"foo", "bar", "quux"};
- String[] values = new String[] {getUniqueString(), getUniqueString(), getUniqueString()};
-
- // none to start with
- try {
- assertEquals("1.0", 0, node.keys().length);
- } catch (BackingStoreException e) {
- fail("1.99", e);
- }
-
- // fill the node up with values
- try {
- for (int i = 0; i < keys.length; i++)
- node.put(keys[i], values[i]);
- assertEquals("2.0", keys.length, node.keys().length);
- assertEquals("2.1", keys, node.keys(), false);
- } catch (BackingStoreException e) {
- fail("2.99", e);
- }
-
- // clear the values and check
- try {
- node.clear();
- assertEquals("3.0", 0, node.keys().length);
- for (int i = 0; i < keys.length; i++)
- assertNull("3.1." + i, node.get(keys[i], null));
- } catch (BackingStoreException e) {
- fail("3.99", e);
- }
- }
-
- public void testAbsolutePath() {
- IPath expected = Path.ROOT;
- Preferences node = Platform.getPreferencesService().getRootNode();
-
- // root node
- assertEquals("1.0", expected.toString(), node.absolutePath());
-
- // scope root
- expected = expected.append(TestScope.SCOPE);
- node = node.node(TestScope.SCOPE);
- assertEquals("2.0", expected.toString(), node.absolutePath());
-
- // another child
- String name = getUniqueString();
- expected = expected.append(name);
- node = node.node(name);
- assertEquals("3.0", expected.toString(), node.absolutePath());
- }
-
- public void testAccept() {
- IEclipsePreferences scopeRoot = getScopeRoot();
- ArrayList expected = new ArrayList();
- final ArrayList actual = new ArrayList();
-
- IPreferenceNodeVisitor visitor = new IPreferenceNodeVisitor() {
- public boolean visit(IEclipsePreferences node) {
- actual.add(node.absolutePath());
- return true;
- }
- };
-
- // just the scope root
- try {
- scopeRoot.accept(visitor);
- } catch (BackingStoreException e) {
- fail("0.99", e);
- }
- expected.add(scopeRoot.absolutePath());
- assertEquals("0.1", expected.toArray(new String[0]), actual.toArray(new String[0]), false);
-
- Set children = new HashSet();
- children.add(getUniqueString());
- children.add(getUniqueString());
- children.add(getUniqueString());
-
- // visit some children nodes
- actual.clear();
- expected.clear();
- expected.add(scopeRoot.absolutePath());
- for (Iterator i = children.iterator(); i.hasNext();) {
- String s = (String) i.next();
- expected.add(scopeRoot.absolutePath() + '/' + s);
- scopeRoot.node(s);
- }
- try {
- scopeRoot.accept(visitor);
- } catch (BackingStoreException e) {
- fail("1.99", e);
- }
- assertEquals("1.0", expected.toArray(new String[0]), actual.toArray(new String[0]), false);
- }
-
- public void testPreferenceChangeListeners() {
- IEclipsePreferences node = getScopeRoot();
- PreferenceTracer tracer = new PreferenceTracer();
- node.addPreferenceChangeListener(tracer);
-
- String key = "foo";
-
- // initial state
- assertEquals("0.0", "", tracer.log.toString());
-
- // add preference (string value)
- node.put(key, "bar");
- String string = node.get(key, null);
- assertNotNull("1.0", string);
- assertEquals("1.1", "bar", string);
- assertEquals("1.2", "[foo:null->Sbar]", tracer.log.toString());
-
- // change its value
- tracer.log.setLength(0);
- node.put(key, "quux");
- string = node.get(key, null);
- assertNotNull("2.0", string);
- assertEquals("2.1", "quux", string);
- assertEquals("2.2", "[foo:Sbar->Squux]", tracer.log.toString());
-
- // change its type - should have no effect (events are strings)
- tracer.log.setLength(0);
- node.putInt(key, 123);
- int i = node.getInt(key, 0);
- assertEquals("3.0", 123, i);
- assertEquals("3.1", "[foo:Squux->S123]", tracer.log.toString());
-
- node.put(key, "aaa");
- tracer.log.setLength(0);
- node.remove(key);
- assertNull("4.0", node.get(key, null));
- assertEquals("4.1", "[foo:Saaa->null]", tracer.log.toString());
-
- // TODO finish these
- }
-
- public void testNodeChangeListeners() {
- IEclipsePreferences root = getScopeRoot();
- NodeTracer tracer = new NodeTracer();
- root.addNodeChangeListener(tracer);
-
- // initial state
- assertEquals("0.0", "", tracer.log.toString());
-
- // add a child
- String name = getUniqueString();
- IPath parent = new Path(root.absolutePath());
- IPath child = parent.append(name);
- Preferences node = root.node(name);
- assertEquals("1.0", "[A:" + parent + ',' + child + ']', tracer.log.toString());
-
- // remove the child
- tracer.log.setLength(0);
- try {
- node.removeNode();
- assertEquals("2.0", "[R:" + parent + ',' + child + ']', tracer.log.toString());
- } catch (BackingStoreException e) {
- fail("2.99", e);
- }
-
- // remove the listener and make sure we don't get any changes
- root.removeNodeChangeListener(tracer);
- tracer.log.setLength(0);
- root.node(name);
- assertEquals("3.0", "", tracer.log.toString());
- }
-
- /*
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- Preferences node = getScopeRoot();
- node.removeNode();
- }
-
- /*
- * Regression test for bug 56020 - [runtime] prefs: converted preferences not restored on second session
- */
- public void testLegacy() {
-
- String pluginID = "org.eclipse.core.tests.preferences." + getUniqueString();
- String key = "key." + getUniqueString();
- String value = "value." + getUniqueString();
- String OLD_PREFS_FILENAME = "pref_store.ini";
-
- // create fake plug-in and store 2.1 format tests in legacy location
- Bundle runtimeBundle = Platform.getBundle(Platform.PI_RUNTIME);
- if (runtimeBundle == null)
- return;
- String runtimeStateLocation = Platform.getStateLocation(runtimeBundle).toString();
- IPath pluginStateLocation = new Path(runtimeStateLocation.replaceAll(Platform.PI_RUNTIME, pluginID));
- IPath oldFile = pluginStateLocation.append(OLD_PREFS_FILENAME);
- Properties oldProperties = new Properties();
- oldProperties.put(key, value);
- OutputStream output = null;
- try {
- oldFile.toFile().getParentFile().mkdirs();
- output = new BufferedOutputStream(new FileOutputStream(oldFile.toFile()));
- oldProperties.store(output, null);
- } catch (IOException e) {
- fail("1.0", e);
- } finally {
- if (output != null)
- try {
- output.close();
- } catch (IOException e) {
- // ignore
- }
- }
-
- // access fake plug-in via new preferences APIs which should invoke conversion
- Preferences node = Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(pluginID);
-
- // ensure values are in the workspace
- String actual = node.get(key, null);
- assertEquals("3.0", value, actual);
-
- // ensure the values have been flushed to disk
- // first indication is the new file exists on disk.
- IPath newFile = InternalPlatform.getDefault().getMetaArea().getStateLocation(Platform.PI_RUNTIME);
- newFile = newFile.append(EclipsePreferences.DEFAULT_PREFERENCES_DIRNAME).append(pluginID).addFileExtension(EclipsePreferences.PREFS_FILE_EXTENSION);
- assertTrue("4.0", newFile.toFile().exists());
- // then check to see if the value is in the file
- Properties newProperties = loadProperties(newFile);
- actual = newProperties.getProperty(key);
- assertEquals("4.2", value, actual);
- }
-
- /*
- * Bug 60590 - Flush on dirty child settings node fails if parent clean.
- *
- * After changing a preference value, we call #makeDirty which does a
- * recursive call marking itself dirty as well as all its parents. As a short
- * circuit, if a parent was already dirty then it stopped the recursion.
- *
- * Unfortuanatly the #makeClean method only marks the load level as
- * clean and not all children since it doesn't know which child triggered
- * the dirtiness.
- *
- * Changed the makeDirty call to mark all parent nodes as dirty.
- */
- public void test_60590() {
- IEclipsePreferences root = Platform.getPreferencesService().getRootNode();
- String one = getUniqueString();
- String two = getUniqueString();
- String threeA = getUniqueString();
- String threeB = getUniqueString();
- String key = "key";
- String value = "value";
- Preferences node = root.node(TestScope.SCOPE).node(one).node(two).node(threeA);
- node.put(key, value);
- try {
- node.flush();
- } catch (BackingStoreException e) {
- fail("1.99", e);
- }
- node = root.node(TestScope.SCOPE).node(one).node(two).node(threeB);
- node.put(key, value);
- Preferences current = node;
- int count = 0;
- while (current != null && current instanceof TestScope) {
- assertTrue("1.0." + current.absolutePath(), ((TestScope) current).isDirty());
- count++;
- current = current.parent();
- }
- assertTrue("2.0." + count, count == 4);
- }
-
- /*
- * Bug 55410 - [runtime] prefs: keys and valid chars
- */
- public void test_55410() {
- String[] keys = new String[] {"my/key", "my:key", "my/long:key"};
- String[] paths = new String[] {"my/path", "my:path"};
- Preferences node = Platform.getPreferencesService().getRootNode().node(TestScope.SCOPE).node(getUniqueString());
-
- // test keys
- for (int i = 0; i < keys.length; i++) {
- String key = keys[i];
- String value = getUniqueString();
- node.put(key, value);
- assertEquals("1.0." + key, value, node.get(key, null));
- }
-
- // test paths
- String root = node.absolutePath();
- for (int i = 0; i < paths.length; i++) {
- String path = paths[i];
- String expected = root + IPath.SEPARATOR + path;
- String actual = node.node(path).absolutePath();
- assertEquals("2.0." + path, expected, actual);
- }
- }
-
- public void testFileFormat() {
- class Info {
-
- String path;
- String key;
- String encoded;
-
- Info(String path, String key, String encoded) {
- this.path = path;
- this.key = key;
- this.encoded = encoded;
- }
- }
-
- ArrayList list = new ArrayList();
- list.add(new Info("", "a", "a"));
- list.add(new Info("", "/a", "///a"));
- list.add(new Info("a", "b", "a/b"));
- list.add(new Info("a/b", "c/d", "a/b//c/d"));
- list.add(new Info("", "a//b", "//a//b"));
- list.add(new Info("a/b", "c", "a/b/c"));
- list.add(new Info("a/b", "c//d", "a/b//c//d"));
-
- Preferences node = new TestScope().getNode(getUniqueString());
- for (int i = 0; i < list.size(); i++) {
- Info info = (Info) list.get(i);
- node.node(info.path).put(info.key, Integer.toString(i));
- }
-
- if (!(node instanceof TestScope))
- return;
-
- Properties properties = null;
- try {
- properties = ((TestScope) node).toProperties();
- } catch (BackingStoreException e) {
- fail("1.0", e);
- }
-
- for (Iterator i = properties.keySet().iterator(); i.hasNext();) {
- String key = (String) i.next();
- String value = properties.getProperty(key);
- try {
- Info info = (Info) list.get(Integer.parseInt(value));
- assertNotNull("2.0", info);
- assertEquals("2.1." + key, info.encoded, key);
- } catch (NumberFormatException e) {
- fail("2.99." + value, e);
- }
- }
- }
-
- private Properties loadProperties(IPath location) {
- Properties result = new Properties();
- if (!location.toFile().exists())
- return result;
- InputStream input = null;
- try {
- input = new FileInputStream(location.toFile());
- result.load(input);
- } catch (IOException e) {
- fail("loadProperties", e);
- } finally {
- if (input != null)
- try {
- input.close();
- } catch (IOException e) {
- // ignore
- }
- }
- return result;
- }
-
- public void testEncodePath() {
- class Item {
- String path, key, expected;
-
- Item(String path, String key, String expected) {
- super();
- this.path = path;
- this.key = key;
- this.expected = expected;
- }
- }
-
- ArrayList list = new ArrayList();
- list.add(new Item(null, "a", "a"));
- list.add(new Item(null, "/a", "///a"));
- list.add(new Item("a", "b", "a/b"));
- list.add(new Item("a/b", "c/d", "a/b//c/d"));
- list.add(new Item("a", "b//c", "a//b//c"));
- list.add(new Item("repositories", "cvs://dev.eclipse.org:25/cvsroot", "repositories//cvs://dev.eclipse.org:25/cvsroot"));
- list.add(new Item("repositories:cvs", "dev.eclipse.org:25", "repositories:cvs/dev.eclipse.org:25"));
-
- for (Iterator i = list.iterator(); i.hasNext();) {
- Item item = (Item) i.next();
- assertEquals("a" + i + item.expected, item.expected, EclipsePreferences.encodePath(item.path, item.key));
- String[] result = EclipsePreferences.decodePath(item.expected);
- assertEquals("b" + i + item.path, item.path, result[0]);
- assertEquals("c" + i + item.key, item.key, result[1]);
- }
- }
-
- public void testGetSegment() {
- String[][] data = new String[][] {new String[] {"instance", "/instance/foo", "0"}, //
- new String[] {"instance", "instance/foo", "0"}, //
- new String[] {"instance", "instance", "0"}, //
- new String[] {"instance", "instance", "0"}, //
- new String[] {"foo", "/instance/foo", "1"}, //
- new String[] {"foo", "instance/foo", "1"}, //
- new String[] {"foo", "/instance/foo/", "1"}, //
- new String[] {"foo", "instance/foo/", "1"}, //
- new String[] {"foo", "/instance/foo/bar", "1"}, //
- new String[] {null, "/instance", "1"}, //
- new String[] {null, "instance", "1"}, //
- new String[] {null, "instance/", "1"}, //
- };
- for (int i = 0; i < data.length; i++) {
- String[] line = data[i];
- assertEquals("1.0." + i + ':' + line[1] + " (" + line[2] + ')', line[0], EclipsePreferences.getSegment(line[1], Integer.parseInt(line[2])));
- }
- }
-
- public void testGetSegmentCount() {
- String[][] data = new String[][] {new String[] {"/instance/foo", "2"}, //
- new String[] {"instance/foo", "2"}, //
- new String[] {"/instance/foo/", "2"}, //
- new String[] {"/instance", "1"}, //
- new String[] {"instance", "1"}, //
- new String[] {"/instance/", "1"}, //
- new String[] {"instance/", "1"}, //
- };
- for (int i = 0; i < data.length; i++) {
- String[] line = data[i];
- assertEquals("1.0:" + line[0], Integer.parseInt(line[1]), EclipsePreferences.getSegmentCount(line[0]));
- }
- }
-
- public void test_68897() {
- File file = getRandomLocation().toFile();
- IPreferencesService service = Platform.getPreferencesService();
-
- IEclipsePreferences rootPreferences = service.getRootNode();
- Preferences pref = rootPreferences.node("/favorite");
-
- Preferences child = pref.node("my");
- child.put("file", "my.txt");
- try {
- child.flush();
- pref.flush();
- rootPreferences.flush();
- } catch (BackingStoreException e) {
- fail("0.0", e);
- }
- try {
- service.exportPreferences(rootPreferences, new FileOutputStream(file), (String[]) null);
- } catch (FileNotFoundException e) {
- fail("1.0", e);
- } catch (CoreException e) {
- fail("1.1", e);
- }
- try {
- IExportedPreferences epref = service.readPreferences(new FileInputStream(file));
- service.applyPreferences(epref);
- } catch (FileNotFoundException e) {
- fail("2.0", e);
- } catch (CoreException e) {
- fail("2.1", e);
- } catch (Exception e) {
- fail("2.2", e);
- }
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/IScopeContextTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/IScopeContextTest.java
deleted file mode 100644
index 1625adf..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/IScopeContextTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.preferences;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * @since 3.0
- */
-public class IScopeContextTest extends RuntimeTest {
-
- public IScopeContextTest() {
- super("");
- }
-
- public IScopeContextTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- // all test methods are named "test..."
- return new TestSuite(IScopeContextTest.class);
- // TestSuite suite = new TestSuite();
- // suite.addTest(new IScopeContextTest("test"));
- // return suite;
- }
-
- public void testGetNode() {
- IScopeContext context = new InstanceScope();
-
- // null
- try {
- context.getNode(null);
- fail("1.0");
- } catch (IllegalArgumentException e) {
- // expected
- }
-
- // valid single segment
- String qualifier = Long.toString(System.currentTimeMillis());
- Preferences node = context.getNode(qualifier);
- assertNotNull("2.0", node);
- String expected = "/instance/" + qualifier;
- String actual = node.absolutePath();
- assertEquals("2.1", expected, actual);
-
- // path
- qualifier = new Path(Long.toString(System.currentTimeMillis())).append("a").toString();
- node = context.getNode(qualifier);
- assertNotNull("3.0", node);
- expected = "/instance/" + qualifier;
- actual = node.absolutePath();
- assertEquals("3.1", expected, actual);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/ListenerRegistryTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/ListenerRegistryTest.java
deleted file mode 100644
index 2d8902b..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/ListenerRegistryTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.preferences;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.internal.preferences.ListenerRegistry;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-
-/**
- * @since 3.1
- */
-public class ListenerRegistryTest extends RuntimeTest {
-
- public ListenerRegistryTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(ListenerRegistryTest.class);
- // TestSuite suite = new TestSuite();
- // suite.addTest(new ListenerRegistryTest("test"));
- // return suite;
- }
-
- public void test() {
- ListenerRegistry registry = new ListenerRegistry();
- String key = "/my/path";
-
- // empty
- Object[] listeners = registry.getListeners(key);
- assertNotNull("1.0", listeners);
- assertEquals("1.1", 0, listeners.length);
-
- // add a listener
- Object myListener = new Object();
- registry.add(key, myListener);
- listeners = registry.getListeners(key);
- assertNotNull("2.0", listeners);
- assertEquals("2.1", 1, listeners.length);
- assertSame("2.2", myListener, listeners[0]);
-
- // remove it
- registry.remove(key, myListener);
- listeners = registry.getListeners(key);
- assertNotNull("3.0", listeners);
- assertEquals("3.1", 0, listeners.length);
-
- // add two
- Object myOtherListener = new Object();
- registry.add(key, myListener);
- registry.add(key, myOtherListener);
- listeners = registry.getListeners(key);
- assertNotNull("4.0", listeners);
- assertEquals("4.1", 2, listeners.length);
- assertTrue("4.2", myListener == listeners[0] || myListener == listeners[1]);
- assertTrue("4.3", myOtherListener == listeners[0] || myOtherListener == listeners[1]);
-
- // remove one
- registry.remove(key, myListener);
- listeners = registry.getListeners(key);
- assertNotNull("5.0", listeners);
- assertEquals("5.1", 1, listeners.length);
- assertSame("5.2", myOtherListener, listeners[0]);
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/PreferencesServiceTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/PreferencesServiceTest.java
deleted file mode 100644
index 0d2d098..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/PreferencesServiceTest.java
+++ /dev/null
@@ -1,1083 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.preferences;
-
-import java.io.*;
-import java.util.*;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.internal.preferences.EclipsePreferences;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.preferences.*;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * @since 3.0
- */
-public class PreferencesServiceTest extends RuntimeTest {
-
- class ExportVerifier {
-
- private IEclipsePreferences node;
- private ByteArrayOutputStream output;
- private Set expected;
- private String[] excludes;
- private IPreferenceFilter[] transfers;
- private boolean useTransfers;
-
- public ExportVerifier(IEclipsePreferences node, String[] excludes) {
- super();
- this.node = node;
- this.excludes = excludes;
- this.expected = new HashSet();
- }
-
- public ExportVerifier(IEclipsePreferences node, IPreferenceFilter[] transfers) {
- super();
- this.node = node;
- this.transfers = transfers;
- this.expected = new HashSet();
- this.useTransfers = true;
- }
-
- void addExpected(String path, String key) {
- this.expected.add(EclipsePreferences.encodePath(path, key));
- }
-
- void addVersion() {
- expected.add("file_export_version");
- }
-
- void setExcludes(String[] excludes) {
- this.excludes = excludes;
- }
-
- void addExportRoot(IEclipsePreferences root) {
- expected.add('!' + root.absolutePath());
- }
-
- void verify() {
- IPreferencesService service = Platform.getPreferencesService();
- this.output = new ByteArrayOutputStream();
- try {
- if (useTransfers)
- service.exportPreferences(node, transfers, output);
- else
- service.exportPreferences(node, output, excludes);
- } catch (CoreException e) {
- fail("0.0", e);
- }
- ByteArrayInputStream input = new ByteArrayInputStream(output.toByteArray());
- Properties properties = new Properties();
- try {
- properties.load(input);
- } catch (IOException e) {
- fail("1.0", e);
- } finally {
- try {
- input.close();
- } catch (IOException e) {
- // ignore
- }
- }
-
- if (properties.isEmpty()) {
- assertTrue("2.0", expected.isEmpty());
- return;
- }
- assertEquals("3.0", expected.size(), properties.size());
- for (Iterator i = expected.iterator(); i.hasNext();) {
- String key = (String) i.next();
- assertNotNull("4.0." + key, properties.get(key));
- }
- }
- }
-
- public PreferencesServiceTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- // all test methods are named "test..."
- return new TestSuite(PreferencesServiceTest.class);
- // TestSuite suite = new TestSuite();
- // suite.addTest(new PreferencesServiceTest("testValidateVersions"));
- // return suite;
- }
-
- public void testImportExportBasic() {
- IPreferencesService service = Platform.getPreferencesService();
-
- // create test node hierarchy
- String qualifier = getUniqueString() + '1';
- IEclipsePreferences test = new TestScope().getNode(qualifier);
- String key = getUniqueString() + 'k';
- String value = getUniqueString() + 'v';
- String key1 = "http://eclipse.org:24";
- String value1 = getUniqueString() + "v1";
- String actual = test.get(key, null);
- assertNull("1.0", actual);
- test.put(key, value);
- test.put(key1, value1);
- actual = test.get(key, null);
- assertEquals("1.1", value, actual);
- actual = test.get(key1, null);
- assertEquals("1.2", value1, actual);
-
- // export it
- ByteArrayOutputStream output = new ByteArrayOutputStream();
- try {
- service.exportPreferences(test, output, (String[]) null);
- } catch (CoreException e) {
- fail("2.0", e);
- } finally {
- try {
- output.close();
- } catch (IOException e1) {
- // ignore
- }
- }
- byte[] bytes = output.toByteArray();
-
- // add new values
- String newKey = getUniqueString() + '3';
- String newValue = getUniqueString() + '4';
- actual = test.get(newKey, null);
- assertNull("3.0", actual);
- test.put(newKey, newValue);
- actual = test.get(newKey, null);
- assertEquals("3.1", newValue, actual);
- String newOldValue = getUniqueString() + '5';
- test.put(key, newOldValue);
- actual = test.get(key, null);
- assertEquals("3.2", newOldValue, actual);
-
- // import
- ByteArrayInputStream input = new ByteArrayInputStream(bytes);
- try {
- service.importPreferences(input);
- } catch (CoreException e) {
- fail("4.0", e);
- } finally {
- try {
- input.close();
- } catch (IOException e) {
- // ignore
- }
- }
-
- // verify
- test = new TestScope().getNode(qualifier);
- actual = test.get(key, null);
- assertEquals("5.0", value, actual);
- actual = test.get(key1, null);
- assertEquals("5.1", value1, actual);
- actual = test.get(newKey, null);
- assertNull("5.2", actual);
- // ensure that the node isn't dirty (has been saved after the import)
- assertTrue("5.3", test instanceof TestScope);
- assertTrue("5.4", !((TestScope) test).isDirty());
-
- // clear all
- try {
- test.clear();
- } catch (BackingStoreException e) {
- fail("6.0", e);
- }
- actual = test.get(key, null);
- assertNull("6.1", actual);
- actual = test.get(key1, null);
- assertNull("6.2", actual);
- actual = test.get(newKey, null);
- assertNull("6.3", actual);
-
- // import
- input = new ByteArrayInputStream(bytes);
- try {
- service.importPreferences(input);
- } catch (CoreException e) {
- fail("7.0", e);
- } finally {
- try {
- input.close();
- } catch (IOException e) {
- // ignore
- }
- }
-
- // verify
- test = new TestScope().getNode(qualifier);
- actual = test.get(key, null);
- assertEquals("8.0", value, actual);
- actual = test.get(key1, null);
- assertEquals("8.1", value1, actual);
- actual = test.get(newKey, null);
- assertNull("8.2", actual);
- }
-
- private void assertEquals(String message, String[] one, String[] two) {
- if (one == null && two == null)
- return;
- if (one == two)
- return;
- assertNotNull(message + ".1", one);
- assertNotNull(message + ".2", two);
- assertEquals(message + ".3", one.length, two.length);
- for (int i = 0; i < one.length; i++)
- assertEquals(message + ".4." + i, one[i], two[i]);
- }
-
- public void testLookupOrder() {
- IPreferencesService service = Platform.getPreferencesService();
- String[] defaultOrder = new String[] {"project", //$NON-NLS-1$
- InstanceScope.SCOPE, //
- ConfigurationScope.SCOPE, //
- DefaultScope.SCOPE};
- String[] fullOrder = new String[] {"a", "b", "c"};
- String[] nullKeyOrder = new String[] {"e", "f", "g"};
- String qualifier = getUniqueString();
- String key = getUniqueString();
-
- // bogus set parms
- try {
- service.setDefaultLookupOrder(null, key, fullOrder);
- fail("0.0");
- } catch (IllegalArgumentException e) {
- // expected
- }
- try {
- service.setDefaultLookupOrder(qualifier, key, new String[] {"a", null, "b"});
- fail("0.1");
- } catch (IllegalArgumentException e) {
- // expected
- }
-
- // nothing set
- String[] order = service.getDefaultLookupOrder(qualifier, key);
- assertNull("1.0", order);
- order = service.getLookupOrder(qualifier, key);
- assertNotNull("1.1", order);
- assertEquals("1.2", defaultOrder, order);
-
- order = service.getDefaultLookupOrder(qualifier, null);
- assertNull("1.3", order);
- order = service.getLookupOrder(qualifier, null);
- assertNotNull("1.4", order);
- assertEquals("1.5", defaultOrder, order);
-
- // set for qualifier/key
- service.setDefaultLookupOrder(qualifier, key, fullOrder);
- order = service.getDefaultLookupOrder(qualifier, key);
- assertNotNull("2.2", order);
- assertEquals("2.3", fullOrder, order);
- order = service.getLookupOrder(qualifier, key);
- assertNotNull("2.4", order);
- assertEquals("2.5", fullOrder, order);
-
- // nothing set for qualifier/null
- order = service.getDefaultLookupOrder(qualifier, null);
- assertNull("3.0", order);
- order = service.getLookupOrder(qualifier, null);
- assertNotNull("3.1", order);
- assertEquals("3.2", defaultOrder, order);
-
- // set for qualifier/null
- service.setDefaultLookupOrder(qualifier, null, nullKeyOrder);
- order = service.getDefaultLookupOrder(qualifier, null);
- assertNotNull("4.0", order);
- assertEquals("4.1", nullKeyOrder, order);
- order = service.getLookupOrder(qualifier, null);
- assertNotNull("4.2", order);
- assertEquals("4.3", nullKeyOrder, order);
- order = service.getDefaultLookupOrder(qualifier, key);
- assertNotNull("4.4", order);
- assertEquals("4.5", fullOrder, order);
- order = service.getLookupOrder(qualifier, key);
- assertNotNull("4.6", order);
- assertEquals("4.7", fullOrder, order);
-
- // clear qualifier/key (find qualifier/null)
- service.setDefaultLookupOrder(qualifier, key, null);
- order = service.getDefaultLookupOrder(qualifier, key);
- assertNull("5.0", order);
- order = service.getLookupOrder(qualifier, key);
- assertNotNull("5.1", order);
- assertEquals("5.2", nullKeyOrder, order);
-
- // clear qualifier/null (find returns default-default)
- service.setDefaultLookupOrder(qualifier, null, null);
- order = service.getDefaultLookupOrder(qualifier, key);
- assertNull("6.0", order);
- order = service.getLookupOrder(qualifier, key);
- assertNotNull("6.1", order);
- assertEquals("6.2", defaultOrder, order);
-
- order = service.getDefaultLookupOrder(qualifier, null);
- assertNull("6.3", order);
- order = service.getLookupOrder(qualifier, null);
- assertNotNull("6.4", order);
- assertEquals("6.5", defaultOrder, order);
- }
-
- public void testGetWithNodes() {
- IPreferencesService service = Platform.getPreferencesService();
- String qualifier = getUniqueString();
- String key = getUniqueString();
- String expected = getUniqueString();
-
- // nothing set - navigation
- Preferences node = service.getRootNode().node(TestScope.SCOPE).node(qualifier);
- String actual = node.get(key, null);
- assertNull("10", actual);
-
- // nothing set - service searching
- actual = service.get(key, null, new Preferences[] {node});
- assertNull("2.0", actual);
-
- // set value
- node.put(key, expected);
-
- // value is set - navigation
- actual = node.get(key, null);
- assertNotNull("3.0", actual);
- assertEquals("3.1", expected, actual);
-
- // value is set - service searching
- actual = service.get(key, null, new Preferences[] {node});
- assertNotNull("4.0", actual);
- assertEquals("4.1", expected, actual);
-
- // return default value if node list is null
- actual = service.get(key, null, null);
- assertNull("5.0", actual);
-
- // skip over null nodes
- actual = service.get(key, null, new Preferences[] {null, node});
- assertNotNull("6.0", actual);
- assertEquals("6.1", expected, actual);
-
- // set the value in the default scope as well
- Preferences defaultNode = service.getRootNode().node(DefaultScope.SCOPE).node(qualifier);
- String defaultValue = getUniqueString();
- defaultNode.put(key, defaultValue);
- actual = defaultNode.get(key, null);
- assertNotNull("7.0", actual);
- assertEquals("7.1", defaultValue, actual);
-
- // pass in both nodes
- actual = service.get(key, null, new Preferences[] {node, defaultNode});
- assertNotNull("8.0", actual);
- assertEquals("8.1", expected, actual);
- // skip nulls
- actual = service.get(key, null, new Preferences[] {null, node, null, defaultNode, null});
- assertNotNull("8.2", actual);
- assertEquals("8.3", expected, actual);
- // reverse the order
- actual = service.get(key, null, new Preferences[] {defaultNode, node});
- assertNotNull("8.4", actual);
- assertEquals("8.5", defaultValue, actual);
- // skip nulls
- actual = service.get(key, null, new Preferences[] {null, null, defaultNode, null, node, null});
- assertNotNull("8.6", actual);
- assertEquals("8.7", defaultValue, actual);
- }
-
- public void testSearchingStringBasics() {
- IPreferencesService service = Platform.getPreferencesService();
- String qualifier = getUniqueString();
- String key = getUniqueString();
- Preferences node = service.getRootNode().node(TestScope.SCOPE).node(qualifier);
- Preferences defaultNode = service.getRootNode().node(DefaultScope.SCOPE).node(qualifier);
- String value = getUniqueString();
- String defaultValue = getUniqueString() + '1';
- String actual = null;
-
- ArrayList list = new ArrayList();
- list.add(null);
- list.add(new IScopeContext[] {});
- list.add(new IScopeContext[] {null});
- list.add(new IScopeContext[] {new TestScope()});
- list.add(new IScopeContext[] {new TestScope(), new DefaultScope()});
- list.add(new IScopeContext[] {new DefaultScope(), new TestScope()});
- list.add(new IScopeContext[] {new DefaultScope()});
- IScopeContext[][] contexts = (IScopeContext[][]) list.toArray(new IScopeContext[list.size()][]);
-
- // nothing is set
- for (int i = 0; i < contexts.length; i++) {
- actual = service.getString(qualifier, key, null, contexts[i]);
- assertNull("1.0." + i, actual);
- }
-
- // set a default value
- defaultNode.put(key, defaultValue);
- actual = defaultNode.get(key, null);
- assertNotNull("2.0", actual);
- assertEquals("2.1", defaultValue, actual);
-
- // should find it because "default" is in the default-default lookup order
- for (int i = 0; i < contexts.length; i++) {
- actual = service.getString(qualifier, key, null, contexts[i]);
- assertNotNull("3.0." + i, actual);
- assertEquals("3.1." + i, defaultValue, actual);
- }
-
- // set a real value
- node.put(key, value);
- actual = node.get(key, null);
- assertNotNull("4.0", actual);
- assertEquals("4.1", value, actual);
-
- // should find the default value since the "test" scope isn't in the lookup order
- for (int i = 0; i < contexts.length; i++) {
- actual = service.getString(qualifier, key, null, contexts[i]);
- assertNotNull("5.0." + i, actual);
- assertEquals("5.1." + i, defaultValue, actual);
- }
-
- // set the lookup order for qualifier/null
- String[] setOrder = new String[] {TestScope.SCOPE, DefaultScope.SCOPE};
- service.setDefaultLookupOrder(qualifier, null, setOrder);
- String[] order = service.getLookupOrder(qualifier, null);
- assertNotNull("6.0", order);
- assertEquals("6.1", setOrder, order);
-
- // get the value, should be the real one
- for (int i = 0; i < contexts.length; i++) {
- actual = service.getString(qualifier, key, null, contexts[i]);
- assertNotNull("7.0." + i, actual);
- assertEquals("7.1." + i, value, actual);
- }
-
- // set the order to be the reverse for the qualifier/key
- setOrder = new String[] {DefaultScope.SCOPE, TestScope.SCOPE};
- service.setDefaultLookupOrder(qualifier, key, setOrder);
- order = service.getLookupOrder(qualifier, key);
- assertNotNull("8.0", order);
- assertEquals("8.1", setOrder, order);
-
- // get the value, should be the default one
- for (int i = 0; i < contexts.length; i++) {
- actual = service.getString(qualifier, key, null, contexts[i]);
- assertNotNull("9.0." + i, actual);
- assertEquals("9.1." + i, defaultValue, actual);
- }
- }
-
- /*
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- Platform.getPreferencesService().getRootNode().node(TestScope.SCOPE).removeNode();
- }
-
- public void testGet() {
- IPreferencesService service = Platform.getPreferencesService();
- String qualifier = getUniqueString();
- Preferences node = service.getRootNode().node(TestScope.SCOPE).node(qualifier);
- service.setDefaultLookupOrder(qualifier, null, new String[] {TestScope.SCOPE});
-
- // fun with paths
-
- String searchPath = "a";
- node.put("a", searchPath);
- assertEquals("3.0", searchPath, service.getString(qualifier, searchPath, null, null));
-
- searchPath = "a/b";
- node.node("a").put("b", searchPath);
- assertEquals("4.0", searchPath, service.getString(qualifier, searchPath, null, null));
-
- searchPath = "a//b";
- node.node("a").put("b", searchPath);
- assertEquals("5.0", searchPath, service.getString(qualifier, searchPath, null, null));
-
- searchPath = "a/b//c";
- node.node("a").node("b").put("c", searchPath);
- assertEquals("6.0", searchPath, service.getString(qualifier, searchPath, null, null));
-
- searchPath = "a/b//c/d";
- node.node("a").node("b").put("c/d", searchPath);
- assertEquals("7.0", searchPath, service.getString(qualifier, searchPath, null, null));
-
- searchPath = "/a";
- node.put("a", searchPath);
- assertEquals("8.0", searchPath, service.getString(qualifier, searchPath, null, null));
-
- searchPath = "/a/b";
- node.node("a").put("b", searchPath);
- assertEquals("9.0", searchPath, service.getString(qualifier, searchPath, null, null));
-
- searchPath = "///a";
- node.put("/a", searchPath);
- assertEquals("10.0", searchPath, service.getString(qualifier, searchPath, null, null));
- }
-
- public void testImportExceptions() {
- // importing an empty file is an error (invalid file format)
- IPreferencesService service = Platform.getPreferencesService();
- InputStream input = new BufferedInputStream(new ByteArrayInputStream(new byte[0]));
- try {
- service.importPreferences(input);
- fail("0.0");
- } catch (CoreException e) {
- // expected
- }
- }
-
- public void testImportLegacy() {
- IPreferencesService service = Platform.getPreferencesService();
- String[] qualifiers = new String[] {getUniqueString() + 1, getUniqueString() + 2};
- String[] oldKeys = new String[] {getUniqueString() + 3, getUniqueString() + 4};
- String[] newKeys = new String[] {getUniqueString() + 5, getUniqueString() + 6};
- Preferences node = service.getRootNode().node(Plugin.PLUGIN_PREFERENCE_SCOPE);
- String actual;
-
- // nodes shouldn't exist
- for (int i = 0; i < qualifiers.length; i++) {
- try {
- assertTrue("1.0", !node.nodeExists(qualifiers[i]));
- } catch (BackingStoreException e) {
- fail("1.99", e);
- }
- }
-
- // store some values
- for (int i = 0; i < qualifiers.length; i++) {
- Preferences current = node.node(qualifiers[i]);
- for (int j = 0; j < oldKeys.length; j++) {
- current.put(oldKeys[j], getUniqueString());
- actual = current.get(oldKeys[j], null);
- assertNotNull("2.0." + current.absolutePath() + IPath.SEPARATOR + oldKeys[j], actual);
- }
- for (int j = 0; j < newKeys.length; j++) {
- actual = current.get(newKeys[j], null);
- assertNull("2.1." + current.absolutePath() + IPath.SEPARATOR + newKeys[j], actual);
- }
- }
-
- // import a legacy file
- try {
- service.importPreferences(getLegacyExportFile(qualifiers, newKeys));
- } catch (CoreException e) {
- fail("3.0", e);
- }
-
- // old values shouldn't exist anymore
- for (int i = 0; i < qualifiers.length; i++) {
- Preferences current = node.node(qualifiers[i]);
- for (int j = 0; j < oldKeys.length; j++)
- assertNull("4.0." + current.absolutePath() + IPath.SEPARATOR + oldKeys[j], current.get(oldKeys[j], null));
- for (int j = 0; j < newKeys.length; j++) {
- actual = current.get(newKeys[j], null);
- assertNotNull("4.1." + current.absolutePath() + IPath.SEPARATOR + newKeys[j], actual);
- }
- }
- }
-
- private InputStream getLegacyExportFile(String[] qualifiers, String[] keys) {
- Properties properties = new Properties();
- for (int i = 0; i < qualifiers.length; i++) {
- // version id
- properties.put(qualifiers[i], "2.1.3");
- for (int j = 0; j < keys.length; j++)
- properties.put(qualifiers[i] + IPath.SEPARATOR + keys[j], getUniqueString());
- }
- ByteArrayOutputStream output = new ByteArrayOutputStream();
- try {
- properties.store(output, null);
- } catch (IOException e) {
- fail("#getLegacyExportFile", e);
- } finally {
- try {
- output.close();
- } catch (IOException e) {
- // ignore
- }
- }
- InputStream input = new ByteArrayInputStream(output.toByteArray());
- return input;
- }
-
- /*
- * - create a child node with some key/value pairs
- * - set the excludes to be the child name
- * - export the parent
- * - don't expect anything to be exported
- */
- public void testExportExcludes1() {
-
- // add some random key/value pairs
- String qualifier = getUniqueString();
- String child = "child";
- IEclipsePreferences node = new TestScope().getNode(qualifier);
- Preferences childNode = node.node(child);
- childNode.put("a", "v1");
- childNode.put("b", "v2");
- childNode.put("c", "v3");
-
- // set the excludes list so it doesn't export anything
- String[] excludes = new String[] {child};
-
- ExportVerifier verifier = new ExportVerifier(node, excludes);
- verifier.verify();
-
- // make the child path absolute and try again
- verifier.setExcludes(new String[] {'/' + child});
- verifier.verify();
- }
-
- /*
- * - basic export
- * - set a key/value pair on a node
- * - export that node
- * - nothing in the excludes list
- * - expect that k/v pair to be in the file
- */
- public void testExportExcludes2() {
- String qualifier = getUniqueString();
- IEclipsePreferences node = new TestScope().getNode(qualifier);
- String key = getUniqueString();
- String value = getUniqueString();
- node.put(key, value);
- String[] excludesList = new String[] {};
-
- ExportVerifier verifier = new ExportVerifier(node, excludesList);
- verifier.addExpected(node.absolutePath(), key);
- verifier.addVersion();
- verifier.addExportRoot(node);
- verifier.verify();
- }
-
- /*
- * - add 2 key/value pairs to a node
- * - add one of them to the excludes list
- * - expect only the other key to exist
- */
- public void testExportExcludes3() {
- String qualifier = getUniqueString();
- IEclipsePreferences node = new TestScope().getNode(qualifier);
- String k1 = "a";
- String k2 = "b";
- String v1 = "1";
- String v2 = "2";
- node.put(k1, v1);
- node.put(k2, v2);
- String[] excludesList = new String[] {k1};
-
- ExportVerifier verifier = new ExportVerifier(node, excludesList);
- verifier.addExpected(node.absolutePath(), k2);
- verifier.addVersion();
- verifier.addExportRoot(node);
- verifier.verify();
-
- // make the excludes list absolute paths and try again
- verifier.setExcludes(new String[] {'/' + k1});
- verifier.verify();
- }
-
- /*
- * - add key/value pairs to a node
- * - export containing non-matching string
- * - expect all k/v pairs
- */
- public void testExportExcludes4() {
- String qualifier = getUniqueString();
- IEclipsePreferences node = new TestScope().getNode(qualifier);
- String k1 = "a";
- String k2 = "b";
- String v1 = "1";
- String v2 = "2";
- node.put(k1, v1);
- node.put(k2, v2);
- String[] excludesList = new String[] {"bar"};
-
- ExportVerifier verifier = new ExportVerifier(node, excludesList);
- verifier.addVersion();
- verifier.addExportRoot(node);
- verifier.addExpected(node.absolutePath(), k1);
- verifier.addExpected(node.absolutePath(), k2);
- verifier.verify();
- }
-
- /*
- * - exporting default values shouldn't do anything
- */
- public void testExportDefaults() {
- String qualifier = getUniqueString();
- IEclipsePreferences node = new DefaultScope().getNode(qualifier);
- for (int i = 0; i < 10; i++)
- node.put(Integer.toString(i), getUniqueString());
-
- ExportVerifier verifier = new ExportVerifier(node, (String[]) null);
- verifier.verify();
- }
-
- /*
- * - create 2 child with 2 key/value pairs each
- * - excludes is a single key from one of the children
- * - export parent
- * - expect all values to be exported but that one
- */
- public void testExportExcludes5() {
- String qualifier = getUniqueString();
- IEclipsePreferences node = new TestScope().getNode(qualifier);
- Preferences child1 = node.node("c1");
- Preferences child2 = node.node("c2");
- String k1 = "a";
- String k2 = "b";
- String v1 = "1";
- String v2 = "2";
- child1.put(k1, v1);
- child1.put(k2, v2);
- child2.put(k1, v1);
- child2.put(k2, v2);
- String[] excludes = new String[] {child1.name() + '/' + k2};
- ExportVerifier verifier = new ExportVerifier(node, excludes);
- verifier.addVersion();
- verifier.addExportRoot(node);
- verifier.addExpected(child1.absolutePath(), k1);
- verifier.addExpected(child2.absolutePath(), k1);
- verifier.addExpected(child2.absolutePath(), k2);
- }
-
- public void testValidateVersions() {
- final char BUNDLE_VERSION_PREFIX = '@';
-
- // ensure that there is at least one value in the prefs
- Preferences scopeRoot = Platform.getPreferencesService().getRootNode().node(Plugin.PLUGIN_PREFERENCE_SCOPE);
- scopeRoot.node("org.eclipse.core.tests.runtime").put("key", "value");
-
- // no errors if the file doesn't exist
- IPath path = getRandomLocation();
- IStatus result = org.eclipse.core.runtime.Preferences.validatePreferenceVersions(path);
- assertTrue("1.0", result.isOK());
-
- // an empty file wasn't written by #export so its an invalid file format
- // NOTE: this changed from "do nothing" to being an error in Eclipse 3.1
- Properties properties = new Properties();
- OutputStream output = null;
- try {
- output = new FileOutputStream(path.toFile());
- properties.store(output, null);
- } catch (IOException e) {
- fail("2.0", e);
- } finally {
- if (output != null)
- try {
- output.close();
- } catch (IOException e) {
- // ignore
- }
- }
- result = org.eclipse.core.runtime.Preferences.validatePreferenceVersions(path);
- assertTrue("2.0", !result.isOK());
-
- // no errors for a file which we write out right now
- try {
- org.eclipse.core.runtime.Preferences.exportPreferences(path);
- } catch (CoreException e) {
- fail("3.0", e);
- }
- result = org.eclipse.core.runtime.Preferences.validatePreferenceVersions(path);
- assertTrue("3.1", result.isOK());
-
- // warning for old versions
- properties = new Properties();
- InputStream input = null;
- try {
- input = new FileInputStream(path.toFile());
- properties.load(input);
- } catch (IOException e) {
- fail("4.0", e);
- } finally {
- if (input != null)
- try {
- input.close();
- } catch (IOException e) {
- // ignore
- }
- }
- // change all version numbers to "0" so the validation will fail
- for (Enumeration e = properties.keys(); e.hasMoreElements();) {
- String key = (String) e.nextElement();
- if (key.charAt(0) == BUNDLE_VERSION_PREFIX)
- properties.put(key, "0");
- }
- output = null;
- try {
- output = new FileOutputStream(path.toFile());
- properties.store(output, null);
- } catch (IOException e) {
- fail("4.1", e);
- } finally {
- if (output != null)
- try {
- output.close();
- } catch (IOException e) {
- // ignore
- }
- }
- result = org.eclipse.core.runtime.Preferences.validatePreferenceVersions(path);
- assertTrue("4.2", !result.isOK());
-
- }
-
- public void testMatches() {
- IPreferencesService service = Platform.getPreferencesService();
- IPreferenceFilter[] matching = null;
- final String QUALIFIER = getUniqueString();
-
- // an empty transfer list matches nothing
- try {
- matching = service.matches(service.getRootNode(), new IPreferenceFilter[0]);
- } catch (CoreException e) {
- fail("1.00", e);
- }
- assertEquals("1.1", 0, matching.length);
-
- // don't match this filter
- IPreferenceFilter filter = new IPreferenceFilter() {
- public Map getMapping(String scope) {
- Map result = new HashMap();
- result.put(QUALIFIER, null);
- return result;
- }
-
- public String[] getScopes() {
- return new String[] {InstanceScope.SCOPE};
- }
- };
- try {
- matching = service.matches(service.getRootNode(), new IPreferenceFilter[] {filter});
- } catch (CoreException e) {
- fail("2.00", e);
- }
- assertEquals("2.1", 0, matching.length);
-
- // shouldn't match since there are no key/value pairs in the node
- try {
- matching = service.matches(service.getRootNode(), new IPreferenceFilter[] {filter});
- } catch (CoreException e) {
- fail("3.00", e);
- }
- assertEquals("3.0", 0, matching.length);
-
- // add some values so it does match
- new InstanceScope().getNode(QUALIFIER).put("key", "value");
- try {
- matching = service.matches(service.getRootNode(), new IPreferenceFilter[] {filter});
- } catch (CoreException e) {
- fail("3.00", e);
- }
- assertEquals("3.1", 1, matching.length);
-
- // should match on the exact node too
- try {
- matching = service.matches(new InstanceScope().getNode(QUALIFIER), new IPreferenceFilter[] {filter});
- } catch (CoreException e) {
- fail("4.00", e);
- }
- assertEquals("4.1", 1, matching.length);
-
- // shouldn't match a different scope
- try {
- matching = service.matches(new ConfigurationScope().getNode(QUALIFIER), new IPreferenceFilter[] {filter});
- } catch (CoreException e) {
- fail("5.00", e);
- }
- assertEquals("5.1", 0, matching.length);
-
- // try matching on the root node for a filter which matches all nodes in the scope
- filter = new IPreferenceFilter() {
- public Map getMapping(String scope) {
- return null;
- }
-
- public String[] getScopes() {
- return new String[] {InstanceScope.SCOPE};
- }
- };
- try {
- matching = service.matches(new InstanceScope().getNode(QUALIFIER), new IPreferenceFilter[] {filter});
- } catch (CoreException e) {
- fail("6.0", e);
- }
- assertEquals("6.1", 1, matching.length);
-
- // shouldn't match
- try {
- matching = service.matches(new ConfigurationScope().getNode(QUALIFIER), new IPreferenceFilter[] {filter});
- } catch (CoreException e) {
- fail("7.0", e);
- }
- assertEquals("7.1", 0, matching.length);
- }
-
- /*
- * See bug 95608 - A node should match if it has any keys OR has a child node
- * with keys.
- */
- public void testMatches2() {
- IPreferencesService service = Platform.getPreferencesService();
- final String QUALIFIER = getUniqueString();
-
- // setup - create a child node with a key/value pair
- new InstanceScope().getNode(QUALIFIER).node("child").put("key", "value");
- IPreferenceFilter[] filters = new IPreferenceFilter[] {new IPreferenceFilter() {
- public Map getMapping(String scope) {
- Map result = new HashMap();
- result.put(QUALIFIER, null);
- return result;
- }
-
- public String[] getScopes() {
- return new String[] {InstanceScope.SCOPE};
- }
- }};
- try {
- assertEquals("1.0", 1, service.matches(service.getRootNode(), filters).length);
- } catch (CoreException e) {
- fail("0.0", e);
- }
- }
-
- public void testExportWithTransfers1() {
-
- final String VALID_QUALIFIER = getUniqueString();
- IPreferenceFilter transfer = new IPreferenceFilter() {
- public Map getMapping(String scope) {
- Map result = new HashMap();
- result.put(VALID_QUALIFIER, null);
- return result;
- }
-
- public String[] getScopes() {
- return new String[] {InstanceScope.SCOPE};
- }
- };
-
- IPreferencesService service = Platform.getPreferencesService();
- ExportVerifier verifier = new ExportVerifier(service.getRootNode(), new IPreferenceFilter[] {transfer});
-
- IEclipsePreferences node = new InstanceScope().getNode(VALID_QUALIFIER);
- String VALID_KEY_1 = "key1";
- String VALID_KEY_2 = "key2";
- node.put(VALID_KEY_1, "value1");
- node.put(VALID_KEY_2, "value2");
-
- verifier.addVersion();
- verifier.addExportRoot(service.getRootNode());
- verifier.addExpected(node.absolutePath(), VALID_KEY_1);
- verifier.addExpected(node.absolutePath(), VALID_KEY_2);
-
- node = new InstanceScope().getNode(getUniqueString());
- node.put("invalidkey1", "value1");
- node.put("invalidkey2", "value2");
-
- verifier.verify();
- }
-
- /*
- * Test exporting with a transfer that returns null for the mapping. This means
- * export everything in the scope.
- */
- public void testExportWithTransfers2() {
- final String VALID_QUALIFIER = getUniqueString();
- IPreferenceFilter transfer = new IPreferenceFilter() {
- public Map getMapping(String scope) {
- return null;
- }
-
- public String[] getScopes() {
- return new String[] {TestScope.SCOPE};
- }
- };
-
- IPreferencesService service = Platform.getPreferencesService();
- final ExportVerifier verifier = new ExportVerifier(service.getRootNode(), new IPreferenceFilter[] {transfer});
-
- IEclipsePreferences testNode = new TestScope().getNode(VALID_QUALIFIER);
- String VALID_KEY_1 = "key1";
- String VALID_KEY_2 = "key2";
- testNode.put(VALID_KEY_1, "value1");
- testNode.put(VALID_KEY_2, "value2");
-
- IPreferenceNodeVisitor visitor = new IPreferenceNodeVisitor() {
- public boolean visit(IEclipsePreferences node) throws BackingStoreException {
- String[] keys = node.keys();
- for (int i = 0; i < keys.length; i++)
- verifier.addExpected(node.absolutePath(), keys[i]);
- return true;
- }
- };
- try {
- ((IEclipsePreferences) service.getRootNode().node(TestScope.SCOPE)).accept(visitor);
- } catch (BackingStoreException e) {
- fail("2.00", e);
- }
- verifier.addVersion();
- verifier.addExportRoot(service.getRootNode());
-
- testNode = new InstanceScope().getNode(getUniqueString());
- testNode.put("invalidkey1", "value1");
- testNode.put("invalidkey2", "value2");
-
- verifier.verify();
- }
-
- /*
- * See Bug 95608 - [Preferences] How do I specify a nested node in a preferenceTransfer
- * When you specify a transfer with children, you should export it even if the
- * parent doesn't have any key/value pairs.
- */
- public void testExportWithTransfers3() {
-
- final String QUALIFIER = getUniqueString();
- IPreferenceFilter transfer = new IPreferenceFilter() {
- public Map getMapping(String scope) {
- Map result = new HashMap();
- result.put(QUALIFIER, null);
- return result;
- }
-
- public String[] getScopes() {
- return new String[] {InstanceScope.SCOPE};
- }
- };
-
- IPreferencesService service = Platform.getPreferencesService();
- ExportVerifier verifier = new ExportVerifier(service.getRootNode(), new IPreferenceFilter[] {transfer});
-
- Preferences node = new InstanceScope().getNode(QUALIFIER).node("child");
- String VALID_KEY_1 = "key1";
- String VALID_KEY_2 = "key2";
- node.put(VALID_KEY_1, "value1");
- node.put(VALID_KEY_2, "value2");
-
- verifier.addVersion();
- verifier.addExportRoot(service.getRootNode());
- verifier.addExpected(node.absolutePath(), VALID_KEY_1);
- verifier.addExpected(node.absolutePath(), VALID_KEY_2);
-
- node = new InstanceScope().getNode(getUniqueString());
- node.put("invalidkey1", "value1");
- node.put("invalidkey2", "value2");
-
- verifier.verify();
- }
-
- public void testApplyWithTransfers() {
- // todo
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestScope.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestScope.java
deleted file mode 100644
index a7fe711..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestScope.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.preferences;
-
-import java.util.Properties;
-import org.eclipse.core.internal.preferences.EclipsePreferences;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * @since 3.0
- */
-public class TestScope extends EclipsePreferences implements IScopeContext {
-
- public static final String SCOPE = "test"; //$NON-NLS-1$
- private String qualifier;
- private int segmentCount;
- private IEclipsePreferences loadLevel;
-
- public TestScope() {
- this(null, null);
- }
-
- private TestScope(EclipsePreferences parent, String key) {
- super(parent, key);
- // cache the segment count
- IPath path = new Path(absolutePath());
- segmentCount = path.segmentCount();
- if (segmentCount < 2)
- return;
-
- // cache the qualifier
- String scope = path.segment(0);
- if (TestScope.SCOPE.equals(scope))
- qualifier = path.segment(1);
-
- // cache the location
- if (qualifier == null)
- return;
- }
-
- protected IEclipsePreferences getLoadLevel() {
- if (loadLevel == null) {
- if (qualifier == null)
- return null;
- // Make it relative to this node rather than navigating to it from the root.
- // Walk backwards up the tree starting at this node.
- // This is important to avoid a chicken/egg thing on startup.
- IEclipsePreferences node = this;
- for (int i = 2; i < segmentCount; i++)
- node = (IEclipsePreferences) node.parent();
- loadLevel = node;
- }
- return loadLevel;
- }
-
- public IPath getLocation() {
- return null;
- }
-
- public String getName() {
- return SCOPE;
- }
-
- public IEclipsePreferences getNode(String qualifier) {
- return (IEclipsePreferences) Platform.getPreferencesService().getRootNode().node(SCOPE).node(qualifier);
- }
-
- protected EclipsePreferences internalCreate(EclipsePreferences nodeParent, String nodeName, Object context) {
- return new TestScope(nodeParent, nodeName);
- }
-
- void setDirty(boolean value) {
- dirty = value;
- }
-
- Properties toProperties() throws BackingStoreException {
- return convertToProperties(new Properties(), "");
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/AllTests.java
deleted file mode 100644
index e4b978a..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/AllTests.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry;
-
-import junit.framework.*;
-import org.eclipse.core.tests.internal.registry.simple.AllSimpleRegistryTests;
-
-public class AllTests extends TestCase {
- public AllTests() {
- super(null);
- }
-
- public AllTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AllTests.class.getName());
- suite.addTest(ExtensionRegistryDynamicTest.suite());
- suite.addTest(ExtensionRegistryStaticTest.suite());
- suite.addTest(NamespaceTest.suite());
- suite.addTest(AllSimpleRegistryTests.suite());
- suite.addTestSuite(StaleObjects.class);
- suite.addTest(ContributorsTest.suite());
- suite.addTest(ExtensionRegistryStaticTest.suite()); // test again
- suite.addTest(RegistryListenerTest.suite());
- suite.addTest(InputErrorTest.suite());
- return suite;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ContributorsTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ContributorsTest.java
deleted file mode 100644
index 048bb00..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ContributorsTest.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import junit.framework.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.spi.IDynamicExtensionRegistry;
-import org.eclipse.core.tests.harness.BundleTestingHelper;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-/**
- * Tests contributor resolution for Bundle-based contributors.
- *
- * @since 3.3
- */
-public class ContributorsTest extends TestCase {
-
- public ContributorsTest() {
- super();
- }
-
- public ContributorsTest(String name) {
- super(name);
- }
-
- public void testResolution() throws IOException, BundleException {
- Bundle bundle = null;
- Bundle fragment = null;
- try {
- bundle = BundleTestingHelper.installBundle("0.1", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/contributors/A");
- fragment = BundleTestingHelper.installBundle("0.2", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/contributors/B");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle, fragment});
-
- IExtensionRegistry registry = RegistryFactory.getRegistry();
- IExtensionPoint bundleExtPoint = registry.getExtensionPoint("testContributors.xptContibutorsA");
- IContributor bundleContributor = bundleExtPoint.getContributor();
- Bundle contributingBundle = ContributorFactoryOSGi.resolve(bundleContributor);
- assertNotNull(contributingBundle);
- assertTrue(contributingBundle.equals(bundle));
-
- IExtensionPoint fragmentExtPoint = registry.getExtensionPoint("testContributors.contrFragment");
- IContributor fragmentContributor = fragmentExtPoint.getContributor();
- Bundle contributingFragment = ContributorFactoryOSGi.resolve(fragmentContributor);
- assertNotNull(contributingFragment);
- assertTrue(contributingFragment.equals(fragment));
- } finally {
- if (bundle != null)
- bundle.uninstall();
- if (fragment != null)
- fragment.uninstall();
- }
- }
-
- /**
- * bundleA, bundleB, and fragment on bundleA all use the same namespace. Verify that getting
- * elements by contributor returns all elements from the contributor and only from that
- * contributor.
- *
- * @throws IOException
- * @throws BundleException
- */
- public void testByContributor() throws IOException, BundleException {
- Bundle bundleA = null;
- Bundle bundleB = null;
- Bundle fragment = null;
- try {
- bundleA = BundleTestingHelper.installBundle("0.1", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/elementsByContributor/A");
- bundleB = BundleTestingHelper.installBundle("0.2", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/elementsByContributor/B");
- fragment = BundleTestingHelper.installBundle("0.2", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/elementsByContributor/Afragment");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundleA, bundleB, fragment});
-
- IExtensionRegistry registry = RegistryFactory.getRegistry();
-
- // verify bundleA (bundle B is the same - will work if this works)
- IContributor contributorA = ContributorFactoryOSGi.createContributor(bundleA);
-
- IExtensionPoint[] extPointsA = registry.getExtensionPoints(contributorA);
- assertNotNull(extPointsA);
- assertTrue(extPointsA.length == 1);
- assertTrue(extPointsA[0].getUniqueIdentifier().equals("org.eclipse.test.registryByContrib.PointA"));
-
- IExtension[] extsA = registry.getExtensions(contributorA);
- assertNotNull(extsA);
- assertTrue(extsA.length == 1);
- assertTrue(extsA[0].getUniqueIdentifier().equals("org.eclipse.test.registryByContrib.ExtensionA"));
-
- // verify fragment
- IContributor contributorAF = ContributorFactoryOSGi.createContributor(fragment);
- IExtensionPoint[] extPointsFragmentA = registry.getExtensionPoints(contributorAF);
- assertNotNull(extPointsFragmentA);
- assertTrue(extPointsFragmentA.length == 1);
- assertTrue(extPointsFragmentA[0].getUniqueIdentifier().equals("org.eclipse.test.registryByContrib.PointFA"));
-
- IExtension[] extsFragmentA = registry.getExtensions(contributorAF);
- assertNotNull(extsFragmentA);
- assertTrue(extsFragmentA.length == 1);
- assertTrue(extsFragmentA[0].getUniqueIdentifier().equals("org.eclipse.test.registryByContrib.ExtensionFA"));
-
- } finally {
- if (bundleA != null)
- bundleA.uninstall();
- if (bundleB != null)
- bundleB.uninstall();
- if (fragment != null)
- fragment.uninstall();
- }
- }
-
- /**
- * Checks {@link IDynamicExtensionRegistry#removeContributor(IContributor, Object)}. A separate
- * registry is created as removal functionality is not allowed by the default Eclipse registry.
- *
- * @throws IOException
- * @throws BundleException
- */
- public void testContributorRemoval() throws IOException {
- Object masterKey = new Object();
- IExtensionRegistry registry = RegistryFactory.createRegistry(null, masterKey, null);
-
- assertTrue(addContribution(registry, "A"));
- assertTrue(addContribution(registry, "B"));
-
- assertNotNull(registry.getExtensionPoint("org.eclipse.test.registryByContrib.PointA"));
- assertNotNull(registry.getExtensionPoint("org.eclipse.test.registryByContrib.PointB"));
-
- IContributor[] contributors = ((IDynamicExtensionRegistry) registry).getAllContributors();
- assertNotNull(contributors);
- assertTrue(contributors.length == 2);
- IContributor contributorB = null;
- for (int i = 0; i < contributors.length; i++) {
- if ("B".equals(contributors[i].getName())) {
- contributorB = contributors[i];
- break;
- }
- }
- assertNotNull(contributorB);
-
- ((IDynamicExtensionRegistry) registry).removeContributor(contributorB, masterKey);
-
- assertNotNull(registry.getExtensionPoint("org.eclipse.test.registryByContrib.PointA"));
- assertNull(registry.getExtensionPoint("org.eclipse.test.registryByContrib.PointB"));
- }
-
- private boolean addContribution(IExtensionRegistry registry, String fileName) throws IOException {
- String fullPath = RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/elementsByContributor/" + fileName + "/plugin.xml";
- URL urlA = RuntimeTestsPlugin.getContext().getBundle().getEntry(fullPath);
- InputStream is = urlA.openStream();
- IContributor nonBundleContributor = ContributorFactorySimple.createContributor(fileName); //$NON-NLS-1$
- return registry.addContribution(is, nonBundleContributor, false, urlA.getFile(), null, null);
- }
-
- public static Test suite() {
- return new TestSuite(ContributorsTest.class);
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryDynamicTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryDynamicTest.java
deleted file mode 100644
index 6156706..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryDynamicTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry;
-
-import java.io.IOException;
-import junit.framework.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.dynamichelpers.*;
-import org.eclipse.core.tests.harness.BundleTestingHelper;
-import org.eclipse.core.tests.harness.TestRegistryChangeListener;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-public class ExtensionRegistryDynamicTest extends TestCase {
-
- public ExtensionRegistryDynamicTest() {
- super();
- }
-
- public ExtensionRegistryDynamicTest(String name) {
- super(name);
- }
-
- public void testAddition() throws IOException, BundleException {
- Bundle bundle01 = null;
- Bundle bundle02 = null;
- TestRegistryChangeListener listener = new TestRegistryChangeListener("bundle01", "xp1", "bundle02", "ext1");
- listener.register();
- try {
- bundle01 = BundleTestingHelper.installBundle("0.1", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registryEvents/bundle01");
- bundle02 = BundleTestingHelper.installBundle("0.2", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registryEvents/bundle02");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01, bundle02});
- IExtensionRegistry registry = RegistryFactory.getRegistry();
- IExtensionPoint extPoint = registry.getExtensionPoint("bundle01.xp1");
- IExtension[] extensions = extPoint.getExtensions();
- assertEquals("0.9", extensions.length, 1);
-
- assertEquals("1.2", IExtensionDelta.ADDED, listener.eventTypeReceived(20000));
- } finally {
- listener.unregister();
- if (bundle01 != null)
- bundle01.uninstall();
- if (bundle02 != null)
- bundle02.uninstall();
- }
- }
-
- /**
- * @see bug 65783
- */
- public void testReresolving() throws IOException, BundleException {
- Bundle bundle01 = null;
- Bundle bundle02 = null;
- TestRegistryChangeListener listener = new TestRegistryChangeListener("bundle01", "xp1", "bundle02", "ext1");
- listener.register();
- try {
- bundle01 = BundleTestingHelper.installBundle("0.1", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registryEvents/bundle01");
- bundle02 = BundleTestingHelper.installBundle("0.2", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registryEvents/bundle02");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01, bundle02});
- assertEquals("0.5", IExtensionDelta.ADDED, listener.eventTypeReceived(20000));
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02});
- assertEquals("1.2", IExtensionDelta.REMOVED, listener.eventTypeReceived(10000));
- assertEquals("2.2", IExtensionDelta.ADDED, listener.eventTypeReceived(10000));
- } finally {
- listener.unregister();
- if (bundle01 != null)
- bundle01.uninstall();
- if (bundle02 != null)
- bundle02.uninstall();
- }
- }
-
- boolean additionCalled = false;
- boolean removalCalled = false;
-
- /**
- * @see bug 178028
- */
- public void testEventTracker() throws IOException, BundleException {
- Bundle bundle01 = null;
- Bundle bundle02 = null;
- TestRegistryChangeListener listener = new TestRegistryChangeListener("bundle01", "xp1", "bundle02", "ext1");
- listener.register();
- TestRegistryChangeListener lastListener = null;
- try {
- bundle01 = BundleTestingHelper.installBundle("0.1", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registryEvents/bundle01");
- bundle02 = BundleTestingHelper.installBundle("0.2", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registryEvents/bundle02");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01, bundle02});
- assertEquals("0.5", IExtensionDelta.ADDED, listener.eventTypeReceived(20000));
-
- ExtensionTracker tracker = new ExtensionTracker();
- IExtensionRegistry registry = RegistryFactory.getRegistry();
- IExtensionPoint extPoint = registry.getExtensionPoint("bundle01.xp1");
-
- // reset state variables
- additionCalled = false;
- removalCalled = false;
-
- tracker.registerHandler(new IExtensionChangeHandler() {
-
- public void addExtension(IExtensionTracker currentTracker, IExtension extension) {
- additionCalled = true;
- }
-
- public void removeExtension(IExtension extension, Object[] objects) {
- removalCalled = true;
- }
- }, ExtensionTracker.createExtensionPointFilter(extPoint));
-
- lastListener = new TestRegistryChangeListener("bundle01", "xp1", "bundle02", "ext1");
- // this relies on implementation details: listeners are called in the order they are registered
- lastListener.register();
-
- bundle02.uninstall();
- bundle02 = null;
-
- // make sure that all listener processed by synching on the last added listener
- assertEquals("3.0", IExtensionDelta.REMOVED, lastListener.eventTypeReceived(20000));
-
- assertFalse(additionCalled);
- assertTrue(removalCalled);
- } finally {
- listener.unregister();
- if (lastListener != null)
- lastListener.unregister();
- if (bundle01 != null)
- bundle01.uninstall();
- if (bundle02 != null)
- bundle02.uninstall();
- }
- }
-
- public static Test suite() {
- return new TestSuite(ExtensionRegistryDynamicTest.class);
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryStaticTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryStaticTest.java
deleted file mode 100644
index b016ee3..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryStaticTest.java
+++ /dev/null
@@ -1,346 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Arrays;
-import junit.framework.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.tests.harness.BundleTestingHelper;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-public class ExtensionRegistryStaticTest extends TestCase {
-
- public ExtensionRegistryStaticTest(String name) {
- super(name);
- }
-
- public void testA() throws IOException, BundleException {
- //test the addition of an extension point
- String name = "A";
- Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/test" + name);
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
- testExtensionPoint(name);
- }
-
- public void testAFromCache() {
- //Check that it has been persisted
- testExtensionPoint("A");
- }
-
- private void testExtensionPoint(String name) {
- assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("test" + name + ".xpt" + name));
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("test" + name + ".xpt" + name).getLabel(), "Label xpt" + name);
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("test" + name + ".xpt" + name).getNamespace(), "test" + name);
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("test" + name + ".xpt" + name).getNamespaceIdentifier(), "test" + name);
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("test" + name + ".xpt" + name).getContributor().getName(), "test" + name);
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("test" + name + ".xpt" + name).getSchemaReference(), "schema/xpt" + name + ".exsd");
- }
-
- public void testB() throws IOException, BundleException {
- //test the addition of an extension without extension point
- Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testB/1");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
- assertNull(Platform.getExtensionRegistry().getExtension("testB2", "xptB2", "ext1"));
- }
-
- public void testBFromCache() throws IOException, BundleException {
- // Test the addition of an extension point when orphans extension exists
- assertNull(Platform.getExtensionRegistry().getExtension("testB2", "xptB2", "ext1"));
- Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testB/2");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02});
- testExtensionPoint("B2");
-
- // Test the configuration elements
- assertEquals(Platform.getExtensionRegistry().getExtension("testB2", "xptB2", "testB1.ext1").getConfigurationElements().length, 0);
- assertEquals(Platform.getExtensionRegistry().getConfigurationElementsFor("testB2.xptB2").length, 0);
-
- //Test the number of extension in the namespace
- assertEquals(Platform.getExtensionRegistry().getExtensions("testB1").length, 1);
-
- //Test the extension
- assertNotNull(Platform.getExtensionRegistry().getExtension("testB1.ext1"));
- assertNotNull(Platform.getExtensionRegistry().getExtension("testB2", "xptB2", "testB1.ext1"));
- assertNotNull(Platform.getExtensionRegistry().getExtension("testB2.xptB2", "testB1.ext1"));
-
- assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("testB2.xptB2").getExtension("testB1.ext1"));
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testB2.xptB2").getExtensions()[0].getUniqueIdentifier(), "testB1.ext1");
-
- //uninstall the bundle contributing the extension point
- bundle02.uninstall();
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02});
-
- assertNull(Platform.getExtensionRegistry().getExtension("testB1.ext1"));
- assertEquals(Platform.getExtensionRegistry().getExtensions("testB1").length, 0);
- assertEquals(Platform.getExtensionRegistry().getExtensionPoints("testB2").length, 0);
- assertNull(Platform.getExtensionRegistry().getExtensionPoint("testB2.xptB2"));
- }
-
- public void testBRemoved() {
- //Test if testB has been removed.
- assertNull(Platform.getExtensionRegistry().getExtension("testB1.ext1"));
- assertEquals(Platform.getExtensionRegistry().getExtensions("testB1").length, 0);
- assertEquals(Platform.getExtensionRegistry().getExtensionPoints("testB2").length, 0);
- assertNull(Platform.getExtensionRegistry().getExtensionPoint("testB2.xptB2"));
- }
-
- public void testC() throws IOException, BundleException {
- //test the addition of an extension point then the addition of an extension
- Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testC/1");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
- testExtensionPoint("C1");
- Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testC/2");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02});
-
- //Test the configurataion elements
- assertEquals(Platform.getExtensionRegistry().getExtension("testC1", "xptC1", "testC2.ext1").getConfigurationElements().length, 0);
- assertEquals(Platform.getExtensionRegistry().getConfigurationElementsFor("testC1.xptC1").length, 0);
-
- //Test the number of extension in the namespace
- assertEquals(Platform.getExtensionRegistry().getExtensions("testC2").length, 1);
-
- //Test the extension
- assertNotNull(Platform.getExtensionRegistry().getExtension("testC2.ext1"));
- assertNotNull(Platform.getExtensionRegistry().getExtension("testC1", "xptC1", "testC2.ext1"));
- assertNotNull(Platform.getExtensionRegistry().getExtension("testC1.xptC1", "testC2.ext1"));
-
- assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("testC1.xptC1").getExtension("testC2.ext1"));
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testC1.xptC1").getExtensions()[0].getUniqueIdentifier(), "testC2.ext1");
- }
-
- public void testD() throws IOException, BundleException {
- //test the addition of an extension then the addition of an extension point
- Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testD/2");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02});
- Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testD/1");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
- testExtensionPoint("D1");
-
- //Test the configurataion elements
- assertEquals(Platform.getExtensionRegistry().getExtension("testD1", "xptD1", "testD2.ext1").getConfigurationElements().length, 0);
- assertEquals(Platform.getExtensionRegistry().getConfigurationElementsFor("testD1.xptD1").length, 0);
-
- //Test the number of extension in the namespace
- assertEquals(Platform.getExtensionRegistry().getExtensions("testD2").length, 1);
-
- //Test the extension
- assertNotNull(Platform.getExtensionRegistry().getExtension("testD2.ext1"));
- assertNotNull(Platform.getExtensionRegistry().getExtension("testD1", "xptD1", "testD2.ext1"));
- assertNotNull(Platform.getExtensionRegistry().getExtension("testD1.xptD1", "testD2.ext1"));
-
- assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("testD1.xptD1").getExtension("testD2.ext1"));
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testD1.xptD1").getExtensions()[0].getUniqueIdentifier(), "testD2.ext1");
- }
-
- public void testE() throws IOException, BundleException {
- //test the addition of an extension point and then add the extension through a fragment
- Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testE/1");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
- Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testE/2");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02});
- testExtensionPoint("E1");
-
- //Test the configurataion elements
- assertEquals(Platform.getExtensionRegistry().getExtension("testE1", "xptE1", "testE1.ext1").getConfigurationElements().length, 0);
- assertEquals(Platform.getExtensionRegistry().getConfigurationElementsFor("testE1.xptE1").length, 0);
-
- //Test the number of extension in the namespace
- assertEquals(Platform.getExtensionRegistry().getExtensions("testE1").length, 1);
-
- //Test the extension
- assertNotNull(Platform.getExtensionRegistry().getExtension("testE1", "xptE1", "testE1.ext1"));
- assertNotNull(Platform.getExtensionRegistry().getExtension("testE1.xptE1", "testE1.ext1"));
- assertNotNull(Platform.getExtensionRegistry().getExtension("testE1.ext1")); //This test exhibits a bug in the 3.0 implementation
-
- assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("testE1.xptE1").getExtension("testE1.ext1"));
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testE1.xptE1").getExtensions()[0].getUniqueIdentifier(), "testE1.ext1");
- }
-
- public void testF() throws IOException, BundleException {
- //test the addition of the extension through a fragment then the addition of an extension point
- Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testF/2");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02});
- Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testF/1");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
- testExtensionPoint("F1");
-
- //Test the configurataion elements
- assertEquals(Platform.getExtensionRegistry().getExtension("testF1", "xptF1", "testF1.ext1").getConfigurationElements().length, 0);
- assertEquals(Platform.getExtensionRegistry().getConfigurationElementsFor("testF1.xptE1").length, 0);
-
- //Test the number of extension in the namespace
- assertEquals(Platform.getExtensionRegistry().getExtensions("testF1").length, 1);
-
- //Test the extension
- assertNotNull(Platform.getExtensionRegistry().getExtension("testF1", "xptF1", "testF1.ext1"));
- assertNotNull(Platform.getExtensionRegistry().getExtension("testF1.xptF1", "testF1.ext1"));
- assertNotNull(Platform.getExtensionRegistry().getExtension("testF1.ext1")); //This test exhibits a bug in the 3.0 implementation
-
- assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("testF1.xptF1").getExtension("testF1.ext1"));
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testF1.xptF1").getExtensions()[0].getUniqueIdentifier(), "testF1.ext1");
-
- //Test the namespace
- assertEquals(Arrays.asList(Platform.getExtensionRegistry().getNamespaces()).contains("testF1"), true);
- assertEquals(Arrays.asList(Platform.getExtensionRegistry().getNamespaces()).contains("testF2"), false);
- }
-
- public void testG() throws IOException, BundleException {
- //fragment contributing an extension point to a plugin that do not have extension or extension point
- Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testG/1");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
- Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testG/2");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02});
-
- assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("testG1.xptG2"));
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testG1.xptG2").getLabel(), "Label xptG2");
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testG1.xptG2").getNamespace(), "testG1");
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testG1.xptG2").getNamespaceIdentifier(), "testG1");
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testG1.xptG2").getContributor().getName(), "testG1");
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testG1.xptG2").getSchemaReference(), "schema/xptG2.exsd");
-
- //Test the namespace
- assertEquals(Arrays.asList(Platform.getExtensionRegistry().getNamespaces()).contains("testG1"), true);
- assertEquals(Arrays.asList(Platform.getExtensionRegistry().getNamespaces()).contains("testG2"), false);
- }
-
- public void testH() throws IOException, BundleException {
- // fragment contributing an extension to a plugin that does not have extension or extension point
- Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testH/1");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
- Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testH/2");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02});
- Bundle bundle03 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testH/3");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle03});
-
- testExtensionPoint("H1");
-
- //Test the configurataion elements
- assertEquals(Platform.getExtensionRegistry().getExtension("testH1", "xptH1", "testH3.ext1").getConfigurationElements().length, 0);
- assertEquals(Platform.getExtensionRegistry().getConfigurationElementsFor("testH1.xptH1").length, 0);
-
- //Test the number of extension in the namespace
- assertEquals(Platform.getExtensionRegistry().getExtensions("testH3").length, 1);
-
- //Test the extension
- assertNotNull(Platform.getExtensionRegistry().getExtension("testH1", "xptH1", "testH3.ext1"));
- assertNotNull(Platform.getExtensionRegistry().getExtension("testH1.xptH1", "testH3.ext1"));
- assertNotNull(Platform.getExtensionRegistry().getExtension("testH3.ext1")); //This test exhibits a bug in the 3.0 implementation
-
- assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("testH1.xptH1").getExtension("testH3.ext1"));
- assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testH1.xptH1").getExtensions()[0].getUniqueIdentifier(), "testH3.ext1");
-
- //Test the namespace
- assertEquals(Arrays.asList(Platform.getExtensionRegistry().getNamespaces()).contains("testH1"), true);
- assertEquals(Arrays.asList(Platform.getExtensionRegistry().getNamespaces()).contains("testH3"), true);
- assertEquals(Arrays.asList(Platform.getExtensionRegistry().getNamespaces()).contains("testH2"), false); //fragments do not come with their namespace
- }
-
- public void test71826() throws MalformedURLException, BundleException, IOException {
- Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/71826/fragmentF");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
-
- Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/71826/pluginB");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02});
-
- Bundle bundle03 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/71826/pluginA");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle03});
-
- IExtensionPoint xp = Platform.getExtensionRegistry().getExtensionPoint("71826A.xptE");
- assertNotNull("1.0", xp);
- IExtension[] exts = xp.getExtensions();
- assertEquals("1.1", 2, exts.length);
- assertNotNull("1.2", xp.getExtension("71826A.F1"));
- assertNotNull("1.3", xp.getExtension("71826B.B1"));
- }
-
- public void testJ() throws MalformedURLException, BundleException, IOException {
- //Test the third level configuration elements
- Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testI");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
-
- IExtension ext = Platform.getExtensionRegistry().getExtension("testI.ext1");
- IConfigurationElement ce = ext.getConfigurationElements()[0];
- assertEquals(ce.getName(), "ce");
- assertNotNull(ce.getValue());
- assertEquals(ce.getChildren()[0].getName(), "ce2");
- assertNull(ce.getChildren()[0].getValue());
- assertEquals(ce.getChildren()[0].getChildren()[0].getName(), "ce3");
- assertNull(ce.getChildren()[0].getChildren()[0].getValue());
- assertEquals(ce.getChildren()[0].getChildren()[1].getName(), "ce3");
- assertNull(ce.getChildren()[0].getChildren()[1].getValue());
- assertEquals(ce.getChildren()[0].getChildren()[0].getChildren()[0].getName(), "ce4");
- assertNotNull(ce.getChildren()[0].getChildren()[0].getChildren()[0].getValue());
- }
-
- public void testJbis() {
- //Test the third level configuration elements from cache
- IExtension ext = Platform.getExtensionRegistry().getExtension("testI.ext1");
- IConfigurationElement ce = ext.getConfigurationElements()[0];
- assertEquals(ce.getName(), "ce");
- assertNotNull(ce.getValue());
- assertEquals(ce.getChildren()[0].getName(), "ce2");
- assertNull(ce.getChildren()[0].getValue());
- assertEquals(ce.getChildren()[0].getChildren()[0].getName(), "ce3");
- assertNull(ce.getChildren()[0].getChildren()[0].getValue());
- assertEquals(ce.getChildren()[0].getChildren()[1].getName(), "ce3");
- assertNull(ce.getChildren()[0].getChildren()[1].getValue());
- assertEquals(ce.getChildren()[0].getChildren()[0].getChildren()[0].getName(), "ce4");
- assertNotNull(ce.getChildren()[0].getChildren()[0].getChildren()[0].getValue());
- }
-
- public void testNonSingletonBundle() throws MalformedURLException, BundleException, IOException {
- //Non singleton bundles are not supposed to be added
- Bundle nonSingletonBundle = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/nonSingleton");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {nonSingletonBundle});
- assertNull(Platform.getExtensionRegistry().getExtensionPoint("NonSingleton.ExtensionPoint"));
- }
-
- public void testSingletonFragment() throws MalformedURLException, BundleException, IOException {
- //Fragments to non singleton host can not contribute extension or extension points
- Bundle fragmentToNonSingleton = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/fragmentToNonSingleton");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {fragmentToNonSingleton});
- assertNull(Platform.getExtensionRegistry().getExtensionPoint("NonSingleton.Bar"));
- }
-
- public void testNonSingletonFragment() throws MalformedURLException, BundleException, IOException {
- //Non singleton bundles are not supposed to be added
- Bundle regular = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/nonSingletonFragment/plugin");
- Bundle nonSingletonFragment = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/nonSingletonFragment/fragment");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {regular, nonSingletonFragment});
- assertNull(Platform.getExtensionRegistry().getExtensionPoint("Regular.Bar"));
- }
-
- public static Test suite() {
- //Order is important
- TestSuite sameSession = new TestSuite(ExtensionRegistryStaticTest.class.getName());
- sameSession.addTest(new ExtensionRegistryStaticTest("testA"));
- sameSession.addTest(new ExtensionRegistryStaticTest("testAFromCache"));
- sameSession.addTest(new ExtensionRegistryStaticTest("testB"));
- sameSession.addTest(new ExtensionRegistryStaticTest("testBFromCache"));
- sameSession.addTest(new ExtensionRegistryStaticTest("testBRemoved"));
- sameSession.addTest(new ExtensionRegistryStaticTest("testC"));
- sameSession.addTest(new ExtensionRegistryStaticTest("testD"));
- sameSession.addTest(new ExtensionRegistryStaticTest("testE"));
- sameSession.addTest(new ExtensionRegistryStaticTest("testF"));
- sameSession.addTest(new ExtensionRegistryStaticTest("testG"));
- sameSession.addTest(new ExtensionRegistryStaticTest("testH"));
- sameSession.addTest(new ExtensionRegistryStaticTest("test71826"));
- sameSession.addTest(new ExtensionRegistryStaticTest("testJ"));
- sameSession.addTest(new ExtensionRegistryStaticTest("testJbis"));
- sameSession.addTest(new ExtensionRegistryStaticTest("testNonSingletonBundle"));
- sameSession.addTest(new ExtensionRegistryStaticTest("testSingletonFragment"));
- sameSession.addTest(new ExtensionRegistryStaticTest("testNonSingletonFragment"));
- return sameSession;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/InputErrorTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/InputErrorTest.java
deleted file mode 100644
index 83b6aa9..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/InputErrorTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry;
-
-import java.io.*;
-import java.net.URL;
-import junit.framework.*;
-import org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-
-/**
- * Test proper clean-up in case registry gets invalid XML contribution.
- * @since 3.4
- */
-public class InputErrorTest extends TestCase {
-
- static private final String DATA_LOCATION = "Plugin_Testing/registry/errorHandling/";
-
- /**
- * Use customized registry strategy to both check error processing
- * and to remove expected error messages from test log.
- */
- private class RegistryStrategyLog extends RegistryStrategyOSGI {
-
- public String msg = null;
-
- public RegistryStrategyLog(File[] theStorageDir, boolean[] cacheReadOnly, Object key) {
- super(theStorageDir, cacheReadOnly, key);
- }
-
- public void log(IStatus status) {
- msg = status.getMessage();
- }
- }
-
- public InputErrorTest() {
- super();
- }
-
- public InputErrorTest(String name) {
- super(name);
- }
-
- private InputStream getStream(String location) {
- URL xml = RuntimeTestsPlugin.getContext().getBundle().getEntry(DATA_LOCATION + location);
- assertNotNull(xml);
- try {
- return new BufferedInputStream(xml.openStream());
- } catch (IOException ex) {
- fail("Unable to open input stream to XML");
- }
- return null;
- }
-
- public void testErrorCleanupPoints() {
- RegistryStrategyLog strategy = new RegistryStrategyLog(null, null, null); // RegistryFactory.createOSGiStrategy(null, null, null);
- IExtensionRegistry localRegistry = RegistryFactory.createRegistry(strategy, null, null);
- IContributor contributor = ContributorFactorySimple.createContributor("testErrorHandling");
-
- // 1) attempt to add information from mis-formed XML
- InputStream is = getStream("bad/point/plugin.xml");
- assertNotNull(is);
- boolean added = localRegistry.addContribution(is, contributor, false, "test", null, null);
- assertFalse(added);
- IExtensionPoint bundleExtPointA = localRegistry.getExtensionPoint("testErrorHandling.xptErrorTestA");
- assertNull(bundleExtPointA);
- IExtensionPoint bundleExtPointB = localRegistry.getExtensionPoint("testErrorHandling.xptErrorTestB");
- assertNull(bundleExtPointB);
-
- assertNotNull(strategy.msg);
- strategy.msg = null;
-
- // 2) add properly formed XML
- is = getStream("good/point/plugin.xml");
- assertNotNull(is);
- added = localRegistry.addContribution(is, contributor, false, "test", null, null);
- assertTrue(added);
- bundleExtPointA = localRegistry.getExtensionPoint("testErrorHandling.xptErrorTestA");
- assertNotNull(bundleExtPointA);
- bundleExtPointB = localRegistry.getExtensionPoint("testErrorHandling.xptErrorTestB");
- assertNotNull(bundleExtPointB);
-
- assertNull(strategy.msg);
- localRegistry.stop(null);
- }
-
- public void testErrorCleanupExtensions() {
- RegistryStrategyLog strategy = new RegistryStrategyLog(null, null, null); // RegistryFactory.createOSGiStrategy(null, null, null);
- IExtensionRegistry localRegistry = RegistryFactory.createRegistry(strategy, null, null);
- IContributor contributor = ContributorFactorySimple.createContributor("testErrorHandling");
-
- // 1) attempt to add information from mis-formed XML
- InputStream is = getStream("bad/extension/plugin.xml");
- assertNotNull(is);
- boolean added = localRegistry.addContribution(is, contributor, false, "test", null, null);
- assertFalse(added);
- IExtensionPoint bundleExtPointA = localRegistry.getExtensionPoint("testErrorHandling.xptErrorTestA");
- assertNull(bundleExtPointA);
-
- IExtension extensionA = localRegistry.getExtension("testErrorHandling.testExtA");
- assertNull(extensionA);
- IExtension extensionB = localRegistry.getExtension("testErrorHandling.testExtB");
- assertNull(extensionB);
- IExtension extensionC = localRegistry.getExtension("testErrorHandling.testExtC");
- assertNull(extensionC);
-
- assertNotNull(strategy.msg);
- strategy.msg = null;
-
- // 2) add properly formed XML
- is = getStream("good/extension/plugin.xml");
- assertNotNull(is);
- added = localRegistry.addContribution(is, contributor, false, "test", null, null);
- assertTrue(added);
- bundleExtPointA = localRegistry.getExtensionPoint("testErrorHandling.xptErrorTestA");
- assertNotNull(bundleExtPointA);
-
- checkExtension(localRegistry, "testErrorHandling.testExtA", "valueGoodA");
- checkExtension(localRegistry, "testErrorHandling.testExtB", "valueGoodB");
- checkExtension(localRegistry, "testErrorHandling.testExtC", "valueGoodC");
-
- assertNull(strategy.msg);
- localRegistry.stop(null);
- }
-
- private void checkExtension(IExtensionRegistry registry, String extID, String expectedValue) {
- IExtension extensionA = registry.getExtension(extID);
- assertNotNull(extensionA);
- IConfigurationElement[] configElements = extensionA.getConfigurationElements();
- assertTrue(configElements.length == 1);
- String value = configElements[0].getAttribute("testAttr");
- assertTrue(expectedValue.equals(value));
- }
-
- public static Test suite() {
- return new TestSuite(InputErrorTest.class);
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/NamespaceTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/NamespaceTest.java
deleted file mode 100644
index 5bb033b..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/NamespaceTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry;
-
-import java.io.IOException;
-import junit.framework.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.tests.harness.BundleTestingHelper;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-public class NamespaceTest extends TestCase {
-
- public NamespaceTest(String name) {
- super(name);
- }
-
- public void testNamespaceBasic() throws IOException, BundleException {
- //test the addition of an extension point
- Bundle bundle01 = BundleTestingHelper.installBundle("Plugin", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testNamespace/1");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
-
- // Extension point and extension should be present
- IExtensionPoint extpt = Platform.getExtensionRegistry().getExtensionPoint("org.abc.xptNS1");
- assertNotNull(extpt);
- assertTrue(extpt.getNamespaceIdentifier().equals("org.abc"));
- assertTrue(extpt.getContributor().getName().equals("testNamespace1"));
- assertTrue(extpt.getSimpleIdentifier().equals("xptNS1"));
- assertTrue(extpt.getUniqueIdentifier().equals("org.abc.xptNS1"));
-
- IExtension ext = Platform.getExtensionRegistry().getExtension("org.abc.extNS1");
- assertNotNull(ext);
- assertTrue(ext.getNamespaceIdentifier().equals("org.abc"));
- assertTrue(ext.getContributor().getName().equals("testNamespace1"));
- assertTrue(ext.getSimpleIdentifier().equals("extNS1"));
- assertTrue(ext.getUniqueIdentifier().equals("org.abc.extNS1"));
-
- // Check linkage extension <-> extension point
- assertTrue(ext.getExtensionPointUniqueIdentifier().equals(extpt.getUniqueIdentifier()));
- IExtension[] extensions = extpt.getExtensions();
- assertTrue(extensions.length == 1);
- assertTrue(extensions[0].equals(ext));
-
- // Exactly one extension and one extension point in the "org.abc" namespace
- IExtensionPoint[] namespaceExtensionPoints = Platform.getExtensionRegistry().getExtensionPoints("org.abc");
- assertTrue(namespaceExtensionPoints.length == 1);
- assertTrue(namespaceExtensionPoints[0].equals(extpt));
- IExtension[] namespaceExtensions = Platform.getExtensionRegistry().getExtensions("org.abc");
- assertTrue(namespaceExtensions.length == 1);
- assertTrue(namespaceExtensions[0].equals(ext));
-
- // There should not be extension points or extensions in the default namespace
- IExtensionPoint[] defaultExtensionPoints = Platform.getExtensionRegistry().getExtensionPoints("testNamespace1");
- assertTrue(defaultExtensionPoints.length == 0);
- IExtension[] defaultExtensions = Platform.getExtensionRegistry().getExtensions("testNamespace1");
- assertTrue(defaultExtensions.length == 0);
-
- // remove the first bundle
- bundle01.uninstall();
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
- }
-
- public void testNamespaceDynamic() throws BundleException, IOException {
-
- // add another bundle
- Bundle anotherNamespaceBundle = BundleTestingHelper.installBundle("Plugin", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testNamespace/2");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {anotherNamespaceBundle});
-
- // all elements from the first bundle should be gone
- IExtensionPoint extpt_removed = Platform.getExtensionRegistry().getExtensionPoint("org.abc.xptNS1");
- assertNull(extpt_removed);
- IExtension ext_removed = Platform.getExtensionRegistry().getExtension("org.abc.extNS1");
- assertNull(ext_removed);
-
- // all elements from the second bundle should still be present
- IExtensionPoint extpt2 = Platform.getExtensionRegistry().getExtensionPoint("org.abc.xptNS2");
- assertNotNull(extpt2);
- IExtension ext2 = Platform.getExtensionRegistry().getExtension("org.abc.extNS2");
- assertNotNull(ext2);
-
- // Exactly one extension and one extension point in the "org.abc" namespace
- IExtensionPoint[] namespaceExtensionPoints2 = Platform.getExtensionRegistry().getExtensionPoints("org.abc");
- assertTrue(namespaceExtensionPoints2.length == 1);
- assertTrue(namespaceExtensionPoints2[0].equals(extpt2));
- IExtension[] namespaceExtensions2 = Platform.getExtensionRegistry().getExtensions("org.abc");
- assertTrue(namespaceExtensions2.length == 1);
- assertTrue(namespaceExtensions2[0].equals(ext2));
-
- // remove the second bundle
- anotherNamespaceBundle.uninstall();
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {anotherNamespaceBundle});
- }
-
- public static Test suite() {
- //Order is important
- TestSuite sameSession = new TestSuite(NamespaceTest.class.getName());
- sameSession.addTest(new NamespaceTest("testNamespaceBasic"));
- sameSession.addTest(new NamespaceTest("testNamespaceDynamic"));
- return sameSession;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/RegistryListenerTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/RegistryListenerTest.java
deleted file mode 100644
index 190e286..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/RegistryListenerTest.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry;
-
-import java.io.IOException;
-import junit.framework.*;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.tests.harness.BundleTestingHelper;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-/**
- * Tests "new" registry event listener.
- * @since 3.4
- */
-public class RegistryListenerTest extends TestCase {
-
- final private static int MAX_TIME_PER_BUNDLE = 10000; // maximum time to wait for bundle event in milliseconds
-
- public RegistryListenerTest() {
- super();
- }
-
- public RegistryListenerTest(String name) {
- super(name);
- }
-
- /**
- * Producer and consumer bundles are installed and removed in a "normal" order
- */
- public void testRegularOrder() throws IOException, BundleException {
- Bundle bundle01 = null;
- Bundle bundle02 = null;
- WaitingRegistryListener listener = new WaitingRegistryListener();
- listener.register("bundle01.xp1");
- try {
- bundle01 = BundleTestingHelper.installBundle("0.1", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registryListener/bundle01");
- bundle02 = BundleTestingHelper.installBundle("0.2", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registryListener/bundle02");
-
- Bundle[] testBundles = new Bundle[] {bundle01, bundle02};
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), testBundles);
-
- String[] extPointIDs = listener.extPointsReceived(2 * MAX_TIME_PER_BUNDLE);
- String[] extensionsReceived = listener.extensionsReceived(2 * MAX_TIME_PER_BUNDLE);
- assertTrue(listener.isAdded());
-
- assertNotNull(extPointIDs);
- assertTrue(extPointIDs.length == 1);
- assertTrue("bundle01.xp1".equals(extPointIDs[0]));
-
- assertNotNull(extensionsReceived);
- assertTrue(extensionsReceived.length == 1);
- assertTrue("bundle02.ext1".equals(extensionsReceived[0]));
-
- listener.reset();
-
- bundle02.uninstall();
- bundle02 = null; // reset as early as possible in case of exception
- bundle01.uninstall();
- bundle01 = null; // reset as early as possible in case of exception
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), testBundles);
-
- extPointIDs = listener.extPointsReceived(2 * MAX_TIME_PER_BUNDLE);
- extensionsReceived = listener.extensionsReceived(2 * MAX_TIME_PER_BUNDLE);
- assertTrue(listener.isRemoved());
-
- assertNotNull(extPointIDs);
- assertTrue(extPointIDs.length == 1);
- assertTrue("bundle01.xp1".equals(extPointIDs[0]));
-
- assertNotNull(extensionsReceived);
- assertTrue(extensionsReceived.length == 1);
- assertTrue("bundle02.ext1".equals(extensionsReceived[0]));
-
- } finally {
- listener.unregister();
- if (bundle01 != null)
- bundle01.uninstall();
- if (bundle02 != null)
- bundle02.uninstall();
- }
- }
-
- /**
- * Producer and consumer bundles are installed and removed in an inverse order
- */
- public void testInverseOrder() throws IOException, BundleException {
- Bundle bundle01 = null;
- Bundle bundle02 = null;
- WaitingRegistryListener listener = new WaitingRegistryListener();
- listener.register("bundle01.xp1");
- try {
- bundle02 = BundleTestingHelper.installBundle("0.2", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registryEvents/bundle02");
- bundle01 = BundleTestingHelper.installBundle("0.1", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registryEvents/bundle01");
-
- Bundle[] testBundles = new Bundle[] {bundle01, bundle02};
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), testBundles);
-
- String[] extPointIDs = listener.extPointsReceived(2 * MAX_TIME_PER_BUNDLE);
- String[] extensionsReceived = listener.extensionsReceived(2 * MAX_TIME_PER_BUNDLE);
- assertTrue(listener.isAdded());
-
- assertNotNull(extPointIDs);
- assertTrue(extPointIDs.length == 1);
- assertTrue("bundle01.xp1".equals(extPointIDs[0]));
-
- assertNotNull(extensionsReceived);
- assertTrue(extensionsReceived.length == 1);
- assertTrue("bundle02.ext1".equals(extensionsReceived[0]));
-
- listener.reset();
-
- bundle01.uninstall();
- bundle01 = null; // reset as early as possible in case of exception
- bundle02.uninstall();
- bundle02 = null; // reset as early as possible in case of exception
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), testBundles);
-
- extPointIDs = listener.extPointsReceived(2 * MAX_TIME_PER_BUNDLE);
- extensionsReceived = listener.extensionsReceived(2 * MAX_TIME_PER_BUNDLE);
- assertTrue(listener.isRemoved());
-
- assertNotNull(extPointIDs);
- assertTrue(extPointIDs.length == 1);
- assertTrue("bundle01.xp1".equals(extPointIDs[0]));
-
- assertNotNull(extensionsReceived);
- assertTrue(extensionsReceived.length == 1);
- assertTrue("bundle02.ext1".equals(extensionsReceived[0]));
-
- } finally {
- listener.unregister();
- if (bundle02 != null)
- bundle02.uninstall();
- if (bundle01 != null)
- bundle01.uninstall();
- }
- }
-
- /**
- * Tests modifications to multiple extensions and extension points
- * Three listeners are tested: global; on xp1 (two extensions); on xp2 (no extensions)
- */
- public void testMultiplePoints() throws IOException, BundleException {
- Bundle bundle = null;
- WaitingRegistryListener listenerGlobal = new WaitingRegistryListener();
- listenerGlobal.register(null);
- WaitingRegistryListener listener1 = new WaitingRegistryListener();
- listener1.register("bundleMultiple.xp1");
- WaitingRegistryListener listener2 = new WaitingRegistryListener();
- listener2.register("bundleMultiple.xp2");
- try {
- bundle = BundleTestingHelper.installBundle("0.1", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registryListener/bundleMultiple");
-
- Bundle[] testBundles = new Bundle[] {bundle};
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), testBundles);
-
- // test additions on global listener
- String[] extPointIDs = listenerGlobal.extPointsReceived(MAX_TIME_PER_BUNDLE);
- String[] extensionsReceived = listenerGlobal.extensionsReceived(MAX_TIME_PER_BUNDLE);
- assertTrue(listenerGlobal.isAdded());
- checkIDs(extPointIDs, new String[] {"bundleMultiple.xp1", "bundleMultiple.xp2"});
- checkIDs(extensionsReceived, new String[] {"bundleMultiple.ext11", "bundleMultiple.ext12"});
-
- // test additions on listener on extension point with extensions
- String[] extPointIDs1 = listener1.extPointsReceived(20000);
- String[] extensionsReceived1 = listener1.extensionsReceived(20000);
- assertTrue(listener1.isAdded());
- checkIDs(extPointIDs1, new String[] {"bundleMultiple.xp1"});
- checkIDs(extensionsReceived1, new String[] {"bundleMultiple.ext11", "bundleMultiple.ext12"});
-
- // test additions on listener on extension point with no extensions
- String[] extPointIDs2 = listener2.extPointsReceived(MAX_TIME_PER_BUNDLE);
- String[] extensionsReceived2 = listener2.extensionsReceived(50);
- assertTrue(listener2.isAdded());
- checkIDs(extPointIDs2, new String[] {"bundleMultiple.xp2"});
- assertNull(extensionsReceived2);
-
- // removal
- listenerGlobal.reset();
- listener1.reset();
- listener2.reset();
- bundle.uninstall();
- bundle = null; // reset as early as possible in case of exception
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), testBundles);
-
- // test removals on global listener
- extPointIDs = listenerGlobal.extPointsReceived(MAX_TIME_PER_BUNDLE);
- extensionsReceived = listenerGlobal.extensionsReceived(MAX_TIME_PER_BUNDLE);
- assertTrue(listenerGlobal.isRemoved());
- checkIDs(extPointIDs, new String[] {"bundleMultiple.xp1", "bundleMultiple.xp2"});
- checkIDs(extensionsReceived, new String[] {"bundleMultiple.ext11", "bundleMultiple.ext12"});
-
- // test removals on listener on extension point with extensions
- extPointIDs1 = listener1.extPointsReceived(MAX_TIME_PER_BUNDLE);
- extensionsReceived1 = listener1.extensionsReceived(MAX_TIME_PER_BUNDLE);
- assertTrue(listener1.isRemoved());
- checkIDs(extPointIDs1, new String[] {"bundleMultiple.xp1"});
- checkIDs(extensionsReceived1, new String[] {"bundleMultiple.ext11", "bundleMultiple.ext12"});
-
- // test removals on listener on extension point with no extensions
- extPointIDs2 = listener2.extPointsReceived(MAX_TIME_PER_BUNDLE);
- extensionsReceived2 = listener2.extensionsReceived(50);
- assertTrue(listener2.isRemoved());
- checkIDs(extPointIDs2, new String[] {"bundleMultiple.xp2"});
- assertNull(extensionsReceived2);
-
- } finally {
- listenerGlobal.unregister();
- listener1.unregister();
- listener2.unregister();
- if (bundle != null)
- bundle.uninstall();
- }
- }
-
- /**
- * Tests listener registered multiple times: once on xp1, once on xp2
- */
- public void testMultipleRegistrations() throws IOException, BundleException {
- Bundle bundle = null;
- WaitingRegistryListener listener = new WaitingRegistryListener();
- Platform.getExtensionRegistry().addListener(listener, "bundleMultiple.xp1");
- Platform.getExtensionRegistry().addListener(listener, "bundleMultiple.xp1");
- try {
- bundle = BundleTestingHelper.installBundle("0.1", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registryListener/bundleMultiple");
-
- Bundle[] testBundles = new Bundle[] {bundle};
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), testBundles);
-
- // 1st registration: extension point; extension => 2 callbacks
- // 2nd registration should be ignored: extension => 0 callbacks
- // total: 2 callbacks
- assertTrue(listener.waitFor(2, MAX_TIME_PER_BUNDLE) == 2);
-
- // test additions on listener on extension point with extensions
- String[] extPointIDs = listener.extPointsReceived(50);
- String[] extensionsReceived = listener.extensionsReceived(50);
- assertTrue(listener.isAdded());
- checkIDs(extPointIDs, new String[] {"bundleMultiple.xp1"});
- checkIDs(extensionsReceived, new String[] {"bundleMultiple.ext11", "bundleMultiple.ext12"});
-
- // removal: unregistering listener once should remove both registrations
- listener.reset();
- listener.unregister();
- bundle.uninstall();
- bundle = null; // reset as early as possible in case of exception
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), testBundles);
-
- // test removals on listener on extension point with extensions
- assertTrue(listener.waitFor(3, 200) == 0);
- extPointIDs = listener.extPointsReceived(50);
- extensionsReceived = listener.extensionsReceived(50);
- assertNull(extPointIDs);
- assertNull(extensionsReceived);
- } finally {
- // second unregistration should have no effect
- listener.unregister();
- if (bundle != null)
- bundle.uninstall();
- }
- }
-
- // For simplicity, this method does not expect duplicate IDs in either array
- private void checkIDs(String[] receivedIDs, String[] expectedIDs) {
- assertNotNull(receivedIDs);
- assertNotNull(expectedIDs);
- assertTrue(receivedIDs.length == expectedIDs.length);
- for (int i = 0; i < expectedIDs.length; i++) {
- String expected = expectedIDs[i];
- boolean found = false;
- for (int j = 0; j < receivedIDs.length; j++) {
- if (expected.equals(receivedIDs[j])) {
- found = true;
- break;
- }
- }
- assertTrue(found);
- }
- }
-
- public static Test suite() {
- return new TestSuite(RegistryListenerTest.class);
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/StaleObjects.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/StaleObjects.java
deleted file mode 100644
index 16c15e8..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/StaleObjects.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry;
-
-import java.io.IOException;
-import junit.framework.TestCase;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.tests.harness.BundleTestingHelper;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-public class StaleObjects extends TestCase {
- private class HandleCatcher implements IRegistryChangeListener {
- private IExtension extensionFromTheListener;
-
- public HandleCatcher() {
- Platform.getExtensionRegistry().addRegistryChangeListener(this);
- }
-
- public void registryChanged(IRegistryChangeEvent event) {
- boolean gotException = false;
- try {
- extensionFromTheListener = event.getExtensionDeltas()[0].getExtension();
- extensionFromTheListener.getSimpleIdentifier();
- } catch (InvalidRegistryObjectException e) {
- gotException = true;
- }
- assertEquals(false, gotException);
- }
-
- public IExtension getAcquiredHandle() {
- return extensionFromTheListener;
- }
- }
-
- public synchronized void testA() throws IOException, BundleException {
- HandleCatcher listener = new HandleCatcher();
- Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testStale1");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
-
- IExtension willBeStale = Platform.getExtensionRegistry().getExtension("testStale.ext1");
-
- //Test that handles obtained from deltas are working.
-
- //Test that handles obtained from an addition deltas are working even after the delta is done being broadcasted.
- boolean gotException = false;
- try {
- IExtension result = null;
- while ((result = listener.getAcquiredHandle()) == null) {
- try {
- wait(200);
- } catch (InterruptedException e) {
- //ignore.
- }
- }
- result.getSimpleIdentifier();
- } catch (InvalidRegistryObjectException e) {
- gotException = true;
- }
- assertEquals(false, gotException);
-
- //Add a listener capturing a handle removal. Inside the handle catcher the handle is valid
- HandleCatcher listener2 = new HandleCatcher();
- try {
- wait(500); //Wait for the listeners to be done
- } catch (InterruptedException e) {
- //ignore.
- }
-
- bundle01.uninstall();
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
-
- //Outside of the event notification the handle from a removed object should be invalid
- gotException = false;
- try {
- while (listener2.getAcquiredHandle() == null) {
- try {
- wait(200);
- } catch (InterruptedException e) {
- //ignore.
- }
- }
- listener2.getAcquiredHandle().getSimpleIdentifier();
- } catch (InvalidRegistryObjectException e) {
- gotException = true;
- }
- assertEquals(true, gotException);
-
- //Check that the initial handles are stale as well
- gotException = false;
- try {
- willBeStale.getSimpleIdentifier();
- } catch (InvalidRegistryObjectException e) {
- gotException = true;
- }
- assertEquals(true, gotException);
- Platform.getExtensionRegistry().removeRegistryChangeListener(listener2);
- Platform.getExtensionRegistry().removeRegistryChangeListener(listener);
- }
-
- public void testStaleConfigurationElement() throws IOException, BundleException {
- Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testStale2");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
-
- IConfigurationElement ce = Platform.getExtensionRegistry().getExtension("testStale2.ext1").getConfigurationElements()[0];
- assertNotNull(ce);
-
- bundle01.uninstall();
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
-
- boolean gotException = false;
- try {
- ce.createExecutableExtension("name");
- } catch (CoreException c) {
- gotException = true;
- }
- assertEquals(true, gotException);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/WaitingRegistryListener.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/WaitingRegistryListener.java
deleted file mode 100644
index ba898fc..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/WaitingRegistryListener.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry;
-
-import java.util.ArrayList;
-import java.util.List;
-import junit.framework.Assert;
-import org.eclipse.core.runtime.*;
-
-/**
- * Allows test cases to wait for the extension registry notifications.
- * This listener checks navigability to related elements from extensions.
- * @since 3.4
- */
-public class WaitingRegistryListener extends Assert implements IRegistryEventListener {
-
- final static long MIN_WAIT_TIME = 100; // minimum wait time in milliseconds
-
- private List extensionIDs; // String[]
- private List extPointIDs; // String[]
-
- private volatile boolean added;
- private volatile boolean removed;
- private volatile int callbacks;
-
- private String extPointId;
-
- public WaitingRegistryListener() {
- reset();
- }
-
- public void register(String id) {
- extPointId = id; // used for verification in callbacks
- if (extPointId != null)
- Platform.getExtensionRegistry().addListener(this, extPointId);
- else
- Platform.getExtensionRegistry().addListener(this);
- }
-
- public void unregister() {
- Platform.getExtensionRegistry().removeListener(this);
- }
-
- public void reset() {
- extensionIDs = null;
- extPointIDs = null;
- added = false;
- removed = false;
- callbacks = 0;
- }
-
- public boolean isAdded() {
- return added;
- }
-
- public boolean isRemoved() {
- return removed;
- }
-
- public synchronized String[] extensionsReceived(long timeout) {
- if (extensionIDs != null)
- return (String[]) extensionIDs.toArray(new String[extensionIDs.size()]);
- try {
- wait(timeout);
- } catch (InterruptedException e) {
- // who cares?
- }
- if (extensionIDs == null)
- return null;
- return (String[]) extensionIDs.toArray(new String[extensionIDs.size()]);
- }
-
- public synchronized String[] extPointsReceived(long timeout) {
- if (extPointIDs != null)
- return (String[]) extPointIDs.toArray(new String[extPointIDs.size()]);
- try {
- wait(timeout);
- } catch (InterruptedException e) {
- // who cares?
- }
- if (extPointIDs == null)
- return null;
- return (String[]) extPointIDs.toArray(new String[extPointIDs.size()]);
- }
-
- public synchronized int waitFor(int events, long maxTimeout) {
- long startTime = System.currentTimeMillis();
- try {
- while (callbacks < events) {
- long currentTime = System.currentTimeMillis();
- long alreadyWaited = currentTime - startTime;
- if (alreadyWaited < 0)
- alreadyWaited = 0; // just in case if system timer is not very precise
- long timeToWait = maxTimeout - alreadyWaited;
- if (timeToWait <= 0) {
- wait(MIN_WAIT_TIME); // give it a last chance
- break; // timed out
- }
- wait(timeToWait);
- }
- } catch (InterruptedException e) {
- // breaks the cycle
- }
- return callbacks;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IRegistryEventListener#added(org.eclipse.core.runtime.IExtension[])
- */
- synchronized public void added(IExtension[] extensions) {
- extensionsToString(extensions);
- added = true;
- callbacks++;
- notify();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IRegistryEventListener#removed(org.eclipse.core.runtime.IExtension[])
- */
- synchronized public void removed(IExtension[] extensions) {
- extensionsToString(extensions);
- removed = true;
- callbacks++;
- notify();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IRegistryEventListener#added(org.eclipse.core.runtime.IExtensionPoint[])
- */
- synchronized public void added(IExtensionPoint[] extensionPoints) {
- extPointsToString(extensionPoints);
- added = true;
- callbacks++;
- notify();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IRegistryEventListener#removed(org.eclipse.core.runtime.IExtensionPoint[])
- */
- synchronized public void removed(IExtensionPoint[] extensionPoints) {
- extPointsToString(extensionPoints);
- removed = true;
- callbacks++;
- notify();
- }
-
- private void extensionsToString(IExtension[] extensions) {
- extensionIDs = new ArrayList(extensions.length);
- for (int i = 0; i < extensions.length; i++) {
- IExtension extension = extensions[i];
- extensionIDs.add(extension.getUniqueIdentifier());
-
- // test navigation: to extension point
- String ownerId = extension.getExtensionPointUniqueIdentifier();
- if (extPointId != null)
- assertTrue(extPointId.equals(ownerId));
- // test navigation: all children
- assertTrue(validContents(extension.getConfigurationElements()));
- }
- }
-
- private boolean validContents(IConfigurationElement[] children) {
- if (children == null)
- return true;
- for (int i = 0; i < children.length; i++) {
- if (!children[i].isValid())
- return false;
- if (!validContents(children[i].getChildren()))
- return false;
- }
- return true;
- }
-
- private void extPointsToString(IExtensionPoint[] extensionPoints) {
- extPointIDs = new ArrayList(extensionPoints.length);
- for (int i = 0; i < extensionPoints.length; i++)
- extPointIDs.add(extensionPoints[i].getUniqueIdentifier());
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/AllSimpleRegistryTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/AllSimpleRegistryTests.java
deleted file mode 100644
index e90d033..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/AllSimpleRegistryTests.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry.simple;
-
-import junit.framework.*;
-
-public class AllSimpleRegistryTests extends TestCase {
-
- public AllSimpleRegistryTests() {
- super(null);
- }
-
- public AllSimpleRegistryTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AllSimpleRegistryTests.class.getName());
- suite.addTest(XMLExtensionCreate.suite());
- suite.addTest(DirectExtensionCreate.suite());
- suite.addTest(XMLExecutableExtension.suite());
- suite.addTest(DirectExtensionCreateTwoRegistries.suite());
- suite.addTest(TokenAccess.suite());
- suite.addTest(XMLExtensionCreateEclipse.suite());
- suite.addTest(DirectExtensionRemove.suite());
- suite.addTest(MergeContribution.suite());
- suite.addTest(DuplicatePoints.suite());
- return suite;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/BaseExtensionRegistryRun.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/BaseExtensionRegistryRun.java
deleted file mode 100644
index 44e97ab..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/BaseExtensionRegistryRun.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry.simple;
-
-import java.io.*;
-import java.net.URL;
-import junit.framework.TestCase;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.spi.RegistryStrategy;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.osgi.framework.Bundle;
-
-public class BaseExtensionRegistryRun extends TestCase {
-
- // The imaging device registry
- protected IExtensionRegistry simpleRegistry;
- protected Object masterToken = new Object();
- protected Object userToken = new Object();
-
- // Path to the XML files
- private final static String xmlPath = "Plugin_Testing/registry/testSimple/"; //$NON-NLS-1$
-
- public BaseExtensionRegistryRun() {
- super();
- }
-
- public BaseExtensionRegistryRun(String name) {
- super(name);
- }
-
- protected URL getXML(String fileName) {
- return RuntimeTestsPlugin.getContext().getBundle().getEntry(xmlPath + fileName);
- }
-
- /**
- * Create the "imaging device" registry
- */
- protected void setUp() throws Exception {
- // create the imaging device registry
- simpleRegistry = startRegistry();
- }
-
- /**
- * Properly dispose of the extension registry
- */
- protected void tearDown() throws Exception {
- stopRegistry();
- }
-
- /**
- * @return - open extension registry
- */
- protected IExtensionRegistry startRegistry() {
- return startRegistry(this.getClass().getName());
- }
-
- /**
- * @return - open extension registry
- */
- protected IExtensionRegistry startRegistry(String subDir) {
- // use plugin's metadata directory to save cache data
- Bundle theBundle = RuntimeTestsPlugin.getContext().getBundle();
- IPath userDataPath = Platform.getStateLocation(theBundle);
- userDataPath = userDataPath.append(subDir);
-
- File[] registryLocations = new File[] {new File(userDataPath.toOSString())};
- boolean[] readOnly = new boolean[] {false};
- RegistryStrategy registryStrategy = new RegistryStrategy(registryLocations, readOnly);
- return RegistryFactory.createRegistry(registryStrategy, masterToken, userToken);
- }
-
- /**
- * Stops the extension registry.
- */
- protected void stopRegistry() {
- assertNotNull(simpleRegistry);
- simpleRegistry.stop(masterToken);
- }
-
- protected void processXMLContribution(IContributor nonBundleContributor, URL url) {
- processXMLContribution(nonBundleContributor, url, false);
- }
-
- protected void processXMLContribution(IContributor nonBundleContributor, URL url, boolean persist) {
- try {
- InputStream is = url.openStream();
- simpleRegistry.addContribution(is, nonBundleContributor, persist, url.getFile(), null, persist ? masterToken : userToken);
- } catch (IOException eFile) {
- fail(eFile.getMessage());
- return;
- }
- }
-
- protected String qualifiedName(String namespace, String simpleName) {
- return namespace + "." + simpleName; //$NON-NLS-1$
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DirectExtensionCreate.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DirectExtensionCreate.java
deleted file mode 100644
index d65996b..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DirectExtensionCreate.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry.simple;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.internal.registry.ExtensionRegistry;
-import org.eclipse.core.internal.registry.spi.ConfigurationElementAttribute;
-import org.eclipse.core.internal.registry.spi.ConfigurationElementDescription;
-import org.eclipse.core.runtime.*;
-
-/**
- * Tests programmatic creation of extension and extension point by using direct
- * methods on the ExtensionRegistry.
- *
- * Note that in present those methods are internal, but might be exposed as
- * APIs in the future.
- *
- * @since 3.2
- */
-public class DirectExtensionCreate extends BaseExtensionRegistryRun {
-
- public DirectExtensionCreate() {
- super();
- }
-
- public DirectExtensionCreate(String name) {
- super(name);
- }
-
- public void testExtensionPointAddition() {
- IContributor contributor = ContributorFactorySimple.createContributor("1"); //$NON-NLS-1$
- String extensionPointId = "DirectExtPoint"; //$NON-NLS-1$
- String extensionPointLabel = "Direct Extension Point"; //$NON-NLS-1$
- String extensionPointSchemaRef = "schema/ExtensionPointTest.exsd"; //$NON-NLS-1$
-
- /**********************************************************************************************
- * Add extension point:
- *
- * <extension-point id="DirectExtPoint"
- * name="Direct Extension Point"
- * schema="schema/ExtensionPointTest.exsd"/>
- *
- *********************************************************************************************/
-
- ((ExtensionRegistry) simpleRegistry).addExtensionPoint(extensionPointId, contributor, false, extensionPointLabel, extensionPointSchemaRef, userToken);
-
- String namespace = contributor.getName();
- IExtensionPoint extensionPoint = simpleRegistry.getExtensionPoint(qualifiedName(namespace, extensionPointId));
- assertNotNull(extensionPoint);
- assertTrue(extensionPointSchemaRef.equals(extensionPoint.getSchemaReference()));
- assertTrue(extensionPointLabel.equals(extensionPoint.getLabel()));
-
- // add second contribution in the same namespace
- String extensionPointAltId = "DirectExtPointAlt"; //$NON-NLS-1$
- String extensionPointAltLabel = "Second direct extension point"; //$NON-NLS-1$
- assertTrue(((ExtensionRegistry) simpleRegistry).addExtensionPoint(extensionPointAltId, contributor, false, extensionPointAltLabel, extensionPointSchemaRef, userToken));
-
- IExtensionPoint extensionPointAlt = simpleRegistry.getExtensionPoint(qualifiedName(namespace, extensionPointAltId));
- assertNotNull(extensionPointAlt);
- assertTrue(extensionPointSchemaRef.equals(extensionPointAlt.getSchemaReference()));
- assertTrue(extensionPointAltLabel.equals(extensionPointAlt.getLabel()));
-
- /**********************************************************************************************
- * Add extension:
- * <extension id="DirectExtensionID" name="Direct Extension" point="DirectExtPoint">
- * <StorageDevice deviceURL="theShienneMountain">
- * <BackupDevice backupURL="SkyLab"/>
- * <BackupDevice backupURL="OceanFloor"/>
- * </StorageDevice>
- * </extension>
- *********************************************************************************************/
- String extensionId = "DirectExtensionID"; //$NON-NLS-1$
- String extensionLabel = "Direct Extension"; //$NON-NLS-1$
-
- String nameChildDesc = "BackupDevice"; //$NON-NLS-1$
- String propNameChildDesc = "backupURL"; //$NON-NLS-1$
- String propValueChildDesc1 = "SkyLab"; //$NON-NLS-1$
- String propValueChildDesc2 = "OceanFloor"; //$NON-NLS-1$
-
- ConfigurationElementAttribute propChildDesc1 = new ConfigurationElementAttribute(propNameChildDesc, propValueChildDesc1);
- ConfigurationElementDescription childDesc1 = new ConfigurationElementDescription(nameChildDesc, propChildDesc1, null, null);
-
- ConfigurationElementAttribute propChildDesc2 = new ConfigurationElementAttribute(propNameChildDesc, propValueChildDesc2);
- ConfigurationElementDescription childDesc2 = new ConfigurationElementDescription(nameChildDesc, propChildDesc2, null, null);
-
- String extensionName = "StorageDevice"; //$NON-NLS-1$
- String extensionProrName1 = "deviceURL"; //$NON-NLS-1$
- String extensionPropValue1 = "theShienneMountain"; //$NON-NLS-1$
- String extensionProrName2 = "primary"; //$NON-NLS-1$
- String extensionPropValue2 = "true"; //$NON-NLS-1$
- ConfigurationElementAttribute prop1 = new ConfigurationElementAttribute(extensionProrName1, extensionPropValue1);
- ConfigurationElementAttribute prop2 = new ConfigurationElementAttribute(extensionProrName2, extensionPropValue2);
- String extensionValue = "SomeValue"; //$NON-NLS-1$
-
- ConfigurationElementDescription description = new ConfigurationElementDescription(extensionName, new ConfigurationElementAttribute[] {prop1, prop2}, extensionValue, new ConfigurationElementDescription[] {childDesc1, childDesc2});
-
- assertTrue(((ExtensionRegistry) simpleRegistry).addExtension(extensionId, contributor, false, extensionLabel, extensionPointId, description, userToken));
-
- IExtension[] namespaceExtensions = simpleRegistry.getExtensions(namespace);
- assertNotNull(namespaceExtensions);
- assertTrue(namespaceExtensions.length == 1);
- IExtension[] extensions = extensionPoint.getExtensions();
- assertNotNull(extensions);
- assertTrue(extensions.length == 1);
- for (int i = 0; i < extensions.length; i++) {
- IExtension extension = extensions[i];
- String storedExtensionId = extension.getUniqueIdentifier();
- assertTrue(storedExtensionId.equals(qualifiedName(namespace, extensionId)));
- String extensionNamespace = extension.getNamespaceIdentifier();
- assertTrue(extensionNamespace.equals(namespace));
- String extensionContributor = extension.getContributor().getName();
- assertTrue(extensionContributor.equals(namespace));
- IConfigurationElement[] configElements = extension.getConfigurationElements();
- assertNotNull(configElements);
- for (int j = 0; j < configElements.length; j++) {
- IConfigurationElement configElement = configElements[j];
- String configElementName = configElement.getName();
- assertTrue(configElementName.equals(extensionName));
- String configElementValue = configElement.getValue();
- assertTrue(configElementValue.equals(extensionValue));
- String[] attributeNames = configElement.getAttributeNames();
- assertTrue(attributeNames.length == 2);
- IConfigurationElement[] configElementChildren = configElement.getChildren();
- assertTrue(configElementChildren.length == 2);
- }
- }
- }
-
- public static Test suite() {
- return new TestSuite(DirectExtensionCreate.class);
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DirectExtensionCreateTwoRegistries.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DirectExtensionCreateTwoRegistries.java
deleted file mode 100644
index fc1de10..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DirectExtensionCreateTwoRegistries.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry.simple;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.internal.registry.ExtensionRegistry;
-import org.eclipse.core.runtime.*;
-
-/**
- * Test simultaneous work of two extension registries.
- * @since 3.2
- */
-public class DirectExtensionCreateTwoRegistries extends BaseExtensionRegistryRun {
-
- private String extensionPointId = "AAAid"; //$NON-NLS-1$
- private String extensionPointAltId = "BBBid"; //$NON-NLS-1$
- private String extensionPointSchemaRef = "schema/schema.exsd"; //$NON-NLS-1$
-
- private IExtensionRegistry theDeviceRegistryA;
- private IExtensionRegistry theDeviceRegistryB;
-
- public DirectExtensionCreateTwoRegistries() {
- super();
- }
-
- public DirectExtensionCreateTwoRegistries(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- startRegistries();
- }
-
- protected void tearDown() throws Exception {
- stopRegistries();
- }
-
- private void startRegistries() {
- theDeviceRegistryA = startRegistry("A"); //$NON-NLS-1$
- theDeviceRegistryB = startRegistry("B"); //$NON-NLS-1$
- }
-
- private void stopRegistries() {
- assertNotNull(theDeviceRegistryA);
- theDeviceRegistryA.stop(masterToken);
-
- assertNotNull(theDeviceRegistryB);
- theDeviceRegistryB.stop(masterToken);
- }
-
- public void testExtensionPointAddition() {
- // Test with non-bundle contributor
- IContributor nonBundleContributor = ContributorFactorySimple.createContributor("ABC"); //$NON-NLS-1$
- String namespace = nonBundleContributor.getName();
- checkEmptyRegistries(namespace); // make sure we don't have any leftovers
-
- fillRegistries(nonBundleContributor); // add one extension point in each registry
- checkRegistries(namespace); // check that they got into right places
-
- stopRegistries(); // check caches
- startRegistries();
- checkEmptyRegistries(namespace); // confirm that both registries got re-populated from caches
- }
-
- private void checkEmptyRegistries(String namespace) {
- // see what's in the registry A:
- IExtensionPoint extensionPoint = theDeviceRegistryA.getExtensionPoint(qualifiedName(namespace, extensionPointId));
- IExtensionPoint extensionPointAlt = theDeviceRegistryA.getExtensionPoint(qualifiedName(namespace, extensionPointAltId));
- assertNull(extensionPoint);
- assertNull(extensionPointAlt);
- }
-
- private void fillRegistries(IContributor contributor) {
- assertTrue(((ExtensionRegistry) theDeviceRegistryA).addExtensionPoint(extensionPointId, contributor, false, "LabelA", extensionPointSchemaRef, userToken)); //$NON-NLS-1$
- assertTrue(((ExtensionRegistry) theDeviceRegistryB).addExtensionPoint(extensionPointAltId, contributor, false, "LabelB", extensionPointSchemaRef, userToken)); //$NON-NLS-1$
- }
-
- private void checkRegistries(String namespace) {
- // see what's in the registry A:
- IExtensionPoint extensionPoint = theDeviceRegistryA.getExtensionPoint(qualifiedName(namespace, extensionPointId));
- IExtensionPoint extensionPointAlt = theDeviceRegistryA.getExtensionPoint(qualifiedName(namespace, extensionPointAltId));
- assertNotNull(extensionPoint);
- assertNull(extensionPointAlt);
-
- // see what's in the registry B:
- extensionPoint = theDeviceRegistryB.getExtensionPoint(qualifiedName(namespace, extensionPointId));
- extensionPointAlt = theDeviceRegistryB.getExtensionPoint(qualifiedName(namespace, extensionPointAltId));
- assertNull(extensionPoint);
- assertNotNull(extensionPointAlt);
- }
-
- public static Test suite() {
- return new TestSuite(DirectExtensionCreateTwoRegistries.class);
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DirectExtensionRemove.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DirectExtensionRemove.java
deleted file mode 100644
index 765b1f5..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DirectExtensionRemove.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry.simple;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.tests.internal.registry.simple.utils.SimpleRegistryListener;
-
-/**
- * Tests removal APIs using a simple registry.
- * @since 3.2
- */
-public class DirectExtensionRemove extends BaseExtensionRegistryRun {
-
- private final static String pointA = "PointA"; //$NON-NLS-1$
- private final static String pointB = "PointB"; //$NON-NLS-1$
-
- private final static String extensionA1 = "TestExtensionA1"; //$NON-NLS-1$
- private final static String extensionA2 = "TestExtensionA2"; //$NON-NLS-1$
-
- public DirectExtensionRemove() {
- super();
- }
-
- public DirectExtensionRemove(String name) {
- super(name);
- }
-
- // Fill the registry; remove half; check listener; check what's left
- public void testExtensionPointAddition() {
- IContributor nonBundleContributor = ContributorFactorySimple.createContributor("DirectRemoveProvider"); //$NON-NLS-1$
- String namespace = nonBundleContributor.getName();
- fillRegistry(nonBundleContributor);
- checkRegistryFull(namespace);
-
- SimpleRegistryListener listener = new SimpleRegistryListener();
- listener.register(simpleRegistry);
- remove(namespace);
-
- checkListener(listener);
- checkRegistryRemoved(namespace);
- listener.unregister(simpleRegistry);
- }
-
- private void fillRegistry(IContributor contributor) {
- processXMLContribution(contributor, getXML("RemovalTest.xml")); //$NON-NLS-1$
- }
-
- private void checkRegistryFull(String namespace) {
- IExtensionPoint extensionPointA = simpleRegistry.getExtensionPoint(qualifiedName(namespace, pointA));
- assertNotNull(extensionPointA);
- IExtensionPoint extensionPointB = simpleRegistry.getExtensionPoint(qualifiedName(namespace, pointB));
- assertNotNull(extensionPointB);
- IExtension[] extensionsA = extensionPointA.getExtensions();
- assertTrue(extensionsA.length == 2);
- IExtension[] extensionsB = extensionPointB.getExtensions();
- assertTrue(extensionsB.length == 2);
- }
-
- private void remove(String namespace) {
- IExtensionPoint extensionPointB = simpleRegistry.getExtensionPoint(qualifiedName(namespace, pointB));
- assertTrue(simpleRegistry.removeExtensionPoint(extensionPointB, userToken));
-
- IExtension extension = simpleRegistry.getExtension(qualifiedName(namespace, extensionA1));
- assertTrue(simpleRegistry.removeExtension(extension, userToken));
- }
-
- private void checkRegistryRemoved(String namespace) {
- IExtensionPoint extensionPointA = simpleRegistry.getExtensionPoint(qualifiedName(namespace, pointA));
- assertNotNull(extensionPointA);
- IExtensionPoint extensionPointB = simpleRegistry.getExtensionPoint(qualifiedName(namespace, pointB));
- assertNull(extensionPointB);
- IExtension[] extensionsA = extensionPointA.getExtensions();
- assertTrue(extensionsA.length == 1);
- String Id = extensionsA[0].getUniqueIdentifier();
- assertTrue(qualifiedName(namespace, extensionA2).equals(Id));
- }
-
- private void checkListener(SimpleRegistryListener listener) {
- IRegistryChangeEvent event = listener.getEvent(5000);
- IExtensionDelta[] deltas = event.getExtensionDeltas();
- assertTrue(deltas.length == 2);
- for (int i = 0; i < deltas.length; i++) {
- assertTrue(deltas[i].getKind() == IExtensionDelta.REMOVED);
- assertNotNull(deltas[i].getExtension());
- assertNotNull(deltas[i].getExtensionPoint());
- }
- }
-
- public static Test suite() {
- return new TestSuite(DirectExtensionRemove.class);
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DuplicatePoints.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DuplicatePoints.java
deleted file mode 100644
index 4c99a37..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/DuplicatePoints.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry.simple;
-
-import java.io.File;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.spi.RegistryStrategy;
-import org.eclipse.core.tests.internal.registry.simple.utils.HiddenLogRegistryStrategy;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.osgi.framework.Bundle;
-
-/**
- * Tests addition of extensions and extension points with duplicate IDs.
- * The duplicate extension points should be ignored.
- * The duplicate extensions should be added.
- * The rest of the XML contribution should not be affected.
- *
- * @since 3.2
- */
-public class DuplicatePoints extends BaseExtensionRegistryRun {
-
- private final static String errMsg1 = "Error: Ignored duplicate extension point \"testDuplicates.duplicateExtensionPoint\" supplied by \"2\"." + "Warning: Extensions supplied by \"2\" and \"1\" have the same Id: \"testDuplicates.duplicateExtension\".";
- private final static String errMsg2 = "Error: Ignored duplicate extension point \"testSame.duplicateExtensionPointSame\" supplied by \"3\"." + "Warning: Extensions supplied by \"3\" and \"3\" have the same Id: \"testSame.duplicateExtensionSame\".";
-
- public DuplicatePoints() {
- super();
- }
-
- public DuplicatePoints(String name) {
- super(name);
- }
-
- /**
- * Use registry strategy with modified logging
- * @return - open extension registry
- */
- protected IExtensionRegistry startRegistry() {
- // use plugin's metadata directory to save cache data
- Bundle theBundle = RuntimeTestsPlugin.getContext().getBundle();
- IPath userDataPath = Platform.getStateLocation(theBundle);
- File[] registryLocations = new File[] {new File(userDataPath.toOSString())};
- boolean[] readOnly = new boolean[] {false};
- RegistryStrategy registryStrategy = new HiddenLogRegistryStrategy(registryLocations, readOnly);
- return RegistryFactory.createRegistry(registryStrategy, masterToken, userToken);
- }
-
- public void testDuplicates() {
- HiddenLogRegistryStrategy.output = ""; //$NON-NLS-1$
- IContributor contributor1 = ContributorFactorySimple.createContributor("1"); //$NON-NLS-1$
- processXMLContribution(contributor1, getXML("DuplicatePoints1.xml")); //$NON-NLS-1$
-
- IContributor contributor2 = ContributorFactorySimple.createContributor("2"); //$NON-NLS-1$
- processXMLContribution(contributor2, getXML("DuplicatePoints2.xml")); //$NON-NLS-1$
-
- checkRegistryDifferent("testDuplicates"); //$NON-NLS-1$
-
- HiddenLogRegistryStrategy.output = ""; //$NON-NLS-1$
- IContributor contributor3 = ContributorFactorySimple.createContributor("3"); //$NON-NLS-1$
- processXMLContribution(contributor3, getXML("DuplicatePointsSame.xml")); //$NON-NLS-1$
-
- checkRegistrySame("testSame"); //$NON-NLS-1$
- }
-
- private void checkRegistryDifferent(String namespace) {
- assertTrue(errMsg1.equals(HiddenLogRegistryStrategy.output));
-
- IExtensionPoint[] extensionPoints = simpleRegistry.getExtensionPoints(namespace);
- assertTrue(extensionPoints.length == 2);
-
- IExtension[] extensions = simpleRegistry.getExtensions(namespace);
- assertTrue(extensions.length == 3);
-
- IExtension extension = simpleRegistry.getExtension(qualifiedName(namespace, "nonDuplicateExtension")); //$NON-NLS-1$
- assertNotNull(extension);
- }
-
- private void checkRegistrySame(String namespace) {
- assertTrue(errMsg2.equals(HiddenLogRegistryStrategy.output));
-
- IExtensionPoint[] extensionPoints = simpleRegistry.getExtensionPoints(namespace);
- assertTrue(extensionPoints.length == 1);
-
- IExtension[] extensions = simpleRegistry.getExtensions(namespace);
- assertTrue(extensions.length == 2);
- }
-
- public static Test suite() {
- return new TestSuite(DuplicatePoints.class);
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/MergeContribution.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/MergeContribution.java
deleted file mode 100644
index ddbc9fa..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/MergeContribution.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry.simple;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.*;
-
-/**
- * Tests merging static and dynamic contributions.
- *
- * @since 3.2
- */
-public class MergeContribution extends BaseExtensionRegistryRun {
-
- public MergeContribution() {
- super();
- }
-
- public MergeContribution(String name) {
- super(name);
- }
-
- public void testMergeStaticDynamic() {
- // Test with non-bundle contributor
- IContributor nonBundleContributor = ContributorFactorySimple.createContributor("ABC"); //$NON-NLS-1$
- String namespace = nonBundleContributor.getName();
-
- fillRegistryStatic(nonBundleContributor);
- checkRegistry(namespace, 3);
- fillRegistryDynamic(nonBundleContributor);
- checkRegistry(namespace, 6);
-
- stopRegistry();
- simpleRegistry = startRegistry();
-
- checkRegistry(namespace, 3);
- fillRegistryDynamic(nonBundleContributor);
- checkRegistry(namespace, 6);
- }
-
- private void fillRegistryStatic(IContributor contributor) {
- processXMLContribution(contributor, getXML("MergeStatic.xml"), true); //$NON-NLS-1$
- }
-
- private void fillRegistryDynamic(IContributor contributor) {
- processXMLContribution(contributor, getXML("MergeDynamic.xml"), false); //$NON-NLS-1$
- }
-
- private void checkRegistry(String namespace, int expectedExtensions) {
- IExtensionPoint extensionPoint = simpleRegistry.getExtensionPoint(qualifiedName(namespace, "MergeStatic")); //$NON-NLS-1$
- assertNotNull(extensionPoint);
- IExtension[] extensions = simpleRegistry.getExtensions(namespace);
- assertNotNull(extensions);
- assertTrue(extensions.length == expectedExtensions);
- }
-
- public static Test suite() {
- return new TestSuite(MergeContribution.class);
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/TokenAccess.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/TokenAccess.java
deleted file mode 100644
index fa3a287..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/TokenAccess.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry.simple;
-
-import junit.framework.*;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.RegistryFactory;
-
-/**
- * Tests registry token-based access rules.
- * @since 3.2
- */
-public class TokenAccess extends TestCase {
-
- public TokenAccess() {
- super();
- }
-
- public TokenAccess(String name) {
- super(name);
- }
-
- /**
- * Tests token access to sensetive registry methods
- */
- public void testControlledAccess() {
- Object tokenGood = new Object();
- Object tokenBad = new Object();
-
- // registry created with no token
- IExtensionRegistry registry = RegistryFactory.createRegistry(null, null, null);
- assertNotNull(registry);
- // and stopped with no token - should be no exception
- registry.stop(null);
-
- // registry created with no token
- registry = RegistryFactory.createRegistry(null, null, null);
- assertNotNull(registry);
- // and stopped with a bad - should be no exception
- registry.stop(tokenBad);
-
- // registry created with a good token
- registry = RegistryFactory.createRegistry(null, tokenGood, null);
- assertNotNull(registry);
- // and stopped with a good token - should be no exception
- registry.stop(tokenGood);
-
- // registry created with a good token
- registry = RegistryFactory.createRegistry(null, tokenGood, null);
- assertNotNull(registry);
- // and stopped with a bad token - should be an exception
- boolean bException = false;
- try {
- registry.stop(tokenBad);
- } catch (IllegalArgumentException e) {
- // this is good; this is expected
- bException = true;
- }
- assertTrue(bException);
- }
-
- public static Test suite() {
- return new TestSuite(TokenAccess.class);
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/XMLExecutableExtension.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/XMLExecutableExtension.java
deleted file mode 100644
index 23a6e4b..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/XMLExecutableExtension.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry.simple;
-
-import java.io.File;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.spi.RegistryStrategy;
-import org.eclipse.core.tests.internal.registry.simple.utils.*;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.osgi.framework.Bundle;
-
-/**
- * Tests that executable extensions present in the simple registry actually
- * gets processed.
- * @since 3.2
- */
-public class XMLExecutableExtension extends BaseExtensionRegistryRun {
-
- public XMLExecutableExtension() {
- super();
- }
-
- public XMLExecutableExtension(String name) {
- super(name);
- }
-
- /**
- * Provide own class loader to the registry executable element strategry
- * @return - open extension registry
- */
- protected IExtensionRegistry startRegistry() {
- // use plugin's metadata directory to save cache data
- Bundle theBundle = RuntimeTestsPlugin.getContext().getBundle();
- IPath userDataPath = Platform.getStateLocation(theBundle);
- File[] registryLocations = new File[] {new File(userDataPath.toOSString())};
- boolean[] readOnly = new boolean[] {false};
- RegistryStrategy registryStrategy = new ExeExtensionStrategy(registryLocations, readOnly);
- return RegistryFactory.createRegistry(registryStrategy, masterToken, userToken);
- }
-
- public void testExecutableExtensionCreation() {
- // Test with non-bundle contributor
- IContributor nonBundleContributor = ContributorFactorySimple.createContributor("ABC"); //$NON-NLS-1$
- assertFalse(ExecutableRegistryObject.createCalled);
-
- fillRegistry(nonBundleContributor);
- assertFalse(ExecutableRegistryObject.createCalled);
-
- checkRegistry(nonBundleContributor.getName());
- assertTrue(ExecutableRegistryObject.createCalled);
- }
-
- private void fillRegistry(IContributor contributor) {
- processXMLContribution(contributor, getXML("ExecutableExtension.xml")); //$NON-NLS-1$
- }
-
- private void checkRegistry(String namespace) {
- IConfigurationElement[] elements = simpleRegistry.getConfigurationElementsFor(qualifiedName(namespace, "XMLExecutableExtPoint")); //$NON-NLS-1$
- assertTrue(elements.length == 1);
- for (int i = 0; i < elements.length; i++) {
- try {
- Object object = elements[i].createExecutableExtension("class"); //$NON-NLS-1$
- assertNotNull(object);
- } catch (CoreException e) {
- assertTrue(false);
- e.printStackTrace();
- }
- }
- }
-
- public static Test suite() {
- return new TestSuite(XMLExecutableExtension.class);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/XMLExtensionCreate.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/XMLExtensionCreate.java
deleted file mode 100644
index a24d0a1..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/XMLExtensionCreate.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry.simple;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.tests.internal.registry.simple.utils.SimpleRegistryListener;
-
-/**
- * Tests addition of extension point and the extension to the registry via
- * XML contribution. Makes sure that items are actually added; checks
- * listener notification; reloads registry from cache and re-checks the data.
- *
- * @since 3.2
- */
-public class XMLExtensionCreate extends BaseExtensionRegistryRun {
-
- public XMLExtensionCreate() {
- super();
- }
-
- public XMLExtensionCreate(String name) {
- super(name);
- }
-
- public void testExtensionPointAddition() {
- SimpleRegistryListener listener = new SimpleRegistryListener();
- listener.register(simpleRegistry);
-
- // Test with non-bundle contributor
- IContributor nonBundleContributor = ContributorFactorySimple.createContributor("ABC"); //$NON-NLS-1$
- fillRegistry(nonBundleContributor);
-
- String namespace = nonBundleContributor.getName();
- checkListener(namespace, listener);
- checkRegistry(nonBundleContributor.getName());
-
- listener.unregister(simpleRegistry);
-
- // check the cache: stop -> re-start
- stopRegistry();
- startRegistry();
- checkRegistry(nonBundleContributor.getName());
- }
-
- private void fillRegistry(IContributor contributor) {
- // Add extension point
- processXMLContribution(contributor, getXML("ExtensionPoint.xml")); //$NON-NLS-1$
- // Add extension
- processXMLContribution(contributor, getXML("Extension.xml")); //$NON-NLS-1$
- }
-
- private void checkRegistry(String namespace) {
- IExtensionPoint extensionPoint = simpleRegistry.getExtensionPoint(qualifiedName(namespace, "XMLDirectExtPoint")); //$NON-NLS-1$
- assertNotNull(extensionPoint);
- IExtension[] namespaceExtensions = simpleRegistry.getExtensions(namespace);
- assertNotNull(namespaceExtensions);
- assertTrue(namespaceExtensions.length == 1);
- IExtension[] extensions = extensionPoint.getExtensions();
- assertNotNull(extensions);
- assertTrue(extensions.length == 1);
- for (int i = 0; i < extensions.length; i++) {
- IExtension extension = extensions[i];
- String extensionId = extension.getUniqueIdentifier();
- assertTrue(extensionId.equals(qualifiedName(namespace, "XMLDirectExtensionID"))); //$NON-NLS-1$
- String extensionNamespace = extension.getNamespaceIdentifier();
- assertTrue(extensionNamespace.equals(namespace));
- String extensionContributor = extension.getContributor().getName();
- assertTrue(extensionContributor.equals(namespace));
- IConfigurationElement[] configElements = extension.getConfigurationElements();
- assertNotNull(configElements);
- for (int j = 0; j < configElements.length; j++) {
- IConfigurationElement configElement = configElements[j];
- String configElementName = configElement.getName();
- assertTrue(configElementName.equals("StorageDevice")); //$NON-NLS-1$
- String[] attributeNames = configElement.getAttributeNames();
- assertTrue(attributeNames.length == 1);
- IConfigurationElement[] configElementChildren = configElement.getChildren();
- assertTrue(configElementChildren.length == 2);
- }
- }
- }
-
- private void checkListener(String namespace, SimpleRegistryListener listener) {
- IRegistryChangeEvent event = listener.getEvent(5000);
- IExtensionDelta[] deltas = event.getExtensionDeltas();
- assertTrue(deltas.length == 1); // only one notification
- for (int i = 0; i < deltas.length; i++) {
- IExtensionDelta delta = deltas[i];
- assertTrue(delta.getKind() == IExtensionDelta.ADDED);
- IExtensionPoint theExtensionPoint = delta.getExtensionPoint();
- IExtension theExtension = delta.getExtension();
- String Id1 = theExtension.getExtensionPointUniqueIdentifier();
- String Id2 = theExtensionPoint.getUniqueIdentifier();
- assertTrue(Id1.equals(Id2)); // check connectivity
- assertTrue(Id1.equals(qualifiedName(namespace, "XMLDirectExtPoint"))); //$NON-NLS-1$
- }
- }
-
- public static Test suite() {
- return new TestSuite(XMLExtensionCreate.class);
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/XMLExtensionCreateEclipse.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/XMLExtensionCreateEclipse.java
deleted file mode 100644
index 2618f01..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/XMLExtensionCreateEclipse.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry.simple;
-
-import java.io.IOException;
-import java.net.URL;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.internal.registry.ExtensionRegistry;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.osgi.framework.Bundle;
-
-/**
- * Check dynamic contribution into the Eclipse registry itself.
- * @since 3.2
- */
-public class XMLExtensionCreateEclipse extends BaseExtensionRegistryRun {
-
- public void testDynamicContribution() {
- // specify this bundle as a contributor
- Bundle thisBundle = RuntimeTestsPlugin.getContext().getBundle();
- IContributor thisContributor = ContributorFactoryOSGi.createContributor(thisBundle);
- fillRegistry(thisContributor);
- checkRegistry(thisContributor.getName());
- }
-
- private void fillRegistry(IContributor contributor) {
- try {
- Object userKey = ((ExtensionRegistry) RegistryFactory.getRegistry()).getTemporaryUserToken();
- URL xmlURL = getXML("DynamicExtension.xml"); //$NON-NLS-1$
- RegistryFactory.getRegistry().addContribution(xmlURL.openStream(), contributor, false, xmlURL.getFile(), null, userKey);
- } catch (IOException eFile) {
- fail(eFile.getMessage());
- return;
- }
- }
-
- private void checkRegistry(String namespace) {
- IExtensionRegistry eclipseRegistry = RegistryFactory.getRegistry();
- String uniqueId = qualifiedName(namespace, "XMLDirectExtPoint"); //$NON-NLS-1$
- IExtensionPoint dynamicExtensionPoint = eclipseRegistry.getExtensionPoint(uniqueId);
- assertNotNull(dynamicExtensionPoint);
- IConfigurationElement[] elements = eclipseRegistry.getConfigurationElementsFor(uniqueId);
- assertTrue(elements.length == 1);
- for (int i = 0; i < elements.length; i++) {
- assertTrue("org.eclipse.core.tests.internal.registry.simple.utils.ExecutableRegistryObject".equals(elements[i].getAttribute("class")));
- }
- }
-
- public static Test suite() {
- return new TestSuite(XMLExtensionCreateEclipse.class);
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/ExeExtensionStrategy.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/ExeExtensionStrategy.java
deleted file mode 100644
index e37256d..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/ExeExtensionStrategy.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry.simple.utils;
-
-import java.io.File;
-import org.eclipse.core.runtime.spi.RegistryContributor;
-import org.eclipse.core.runtime.spi.RegistryStrategy;
-
-/**
- * Registry strategy that uses class loader from this bundle to process executable
- * extensions.
- * @since 3.2
- */
-public class ExeExtensionStrategy extends RegistryStrategy {
-
- public ExeExtensionStrategy(File[] theStorageDir, boolean[] cacheReadOnly) {
- super(theStorageDir, cacheReadOnly);
- }
-
- public Object createExecutableExtension(RegistryContributor defaultContributor, String className, String requestedContributorName) {
- Class classInstance = null;
- try {
- classInstance = Class.forName(className);
- } catch (ClassNotFoundException e1) {
- e1.printStackTrace();
- return null;
- }
-
- // create a new instance
- Object result = null;
- try {
- result = classInstance.newInstance();
- } catch (Exception e1) {
- e1.printStackTrace();
- return null;
- }
-
- return result;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/ExecutableRegistryObject.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/ExecutableRegistryObject.java
deleted file mode 100644
index 8be2965..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/ExecutableRegistryObject.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry.simple.utils;
-
-import org.eclipse.core.runtime.*;
-
-/**
- * Test class for the executable extensions.
- * @since 3.2
- */
-public class ExecutableRegistryObject implements IExecutableExtensionFactory {
-
- public static boolean createCalled = false;
-
- public ExecutableRegistryObject() {
- // intentionally left empty
- }
-
- public Object create() throws CoreException {
- if (createCalled) {
- Status status = new Status(IStatus.ERROR, "org.eclipse.core.tests.runtime", 0, "Duplicate executable extension call.", null); //$NON-NLS-1$ //$NON-NLS-2$
- throw new CoreException(status);
- }
- createCalled = true;
- return new ExecutableRegistryObject();
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/HiddenLogRegistryStrategy.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/HiddenLogRegistryStrategy.java
deleted file mode 100644
index b99a691..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/HiddenLogRegistryStrategy.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry.simple.utils;
-
-import java.io.File;
-import org.eclipse.core.internal.registry.RegistryMessages;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.spi.RegistryStrategy;
-
-/**
- * Registry strategy that keeps log output in an accessible string.
- * @since 3.2
- */
-public class HiddenLogRegistryStrategy extends RegistryStrategy {
-
- public static String output;
-
- public HiddenLogRegistryStrategy(File[] theStorageDir, boolean[] cacheReadOnly) {
- super(theStorageDir, cacheReadOnly);
- }
-
- public boolean debug() {
- return true;
- }
-
- public void log(IStatus status) {
- log(status, null);
- }
-
- // Same as RegistryStrategy, but logs into String
- public void log(IStatus status, String prefix) {
- String message = status.getMessage();
- int severity = status.getSeverity();
-
- String statusMsg;
- switch (severity) {
- case IStatus.ERROR :
- statusMsg = RegistryMessages.log_error;
- break;
- case IStatus.WARNING :
- statusMsg = RegistryMessages.log_warning;
- break;
- default :
- statusMsg = RegistryMessages.log_log;
- break;
- }
- statusMsg += message;
-
- if (prefix != null)
- statusMsg = prefix + statusMsg;
- output += statusMsg;
-
- // print out children as well
- IStatus[] children = status.getChildren();
- if (children.length != 0) {
- String newPrefix;
- if (prefix == null)
- newPrefix = "\t"; //$NON-NLS-1$
- else
- newPrefix = prefix + "\t"; //$NON-NLS-1$
- for (int i = 0; i < children.length; i++) {
- log(children[i], newPrefix);
- }
- }
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/SimpleRegistryListener.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/SimpleRegistryListener.java
deleted file mode 100644
index 93e50da..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/SimpleRegistryListener.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.registry.simple.utils;
-
-import java.util.LinkedList;
-import java.util.List;
-import org.eclipse.core.runtime.*;
-
-/**
- * Allows test cases to wait for event notification so they can make assertions on the event.
- * Similar to org.eclipse.core.tests.harness.TestRegistryChangeListener.
- * @since 3.2
- */
-public class SimpleRegistryListener implements IRegistryChangeListener {
-
- private List events = new LinkedList();
-
- public synchronized void registryChanged(IRegistryChangeEvent newEvent) {
- events.add(newEvent);
- notify();
- }
-
- /**
- * Returns the first event that is received, blocking for at most <code>timeout</code> milliseconds.
- * Returns <code>null</code> if a event was not received for the time allowed.
- *
- * @param timeout the maximum time to wait in milliseconds. If zero, this method will
- * block until an event is received
- * @return the first event received, or <code>null</code> if none was received
- */
- public synchronized IRegistryChangeEvent getEvent(long timeout) {
- if (!events.isEmpty())
- return (IRegistryChangeEvent) events.remove(0);
- try {
- wait(timeout);
- } catch (InterruptedException e) {
- // nothing to do
- }
- return events.isEmpty() ? null : (IRegistryChangeEvent) events.remove(0);
- }
-
- public void register(IExtensionRegistry registry) {
- registry.addRegistryChangeListener(this);
- }
-
- public void unregister(IExtensionRegistry registry) {
- registry.removeRegistryChangeListener(this);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/AllTests.java
deleted file mode 100644
index daeaac2..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/AllTests.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.runtime;
-
-import junit.framework.*;
-
-public class AllTests extends TestCase {
- /**
- * AllTests constructor comment.
- * @param name java.lang.String
- */
- public AllTests() {
- super(null);
- }
-
- /**
- * AllTests constructor comment.
- * @param name java.lang.String
- */
- public AllTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AllTests.class.getName());
- suite.addTest(AuthorizationDatabaseTest.suite());
- suite.addTest(CipherStreamsTest.suite());
- suite.addTest(CipherTest.suite());
- suite.addTest(LogSerializationTest.suite());
- suite.addTest(PlatformURLLocalTest.suite());
- suite.addTest(PlatformURLSessionTest.suite());
- suite.addTest(FileLocatorTest.suite());
- return suite;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/AuthorizationDatabaseTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/AuthorizationDatabaseTest.java
deleted file mode 100644
index c7ef308..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/AuthorizationDatabaseTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.runtime;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Hashtable;
-import java.util.Map;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.internal.runtime.auth.AuthorizationDatabase;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-
-public class AuthorizationDatabaseTest extends RuntimeTest {
- public AuthorizationDatabaseTest() {
- super(null);
- }
-
- public AuthorizationDatabaseTest(String name) {
- super(name);
- }
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(suite());
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AuthorizationDatabaseTest.class.getName());
- suite.addTest(new AuthorizationDatabaseTest("test1"));
- suite.addTest(new AuthorizationDatabaseTest("test2"));
- suite.addTest(new AuthorizationDatabaseTest("test3"));
- return suite;
- }
-
- public void test1() {
- File file = new File(Platform.getLocation().toFile(), Long.toString(System.currentTimeMillis()) + ".auth");
- try {
- String filename = file.getAbsolutePath();
- String password = "testing";
- if (file.exists()) {
- file.delete();
- }
-
- AuthorizationDatabase db = new AuthorizationDatabase(filename, password);
-
- URL serverUrl = new URL("http://www.oti.com/");
- URL resourceUrl = new URL("http://www.oti.com/folder/");
- String realm = "WallyWorld";
- String authScheme = "Basic";
- Map info = new Hashtable(2);
- info.put("username", "jonathan");
- info.put("password", "testing");
-
- db.addAuthorizationInfo(serverUrl, realm, authScheme, info);
- db.addProtectionSpace(resourceUrl, realm);
-
- db.save();
-
- db = new AuthorizationDatabase(filename, password);
-
- info = db.getAuthorizationInfo(serverUrl, realm, authScheme);
- assertEquals("00", "jonathan", info.get("username"));
- assertEquals("01", "testing", info.get("password"));
-
- assertEquals("02", realm, db.getProtectionSpace(resourceUrl));
- assertEquals("03", realm, db.getProtectionSpace(new URL(resourceUrl.toString() + "file")));
- } catch (Exception e) {
- assertTrue("04", false);
- } finally {
- file.delete();
- }
-
- }
-
- public void test2() {
- AuthorizationDatabase db = new AuthorizationDatabase();
-
- URL url1 = null;
- URL url2 = null;
- try {
- url1 = new URL("http://www.oti.com/file1");
- url2 = new URL("http://www.oti.com/folder1/");
- } catch (MalformedURLException e) {
- assertTrue("00", false);
- }
-
- String realm1 = "realm1";
- String realm2 = "realm2";
-
- db.addProtectionSpace(url1, realm1);
-
- assertEquals("00", realm1, db.getProtectionSpace(url1));
- assertEquals("01", realm1, db.getProtectionSpace(url2));
-
- db.addProtectionSpace(url2, realm1);
-
- assertEquals("02", realm1, db.getProtectionSpace(url1));
- assertEquals("03", realm1, db.getProtectionSpace(url2));
-
- db.addProtectionSpace(url2, realm2);
-
- assertTrue("04", db.getProtectionSpace(url1) == null);
- assertEquals("05", realm2, db.getProtectionSpace(url2));
-
- db.addProtectionSpace(url1, realm1);
-
- assertEquals("05", realm1, db.getProtectionSpace(url1));
- assertEquals("06", realm1, db.getProtectionSpace(url2));
- }
-
- public void test3() {
- AuthorizationDatabase db = new AuthorizationDatabase();
-
- URL url1 = null;
- try {
- url1 = new URL("http://www.oti.com");
- } catch (MalformedURLException e) {
- assertTrue("00", false);
- }
-
- Hashtable info = new Hashtable(2);
- db.addAuthorizationInfo(url1, "realm1", "Basic", info);
-
- assertTrue("01", db.getAuthorizationInfo(url1, "realm1", "Basic") != null);
- db.flushAuthorizationInfo(url1, "realm1", "Basic");
- assertTrue("02", db.getAuthorizationInfo(url1, "realm1", "Basic") == null);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/CipherStreamsTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/CipherStreamsTest.java
deleted file mode 100644
index 066d2ca..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/CipherStreamsTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.runtime;
-
-import java.io.*;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.internal.runtime.auth.CipherInputStream;
-import org.eclipse.core.internal.runtime.auth.CipherOutputStream;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-
-public class CipherStreamsTest extends RuntimeTest {
- public CipherStreamsTest() {
- super(null);
- }
-
- public CipherStreamsTest(String name) {
- super(name);
- }
-
- protected void doCipherTest(String password, byte[] data) {
- try {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- CipherOutputStream cos = new CipherOutputStream(baos, password);
- cos.write(data);
- cos.close();
-
- byte[] encryptedData = baos.toByteArray();
- ByteArrayInputStream bais = new ByteArrayInputStream(encryptedData);
- CipherInputStream cis = new CipherInputStream(bais, password);
- byte[] decryptedData = new byte[data.length];
- cis.read(decryptedData);
- assertTrue("01", cis.read() == -1);
- cis.close();
-
- assertEquals("02", data.length, decryptedData.length);
- for (int i = 0; i < data.length; ++i) {
- assertEquals("03." + i, data[i], decryptedData[i]);
- }
- } catch (IOException e) {
- fail("99", e);
- }
- }
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(suite());
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(CipherStreamsTest.class.getName());
- suite.addTest(new CipherStreamsTest("test1"));
- return suite;
- }
-
- protected String getLongMessage() {
- return "This is a test!This is a test!This is a test!This is a test!This is a test!" + "este e' o meu conteudo (portuguese)there is no imagination for more sentences" + "este e' o meu conteudo (portuguese)there is no imagination for more sentences" + "este e' o meu conteudo (portuguese)there is no imagination for more sentences" + "este e' o meu conteudo (portuguese)there is no imagination for more sentences" + "This is a very long message that contains quite a lot of bytes and thus" + "may prove to make for a more interesting test case than the far simpler" + "(and admittedly mundane) messages that are also included in this test" + "este e' o meu conteudo (portuguese)there is no imagination for more sentences"
- + "este e' o meu conteudo (portuguese)there is no imagination for more sentences" + "este e' o meu conteudo (portuguese)there is no imagination for more sentences";
- }
-
- protected String[] getMessages() {
- return new String[] {"This is a test!", "", "a", getLongMessage(), getVeryLongMessage(),};
- }
-
- protected String[] getPasswords() {
- return new String[] {"", "pasord", " ", "This is a very long password that contains quite a lot of bytes and thus" + "may prove to make for a more interesting test case than the far simpler" + "(and admittedly mundane) passwords that are also included in this array",};
- }
-
- protected String getVeryLongMessage() {
- StringBuffer message = new StringBuffer(1000);
- while (message.length() < 5300) {
- message.append(getLongMessage());
- }
- return message.toString();
- }
-
- public void test1() {
- String[] passwords = getPasswords();
- String[] messages = getMessages();
- for (int i = 0; i < messages.length; i++) {
- byte[] data = messages[i].getBytes();
- for (int j = 0; j < passwords.length; j++) {
- doCipherTest(passwords[j], data);
- }
- }
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/CipherTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/CipherTest.java
deleted file mode 100644
index e00c39a..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/CipherTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.runtime;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.internal.runtime.auth.Cipher;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-
-public class CipherTest extends RuntimeTest {
- public CipherTest() {
- super(null);
- }
-
- public CipherTest(String name) {
- super(name);
- }
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(suite());
- }
-
- public static Test suite() {
- return new TestSuite(CipherTest.class);
- // TestSuite suite = new TestSuite();
- // suite.addTest(new CipherTest("test1"));
- // return suite;
- }
-
- public void test1() {
- try {
- String[] passwords = getPasswords();
- String[] messages = getMessages();
- for (int i = 0; i < messages.length; i++) {
- byte[] data = messages[i].getBytes();
- for (int j = 0; j < passwords.length; j++) {
- doCipherTest(passwords[j], data);
- }
- }
- } catch (Exception e) {
- fail("04", e);
- }
- }
-
- public void testDifferentChunkSizes() {
- //read and write different chunk sizes at once. Should still decrypt to
- //be the same bytes
- byte[] inputBytes = "This is the message that will be encrypted.".getBytes();
- String password = "music";
-
- //encrypt first ten bytes, then remaining bytes
- try {
- Cipher cipher = new Cipher(Cipher.ENCRYPT_MODE, password);
- byte[] encrypted1 = cipher.cipher(inputBytes, 0, 10);
- //introduce some noise by encrypting an empty array
- cipher.cipher(new byte[0]);
- byte[] encrypted2 = cipher.cipher(inputBytes, 10, inputBytes.length - 10);
- byte[] fullEncrypted = new byte[encrypted1.length + encrypted2.length];
- System.arraycopy(encrypted1, 0, fullEncrypted, 0, encrypted1.length);
- System.arraycopy(encrypted2, 0, fullEncrypted, encrypted1.length, encrypted2.length);
-
- cipher = new Cipher(Cipher.DECRYPT_MODE, password);
- //introduce some noise by decrypting an empty array
- cipher.cipher(new byte[0]);
- //now decrypt all at once
- byte[] result = cipher.cipher(fullEncrypted);
-
- assertEquals("1.0", inputBytes.length, result.length);
- for (int i = 0; i < inputBytes.length; i++) {
- assertEquals("2." + i, inputBytes[i], result[i]);
- }
- } catch (Exception e) {
- fail("1.99", e);
- }
- }
-
- protected String[] getMessages() {
- return new String[] {"This is a test a test!", "", "a", getLongMessage(), getVeryLongMessage(),};
- }
-
- protected String getLongMessage() {
- return "This is a test!This is a test!This is a test!This is a test!This is a test!" + "este e' o meu conteudo (portuguese)there is no imagination for more sentences" + "este e' o meu conteudo (portuguese)there is no imagination for more sentences" + "este e' o meu conteudo (portuguese)there is no imagination for more sentences" + "este e' o meu conteudo (portuguese)there is no imagination for more sentences" + "This is a very long message that contains quite a lot of bytes and thus" + "may prove to make for a more interesting test case than the far simpler" + "(and admittedly mundane) messages that are also included in this test" + "este e' o meu conteudo (portuguese)there is no imagination for more sentences"
- + "este e' o meu conteudo (portuguese)there is no imagination for more sentences" + "este e' o meu conteudo (portuguese)there is no imagination for more sentences" + "este e' o meu conteudo (portuguese)there is no imagination for more sentences" + "este e' o meu conteudo (portuguese)there is no imagination for more sentences";
- }
-
- protected String[] getPasswords() {
- return new String[] {"", "password", "a", "This is a very long password that contains quite a lot of bytes and thus" + "may prove to make for a more interesting test case than the far simpler" + "(and admittedly mundane) passwords that are also included in this array",};
- }
-
- protected String getVeryLongMessage() {
- StringBuffer message = new StringBuffer(1000);
- while (message.length() < 5000) {
- message.append(getLongMessage());
- }
- return message.toString();
- }
-
- protected void doCipherTest(String password, byte[] data) throws Exception {
- Cipher cipher = new Cipher(Cipher.ENCRYPT_MODE, password);
- byte[] encryptedData = cipher.cipher(data);
- assertEquals("00", data.length, encryptedData.length);
-
- cipher = new Cipher(Cipher.DECRYPT_MODE, password);
- byte[] decryptedData = cipher.cipher(encryptedData);
- assertEquals("02", data.length, decryptedData.length);
- for (int i = 0; i < data.length; ++i) {
- assertEquals("03." + i, data[i], decryptedData[i]);
- }
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/FileLocatorTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/FileLocatorTest.java
deleted file mode 100644
index 85f3614..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/FileLocatorTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.runtime;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import junit.framework.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.tests.harness.BundleTestingHelper;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.osgi.framework.*;
-
-public class FileLocatorTest extends TestCase {
-
- private final static String searchLocation = "$nl$/intro/messages.properties";
-
- private final static String nl = "aa_BB"; // make sure we have a stable NL value
-
- private final static String mostSpecificPath = "/nl/aa/BB/intro/messages.properties";
- private final static String lessSpecificPath = "/nl/aa/intro/messages.properties";
- private final static String nonSpecificPath = "/intro/messages.properties";
-
- public FileLocatorTest(String name) {
- super(name);
- }
-
- public void testFileLocatorFind() throws IOException, BundleException {
- Bundle bundle = BundleTestingHelper.installBundle("Plugin", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "fileLocator/testFileLocator");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle});
- Bundle fragment = BundleTestingHelper.installBundle("Fragment", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "fileLocator/testFileLocator.nl");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {fragment});
-
- IPath path = new Path(searchLocation);
- Map map = new HashMap(1);
- map.put("$nl$", nl);
-
- URL oneSolution = FileLocator.find(bundle, path, map);
- assertNotNull(oneSolution);
- assertTrue(oneSolution.getPath().equals(mostSpecificPath));
- assertBundleURL(oneSolution);
-
- URL[] solutions = FileLocator.findEntries(bundle, path, map);
-
- // expected:
- // Bundle/nl/aa/BB/intro/messages.properties,
- // Fragment/nl/aa/BB/intro/messages.properties,
- // Bundle/nl/aa/intro/messages.properties,
- // Fragment/nl/aa/intro/messages.properties,
- // Bundle/121/intro/messages.properties
-
- assertTrue(solutions.length == 5);
-
- assertTrue(solutions[0].getPath().equals(mostSpecificPath));
- assertBundleURL(solutions[0]);
- assertTrue(solutions[1].getPath().equals(mostSpecificPath));
- assertFragmentURL(solutions[1]);
-
- assertTrue(solutions[2].getPath().equals(lessSpecificPath));
- assertBundleURL(solutions[2]);
- assertTrue(solutions[3].getPath().equals(lessSpecificPath));
- assertFragmentURL(solutions[3]);
-
- assertTrue(solutions[4].getPath().equals(nonSpecificPath));
- assertBundleURL(solutions[4]);
-
- // remove the first bundle
- fragment.uninstall();
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {fragment});
- bundle.uninstall();
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle});
- }
-
- public void testFileLocatorGetBundleFile() throws BundleException, IOException {
- // test for bug 198447
- // install the bundle via reference
- BundleContext context = RuntimeTestsPlugin.getContext();
- URL url = context.getBundle().getEntry(RuntimeTestsPlugin.TEST_FILES_ROOT + "fileLocator/testFileLocatorGetRootFile");
- Bundle bundle = context.installBundle("reference:" + FileLocator.toFileURL(url).toExternalForm());
- BundleTestingHelper.refreshPackages(context, new Bundle[] {bundle});
-
- File file1 = FileLocator.getBundleFile(bundle);
- assertNotNull(file1);
-
- URL fileURL = FileLocator.toFileURL(context.getBundle().getEntry(RuntimeTestsPlugin.TEST_FILES_ROOT + "fileLocator/testFileLocatorGetRootFile"));
- assertTrue(new File(fileURL.getFile()).equals(file1));
-
- // remove the bundle
- bundle.uninstall();
- BundleTestingHelper.refreshPackages(context, new Bundle[] {bundle});
- }
-
- private Bundle getHostBundle(URL url) {
- String host = url.getHost();
- Long hostId = Long.decode(host);
- assertNotNull(hostId);
- return RuntimeTestsPlugin.getContext().getBundle(hostId.longValue());
- }
-
- private void assertBundleURL(URL url) {
- Bundle hostBundle = getHostBundle(url);
- assertNotNull(hostBundle);
- assertTrue(hostBundle.getSymbolicName().equals("fileLocatorTest"));
- }
-
- private void assertFragmentURL(URL url) {
- Bundle hostBundle = getHostBundle(url);
- assertNotNull(hostBundle);
- assertTrue(hostBundle.getSymbolicName().equals("fileLocatorTest.nl"));
- }
-
- public static Test suite() {
- TestSuite sameSession = new TestSuite(FileLocatorTest.class.getName());
- sameSession.addTest(new FileLocatorTest("testFileLocatorFind"));
- sameSession.addTest(new FileLocatorTest("testFileLocatorGetBundleFile"));
- return sameSession;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/LogSerializationTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/LogSerializationTest.java
deleted file mode 100644
index bb7069d..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/LogSerializationTest.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.runtime;
-
-import java.io.*;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.internal.runtime.PlatformLogWriter;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-
-public class LogSerializationTest extends RuntimeTest {
-
- class TestException extends Exception {
- private static final long serialVersionUID = 1L;
-
- TestException() {
- super();
- }
- }
-
- protected File logFile = null;
-
- public LogSerializationTest(String name) {
- super(name);
- }
-
- public LogSerializationTest() {
- super("");
- }
-
- public static Test suite() {
- return new TestSuite(LogSerializationTest.class);
- // TestSuite suite = new TestSuite();
- // suite.addTest(new LogSerializationTest("testDeepMultiStatus"));
- // return suite;
- }
-
- protected void assertEquals(String msg, IStatus[] expected, IStatus[] actual) {
- if (expected == null) {
- assertNull(msg + " expected null but got: " + actual, actual);
- return;
- }
- if (actual == null) {
- assertNull(msg + " expected " + expected + " but got null", expected);
- return;
- }
- assertEquals(msg + " different number of statuses", expected.length, actual.length);
- for (int i = 0, imax = expected.length; i < imax; i++) {
- assertEquals(msg + " differ at status " + i, expected[i], actual[i]);
- }
- }
-
- protected void assertEquals(String msg, IStatus expected, IStatus actual) {
- assertEquals(msg + " severity", expected.getSeverity(), actual.getSeverity());
- assertEquals(msg + " plugin-id", expected.getPlugin(), actual.getPlugin());
- assertEquals(msg + " code", expected.getCode(), actual.getCode());
- assertEquals(msg + " message", expected.getMessage(), actual.getMessage());
- assertEquals(msg + " exception", expected.getException(), actual.getException());
- assertEquals(msg + " children", expected.getChildren(), actual.getChildren());
- }
-
- protected void assertEquals(String msg, Throwable expected, Throwable actual) {
- if (expected == null) {
- assertNull(msg + " expected null but got: " + actual, actual);
- return;
- }
- if (actual == null) {
- assertNull(msg + " expected " + expected + " but got null", expected);
- return;
- }
- assertEquals(msg + " stack trace", encodeStackTrace(expected), encodeStackTrace(actual));
- assertEquals(msg + " message", expected.getMessage(), actual.getMessage());
- }
-
- protected String encodeStackTrace(Throwable t) {
- StringWriter sWriter = new StringWriter();
- PrintWriter pWriter = new PrintWriter(sWriter);
- pWriter.println();
- t.printStackTrace(pWriter);
- pWriter.flush();
- return canonicalizeStackTrace(sWriter.toString());
- }
-
- /**
- * Returns the given stack trace in a canonical format in order to make stack
- * trace comparisons easier. The canonical format is: each line is ended by a
- * <code>'\n'</code> character, each line (except the first one) starts with a
- * <code>'\t'</code> character, there are no other occurrences of space
- * characters other than ' ', and there are no consecutive occurrences of new-
- * line or space characters.
- */
- protected String canonicalizeStackTrace(String stackTrace) {
- final char NEW_LINE = '\n';
- final char TAB = '\t';
- final char SPACE = ' ';
- final String LINE_SEPARATORS = "\r\n\f";
- final String SPACES = "\t ";
- StringBuffer sb = new StringBuffer(stackTrace.trim());
- sb.append(NEW_LINE);
- char lastChar = 0;
- for (int i = 0; i < sb.length();) {
- // only \n is used as line separator, with no consecutive occurrences
- if (LINE_SEPARATORS.indexOf(sb.charAt(i)) != -1)
- if (LINE_SEPARATORS.indexOf(lastChar) != -1) {
- sb.deleteCharAt(i);
- continue;
- } else
- sb.setCharAt(i, NEW_LINE);
- // each line (except the first one) starts with a tab
- else if (lastChar == NEW_LINE)
- sb.insert(i, TAB);
- // only ' ' is used as space, with no consecutive occurrences
- else if (SPACES.indexOf(sb.charAt(i)) != -1)
- if (SPACES.indexOf(lastChar) != -1) {
- sb.deleteCharAt(i);
- continue;
- } else
- sb.setCharAt(i, SPACE);
- lastChar = sb.charAt(i);
- i++;
- }
- return sb.toString();
- }
-
- protected IStatus[] getInterestingMultiStatuses() {
- IStatus[] interesting = getInterestingStatuses();
- int len = interesting.length;
- IStatus[][] interestingChildren = new IStatus[len][];
- for (int i = 0; i < len; i++) {
- IStatus[] subArray = new IStatus[len];
- System.arraycopy(interesting, 0, subArray, 0, len);
- interestingChildren[i] = subArray;
- }
- int childOff = 0;
- return new IStatus[] {new MultiStatus("plugin-id", 1, interestingChildren[childOff++ % len], "message", null), new MultiStatus("org.foo.bar", 5, interestingChildren[childOff++ % len], "message", new NullPointerException()), new MultiStatus("plugin-id", 8, interestingChildren[childOff++ % len], "message", null), new MultiStatus("plugin-id", 0, interestingChildren[childOff++ % len], "message", new IllegalStateException()), new MultiStatus("plugin-id", 65756, interestingChildren[childOff++ % len], "message", null), new MultiStatus(".", 1, interestingChildren[childOff++ % len], "message", null), new MultiStatus("org.foo.blaz", 1, interestingChildren[childOff++ % len], "", null), new MultiStatus("plugin-id", 1, interestingChildren[childOff++ % len], "%$(% 98%(%(*^", null),
- new MultiStatus("plugin-id", 1, "message", null), new MultiStatus("..", 87326, "", null),};
- }
-
- protected IStatus[] getInterestingStatuses() {
- return new IStatus[] {new Status(IStatus.WARNING, "(#(*$%#", 1, "../\\\\\'\'\"", new TestException()), //
- new Status(IStatus.WARNING, "org.foo", 1, "This is the message", null), //
- new Status(IStatus.ERROR, "org.foo", 1, "This is the message", new TestException()), //
- new Status(IStatus.OK, ".", 1, "This is the message", new TestException()), //
- new Status(IStatus.INFO, "org.asdfhsfhsdf976dsf6sd0f6s", 1, "#*&^$(*&#@^$)(#&)(", null),};
- }
-
- protected void doTest(String msg, IStatus[] oldStats) {
- writeLog(oldStats);
- IStatus[] newStats = readLog();
- assertEquals(msg, oldStats, newStats);
- }
-
- protected void doTest(String msg, IStatus status) {
- doTest(msg, new IStatus[] {status});
- }
-
- protected IStatus[] readLog() {
- PlatformLogReader reader = new PlatformLogReader();
- return reader.readLogFile(logFile.getAbsolutePath());
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- //setup the log file
- if (logFile == null) {
- logFile = Platform.getLogFileLocation().toFile();
- }
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- logFile.delete();
- }
-
- public void testDeepMultiStatus() {
- MultiStatus multi = new MultiStatus("id", 1, getInterestingMultiStatuses(), "ok", null);
- for (int i = 0; i < 5; i++) {
- multi = new MultiStatus("id", 1, new IStatus[] {multi}, "ok", null);
- doTest("1." + i, multi);
- }
- }
-
- public void testMultiMultiStatusSerialize() {
- IStatus[] interesting = getInterestingMultiStatuses();
- int len = interesting.length;
- for (int i = 1; i < len; i++) {
- IStatus[] subArray = new IStatus[len];
- System.arraycopy(interesting, 0, subArray, 0, len);
- doTest("1." + i, subArray);
- }
- }
-
- public void testMultiSerialize() {
- IStatus[] interesting = getInterestingStatuses();
- int len = interesting.length;
- for (int i = 1; i < len; i++) {
- IStatus[] subArray = new IStatus[len];
- System.arraycopy(interesting, 0, subArray, 0, len);
- doTest("1." + i, subArray);
- }
- }
-
- public void testMultiStatus() {
- IStatus[] interesting = getInterestingMultiStatuses();
- for (int i = 0; i < interesting.length; i++) {
- doTest("1." + i, interesting[i]);
- }
- }
-
- public void testSimpleSerialize() {
- IStatus[] interesting = getInterestingStatuses();
- for (int i = 0; i < interesting.length; i++) {
- doTest("1." + i, interesting[i]);
- }
- }
-
- protected void writeLog(IStatus status) {
- writeLog(new IStatus[] {status});
- }
-
- protected void writeLog(IStatus[] statuses) {
- if (logFile.exists())
- logFile.delete();
- PlatformLogWriter writer = new PlatformLogWriter(InternalPlatform.getDefault().getFrameworkLog());
- for (int i = 0; i < statuses.length; i++) {
- writer.logging(statuses[i], "org.eclipse.core.tests.runtime");
- }
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformLogReader.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformLogReader.java
deleted file mode 100644
index 4a12c06..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformLogReader.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.runtime;
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-import org.eclipse.core.internal.runtime.Messages;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Reads a structured log from disk and reconstructs status and exception objects.
- * General strategy: log entries that are malformed in any way are skipped, and an extra
- * status is returned mentioned that there were problems.
- */
-public class PlatformLogReader {
- private ArrayList list = null;
- private String currentLine = "";
- private BufferedReader reader;
-
- // constants copied from the PlatformLogWriter (since they are private
- // to that class and this class should be used only in test suites)
- private static final String KEYWORD_SESSION = "!SESSION";
- private static final String KEYWORD_ENTRY = "!ENTRY";
- private static final String KEYWORD_SUBENTRY = "!SUBENTRY";
- private static final String KEYWORD_MESSAGE = "!MESSAGE";
- private static final String KEYWORD_STACK = "!STACK";
-
- private static final int NULL = -2;
- private static final int SESSION = 1;
- private static final int ENTRY = 2;
- private static final int SUBENTRY = 4;
- private static final int MESSAGE = 8;
- private static final int STACK = 16;
- private static final int UNKNOWN = 32;
-
- protected void log(Exception ex) {
- String msg = NLS.bind(Messages.meta_exceptionParsingLog, ex.getMessage());
- list.add(new Status(IStatus.WARNING, Platform.PI_RUNTIME, Platform.PARSE_PROBLEM, msg, ex));
- }
-
- protected Throwable readException(String message) throws IOException {
- if (currentLine == null || getLineType() != STACK)
- return null;
- StringTokenizer tokenizer = new StringTokenizer(currentLine);
- tokenizer.nextToken();
- // FIXME: handle the code to read status objects which were
- // nested inside of CoreExceptions in the log.
- Integer.parseInt(tokenizer.nextToken());
- currentLine = reader.readLine();
- return new FakeException(null, readText());
- }
-
- /**
- * Reads the given log file and returns the contained status objects.
- * If the log file could not be read, a status object indicating this fact
- * is returned.
- */
- public synchronized IStatus[] readLogFile(String path) {
- list = new ArrayList();
- InputStream input = null;
- try {
- input = new FileInputStream(path);
- reader = new BufferedReader(new InputStreamReader(input, "UTF-8"));//$NON-NLS-1$
- currentLine = reader.readLine();
- while (currentLine != null) {
- switch (getLineType()) {
- case ENTRY :
- IStatus status = readEntry();
- if (status != null)
- list.add(status);
- break;
- case SESSION :
- readSession();
- break;
- case SUBENTRY :
- case MESSAGE :
- case STACK :
- case UNKNOWN :
- currentLine = reader.readLine();
- break;
- }
- }
- } catch (IOException e) {
- log(e);
- } finally {
- try {
- if (input != null)
- input.close();
- } catch (IOException e) {
- log(e);
- }
- }
- return (IStatus[]) list.toArray(new IStatus[list.size()]);
- }
-
- protected int getLineType() {
- if (currentLine == null)
- return NULL;
- StringTokenizer tokenizer = new StringTokenizer(currentLine);
- if (tokenizer.hasMoreTokens()) {
- String token = tokenizer.nextToken();
- if (token.equals(KEYWORD_SESSION))
- return SESSION;
- if (token.equals(KEYWORD_ENTRY))
- return ENTRY;
- if (token.equals(KEYWORD_SUBENTRY))
- return SUBENTRY;
- if (token.equals(KEYWORD_MESSAGE))
- return MESSAGE;
- if (token.equals(KEYWORD_STACK))
- return STACK;
- }
- return UNKNOWN;
- }
-
- /**
- * A reconsituted exception that only contains a stack trace and a message.
- */
- class FakeException extends Throwable {
- /**
- * All serializable objects should have a stable serialVersionUID
- */
- private static final long serialVersionUID = 1L;
- private String message;
- private String stackTrace;
-
- FakeException(String msg, String stack) {
- this.message = msg;
- this.stackTrace = stack;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void printStackTrace() {
- printStackTrace(System.out);
- }
-
- public void printStackTrace(PrintWriter writer) {
- writer.println(stackTrace);
- }
-
- public void printStackTrace(PrintStream stream) {
- stream.println(stackTrace);
- }
- }
-
- protected IStatus readEntry() throws IOException {
- if (currentLine == null || getLineType() != ENTRY)
- return null;
- StringTokenizer tokens = new StringTokenizer(currentLine);
- // skip over the ENTRY keyword
- tokens.nextToken();
- String pluginID = tokens.nextToken();
- int severity = Integer.parseInt(tokens.nextToken());
- int code = Integer.parseInt(tokens.nextToken());
- // ignore the rest of the line since its the date
- currentLine = reader.readLine();
- String message = readMessage();
- Throwable exception = readException(message);
- if (currentLine == null || getLineType() != SUBENTRY)
- return new Status(severity, pluginID, code, message, exception);
- MultiStatus parent = new MultiStatus(pluginID, code, message, exception);
- readSubEntries(parent);
- return parent;
- }
-
- protected void readSubEntries(MultiStatus parent) throws IOException {
- while (getLineType() == SUBENTRY) {
- StringTokenizer tokens = new StringTokenizer(currentLine);
- // skip over the subentry keyword
- tokens.nextToken();
- int currentDepth = Integer.parseInt(tokens.nextToken());
- String pluginID = tokens.nextToken();
- int severity = Integer.parseInt(tokens.nextToken());
- int code = Integer.parseInt(tokens.nextToken());
- // ignore the rest of the line since its the date
- currentLine = reader.readLine();
- String message = readMessage();
- Throwable exception = readException(message);
-
- IStatus current = new Status(severity, pluginID, code, message, exception);
- if (currentLine == null || getLineType() != SUBENTRY) {
- parent.add(current);
- return;
- }
-
- tokens = new StringTokenizer(currentLine);
- tokens.nextToken();
- int depth = Integer.parseInt(tokens.nextToken());
- if (currentDepth == depth) {
- // next sub-entry is a sibling
- parent.add(current);
- } else if (currentDepth == (depth - 1)) {
- // next sub-entry is a child
- current = new MultiStatus(pluginID, code, message, exception);
- readSubEntries((MultiStatus) current);
- parent.add(current);
- } else {
- parent.add(current);
- return;
- }
- }
- }
-
- protected int readDepth() throws IOException {
- StringTokenizer tokens = new StringTokenizer(currentLine);
- // skip the keyword
- tokens.nextToken();
- return Integer.parseInt(tokens.nextToken());
- }
-
- protected String readMessage() throws IOException {
- if (currentLine == null || getLineType() != MESSAGE)
- return "";
- StringBuffer buffer = new StringBuffer();
- buffer.append(currentLine.substring(KEYWORD_MESSAGE.length() + 1, currentLine.length()));
- currentLine = reader.readLine();
- buffer.append(readText());
- return buffer.toString();
- }
-
- protected String readSession() throws IOException {
- if (currentLine == null || getLineType() != SESSION)
- return "";
- currentLine = reader.readLine();
- return readText();
- }
-
- protected String readText() throws IOException {
- StringBuffer buffer = new StringBuffer();
- if (currentLine == null || getLineType() != UNKNOWN)
- return "";
- else
- buffer.append(currentLine);
- boolean done = false;
- while (!done) {
- currentLine = reader.readLine();
- if (currentLine == null) {
- done = true;
- continue;
- }
- if (getLineType() == UNKNOWN) {
- // preserves line terminators between lines
- buffer.append('\n');
- buffer.append(currentLine);
- } else
- done = true;
- }
- return buffer.toString();
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLLocalTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLLocalTest.java
deleted file mode 100644
index b6cb955..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLLocalTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.runtime;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-
-public class PlatformURLLocalTest extends RuntimeTest {
-
- public static void assertEquals(String tag, URL expected, URL actual, boolean external) {
- if (external) {
- assertEquals(tag, expected, actual);
- return;
- }
- try {
- assertEquals(tag + ".1", new URL(expected.getProtocol(), expected.getHost(), expected.getPort(), expected.getFile()), new URL(actual.getProtocol(), actual.getHost(), actual.getPort(), actual.getFile()));
- } catch (MalformedURLException e) {
- fail(tag + ".2", e);
- }
- }
-
- public static Test suite() {
- return new TestSuite(PlatformURLLocalTest.class);
- }
-
- public PlatformURLLocalTest(String name) {
- super(name);
- }
-
- public void testPlatformURLConfigResolution() {
- URL platformURL = null;
- try {
- // create a fake URL
- platformURL = new URL("platform:/config/x");
- } catch (MalformedURLException e) {
- fail("1.0", e);
- }
- URL resolvedURL = null;
- try {
- resolvedURL = Platform.resolve(platformURL);
- } catch (IOException e) {
- fail("2.0", e);
- }
- assertFalse("3.0", platformURL.equals(resolvedURL));
- URL expected = null;
- try {
- expected = new URL(Platform.getConfigurationLocation().getURL(), "x");
- } catch (MalformedURLException e) {
- fail("4.0", e);
- }
- assertEquals("5.0", expected, resolvedURL, false);
- }
-
- public void testPlatformURLMetaResolution() {
- URL platformURL = null;
- try {
- // create a fake URL
- platformURL = new URL("platform:/meta/" + PI_RUNTIME_TESTS + "/x");
- } catch (MalformedURLException e) {
- fail("1.0", e);
- }
- URL resolvedURL = null;
- try {
- resolvedURL = Platform.resolve(platformURL);
- } catch (IOException e) {
- fail("2.0", e);
- }
- assertFalse("3.0", platformURL.equals(resolvedURL));
- URL expected = null;
- try {
- expected = new URL(RuntimeTestsPlugin.getPlugin().getStateLocation().toFile().toURL(), "x");
- } catch (MalformedURLException e) {
- fail("4.0", e);
- }
- assertEquals("5.0", expected, resolvedURL, false);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLSessionTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLSessionTest.java
deleted file mode 100644
index 75f0d4b..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLSessionTest.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.internal.runtime;
-
-import java.io.*;
-import java.net.*;
-import junit.framework.Test;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-import org.eclipse.core.tests.session.ConfigurationSessionTestSuite;
-import org.eclipse.osgi.service.datalocation.Location;
-
-public class PlatformURLSessionTest extends RuntimeTest {
-
- private static final String CONFIG_URL = "platform:/config/" + PI_RUNTIME_TESTS + "/";
- private static final String DATA_CHILD = "child";
- private static final String DATA_PARENT = "parent";
- private static final String FILE_ANOTHER_PARENT_ONLY = "parent2.txt";
- private static final String FILE_BOTH_PARENT_AND_CHILD = "both.txt";
- private static final String FILE_CHILD_ONLY = "child.txt";
- private static final String FILE_PARENT_ONLY = "parent.txt";
-
- public static void assertEquals(String tag, URL expected, URL actual, boolean external) {
- if (external) {
- assertEquals(tag, expected, actual);
- return;
- }
- assertEquals(tag + " different protocol", expected.getProtocol(), actual.getProtocol());
- assertEquals(tag + " different host", expected.getHost(), actual.getHost());
- assertEquals(tag + " different path", expected.getPath(), actual.getPath());
- assertEquals(tag + " different port", expected.getPort(), actual.getPort());
- }
-
- private static String readContents(String tag, URL url) {
- URLConnection connection = null;
- try {
- connection = url.openConnection();
- } catch (IOException e) {
- fail(tag + ".1", e);
- }
- InputStream input = null;
- try {
- input = connection.getInputStream();
- } catch (IOException e) {
- fail(tag + ".2", e);
- }
- BufferedReader reader = new BufferedReader(new InputStreamReader(input));
- String line = null;
- StringBuffer result = new StringBuffer();
- try {
- while ((line = reader.readLine()) != null)
- result.append(line);
- return result.toString();
- } catch (IOException e) {
- fail(tag + ".99", e);
- } finally {
- try {
- reader.close();
- } catch (IOException e) {
- // not interested
- }
- }
- // never happens
- return null;
- }
-
- public static Test suite() {
- ConfigurationSessionTestSuite suite = new ConfigurationSessionTestSuite(PI_RUNTIME_TESTS, PlatformURLSessionTest.class);
- suite.setReadOnly(true);
- suite.setCascaded(true);
- String[] ids = ConfigurationSessionTestSuite.MINIMAL_BUNDLE_SET;
- for (int i = 0; i < ids.length; i++)
- suite.addBundle(ids[i]);
- suite.addBundle(PI_RUNTIME_TESTS);
- return suite;
- }
-
- public PlatformURLSessionTest(String name) {
- super(name);
- }
-
- private void createData(String tag) {
- // create some data for this and following test cases
- URL childConfigURL = Platform.getConfigurationLocation().getURL();
- //tests run with file based configuration
- assertEquals(tag + ".1", "file", childConfigURL.getProtocol());
- File childConfigPrivateDir = new File(childConfigURL.getPath(), PI_RUNTIME_TESTS);
- try {
- createFileInFileSystem(new File(childConfigPrivateDir, FILE_CHILD_ONLY), getContents(DATA_CHILD));
- createFileInFileSystem(new File(childConfigPrivateDir, FILE_BOTH_PARENT_AND_CHILD), getContents(DATA_CHILD));
- } catch (IOException e) {
- fail(tag + ".2", e);
- }
-
- Location parent = Platform.getConfigurationLocation().getParentLocation();
- //tests run with cascaded configuration
- assertNotNull(tag + ".3", parent);
- URL parentConfigURL = parent.getURL();
- //tests run with file based configuration
- assertEquals(tag + ".4", "file", parentConfigURL.getProtocol());
- File parentConfigPrivateDir = new File(parentConfigURL.getPath(), PI_RUNTIME_TESTS);
- try {
- createFileInFileSystem(new File(parentConfigPrivateDir, FILE_PARENT_ONLY), getContents(DATA_PARENT));
- createFileInFileSystem(new File(parentConfigPrivateDir, FILE_ANOTHER_PARENT_ONLY), getContents(DATA_PARENT));
- createFileInFileSystem(new File(parentConfigPrivateDir, FILE_BOTH_PARENT_AND_CHILD), getContents(DATA_PARENT));
- } catch (IOException e) {
- fail(tag + ".5", e);
- }
- }
-
- /**
- * Creates test data in both child and parent configurations.
- */
- public void test0FirstSession() {
- createData("1");
-
- // try to modify a file in the parent configuration area - should fail
- URL configURL = null;
- try {
- configURL = new URL(CONFIG_URL + FILE_ANOTHER_PARENT_ONLY);
- } catch (MalformedURLException e) {
- fail("2.0", e);
- }
- URLConnection connection = null;
- try {
- connection = configURL.openConnection();
- } catch (IOException e) {
- fail("3.0", e);
- }
- connection.setDoOutput(true);
- OutputStream output = null;
- try {
- output = connection.getOutputStream();
- fail("4.0 - should have failed");
- } catch (IOException e) {
- // that is expected - parent configuration area is read-only
- } finally {
- if (output != null)
- try {
- output.close();
- } catch (IOException e) {
- // not interested
- }
- }
- }
-
- public void test1OutputOnReadOnly() {
- // try to modify a file in the configuration area - should fail
- URL configURL = null;
- try {
- configURL = new URL(CONFIG_URL + FILE_CHILD_ONLY);
- } catch (MalformedURLException e) {
- fail("1.0", e);
- }
- URLConnection connection = null;
- try {
- connection = configURL.openConnection();
- } catch (IOException e) {
- fail("2.0", e);
- }
- connection.setDoOutput(true);
- OutputStream output = null;
- try {
- output = connection.getOutputStream();
- fail("3.0 - should have failed");
- } catch (IOException e) {
- // that is expected - configuration area is read-only
- } finally {
- if (output != null)
- try {
- output.close();
- } catch (IOException e) {
- // not interested
- }
- }
- }
-
- public void test2Resolution() {
- URL parent = null;
- URL child = null;
- URL both = null;
- URL none = null;
- try {
- parent = new URL(CONFIG_URL + FILE_PARENT_ONLY);
- child = new URL(CONFIG_URL + FILE_CHILD_ONLY);
- both = new URL(CONFIG_URL + FILE_BOTH_PARENT_AND_CHILD);
- none = new URL(CONFIG_URL + "none.txt");
- } catch (MalformedURLException e) {
- fail("0.1", e);
- }
- assertEquals("1.0", DATA_PARENT, readContents("1.1", parent));
- assertEquals("2.0", DATA_CHILD, readContents("2.1", child));
- assertEquals("3.0", DATA_CHILD, readContents("3.1", both));
- URL resolvedURL = null;
- try {
- resolvedURL = Platform.resolve(none);
- } catch (IOException e) {
- fail("4.0", e);
- }
- assertFalse("4.1", none.equals(resolvedURL));
- assertTrue("4.2", resolvedURL.toExternalForm().startsWith(Platform.getConfigurationLocation().getURL().toExternalForm()));
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AdapterManagerDynamicTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AdapterManagerDynamicTest.java
deleted file mode 100644
index b4f6412..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AdapterManagerDynamicTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import java.io.IOException;
-import junit.framework.*;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.tests.harness.BundleTestingHelper;
-import org.eclipse.core.tests.internal.registry.WaitingRegistryListener;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-/**
- * Tests reaction of AdapterManager on addition and removal of adapters from
- * the extension registry.
- */
-public class AdapterManagerDynamicTest extends TestCase {
-
- final private static int MAX_TIME_PER_BUNDLE = 10000; // maximum time to wait for bundle event in milliseconds
-
- // Provided by bundle1; has an extension ID
- private static final String BUNDLE1_TYPE_ID = "abc.SomethingElseA1";
- // Provided by bundle1; has no extension ID
- private static final String BUNDLE1_TYPE_NO_ID = "abc.SomethingElseA2";
-
- // Provided by bundle2; has an extension ID
- private static final String BUNDLE2_TYPE_ID = "abc.SomethingElseB1";
- // Provided by bundle2; has no extension ID
- private static final String BUNDLE2_TYPE_NO_ID = "abc.SomethingElseB2";
-
- private IAdapterManager manager;
-
- public AdapterManagerDynamicTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(AdapterManagerDynamicTest.class);
- }
-
- public AdapterManagerDynamicTest() {
- super("");
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- manager = Platform.getAdapterManager();
- }
-
- protected void tearDown() throws Exception {
- manager = null;
- super.tearDown();
- }
-
- /**
- * This test uses waiting listener for synchronization (events from bundle being
- * installed or un-installed are not propagated right away).
- */
- public void testDynamicBundles() throws IOException, BundleException {
-
- // check that adapters not available
- TestAdaptable adaptable = new TestAdaptable();
- assertFalse(manager.hasAdapter(adaptable, BUNDLE1_TYPE_ID));
- assertFalse(manager.hasAdapter(adaptable, BUNDLE1_TYPE_NO_ID));
- assertFalse(manager.hasAdapter(adaptable, BUNDLE2_TYPE_ID));
- assertFalse(manager.hasAdapter(adaptable, BUNDLE2_TYPE_NO_ID));
-
- Bundle bundle01 = null;
- Bundle bundle02 = null;
- WaitingRegistryListener listener = new WaitingRegistryListener();
- listener.register("org.eclipse.core.runtime.adapters");
- try {
- bundle01 = BundleTestingHelper.installBundle("0.1", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "adapters/dynamic/A");
- bundle02 = BundleTestingHelper.installBundle("0.2", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "adapters/dynamic/B");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01, bundle02});
-
- // synchronization: listener should receive 2 groups of events
- assertTrue(listener.waitFor(2, 2 * MAX_TIME_PER_BUNDLE) == 2);
-
- // now has to have all 4 adapters
- assertTrue(manager.hasAdapter(adaptable, BUNDLE1_TYPE_ID));
- assertTrue(manager.hasAdapter(adaptable, BUNDLE1_TYPE_NO_ID));
- assertTrue(manager.hasAdapter(adaptable, BUNDLE2_TYPE_ID));
- assertTrue(manager.hasAdapter(adaptable, BUNDLE2_TYPE_NO_ID));
-
- listener.reset();
- bundle02.uninstall();
- bundle02 = null;
-
- // synchronization: listener should receive 1 group of events
- assertTrue(listener.waitFor(1, MAX_TIME_PER_BUNDLE) == 1);
-
- // now 2 installed; 2 not
- assertTrue(manager.hasAdapter(adaptable, BUNDLE1_TYPE_ID));
- assertTrue(manager.hasAdapter(adaptable, BUNDLE1_TYPE_NO_ID));
- assertFalse(manager.hasAdapter(adaptable, BUNDLE2_TYPE_ID));
- assertFalse(manager.hasAdapter(adaptable, BUNDLE2_TYPE_NO_ID));
-
- listener.reset();
- bundle01.uninstall();
- bundle01 = null;
-
- // synchronization: listener should receive 1 group of events
- assertTrue(listener.waitFor(1, MAX_TIME_PER_BUNDLE) == 1);
-
- // and all should be uninstalled again
- assertFalse(manager.hasAdapter(adaptable, BUNDLE1_TYPE_ID));
- assertFalse(manager.hasAdapter(adaptable, BUNDLE1_TYPE_NO_ID));
- assertFalse(manager.hasAdapter(adaptable, BUNDLE2_TYPE_ID));
- assertFalse(manager.hasAdapter(adaptable, BUNDLE2_TYPE_NO_ID));
-
- } finally {
- listener.unregister();
- // in case of exception in the process
- if (bundle01 != null)
- bundle01.uninstall();
- if (bundle02 != null)
- bundle02.uninstall();
- }
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AllTests.java
deleted file mode 100644
index f8e9016..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AllTests.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import junit.framework.*;
-
-public class AllTests extends TestCase {
-
- public AllTests() {
- super(null);
- }
-
- public AllTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AllTests.class.getName());
- suite.addTest(CoreExceptionTest.suite());
- suite.addTest(IAdapterManagerTest.suite());
- suite.addTest(IAdapterManagerServiceTest.suite());
- suite.addTest(AdapterManagerDynamicTest.suite());
- suite.addTest(OperationCanceledExceptionTest.suite());
- suite.addTest(PathTest.suite());
- suite.addTest(PlatformTest.suite());
- suite.addTest(PluginVersionIdentifierTest.suite());
- suite.addTest(PreferenceExportTest.suite());
- suite.addTest(PreferenceForwarderTest.suite());
- suite.addTest(PreferencesTest.suite());
- suite.addTestSuite(SubMonitorTest.class);
- suite.addTestSuite(SubProgressTest.class);
- suite.addTestSuite(SubMonitorSmallTicksTest.class);
- suite.addTest(ProgressMonitorWrapperTest.suite());
- suite.addTest(QualifiedNameTest.suite());
- suite.addTest(StatusTest.suite());
- suite.addTest(URLTest.suite());
- return suite;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AutomatedTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AutomatedTests.java
deleted file mode 100644
index 5c3753c..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AutomatedTests.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import junit.framework.*;
-
-/**
- * Runs the sniff tests for the build. All tests listed here should
- * be automated.
- */
-public class AutomatedTests extends TestCase {
-
- public AutomatedTests() {
- super(null);
- }
-
- public AutomatedTests(String name) {
- super(name);
- }
-
- /**
- * Add all of the AllTests suites for each package to be tested.
- */
- public static Test suite() {
- TestSuite suite = new TestSuite(AutomatedTests.class.getName());
-
- // Moved to the top: bug 124867
- suite.addTest(org.eclipse.core.tests.internal.runtime.AllTests.suite());
-
- suite.addTest(org.eclipse.core.tests.runtime.AllTests.suite());
- suite.addTest(org.eclipse.core.tests.runtime.compatibility.AllTests.suite());
- suite.addTest(org.eclipse.core.tests.runtime.content.AllTests.suite());
- suite.addTest(org.eclipse.core.tests.runtime.jobs.AllTests.suite());
- suite.addTest(org.eclipse.core.tests.runtime.model.AllTests.suite());
- suite.addTest(org.eclipse.core.tests.internal.preferences.AllTests.suite());
-
- // Moved to the top: bug 124867
- //suite.addTest(org.eclipse.core.tests.internal.runtime.AllTests.suite());
-
- suite.addTest(org.eclipse.core.tests.internal.registry.AllTests.suite());
- return suite;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/CoreExceptionTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/CoreExceptionTest.java
deleted file mode 100644
index 6ad5989..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/CoreExceptionTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.*;
-
-/**
- * Test cases for the Path class.
- */
-public class CoreExceptionTest extends RuntimeTest {
- /**
- * Need a zero argument constructor to satisfy the test harness.
- * This constructor should not do any real work nor should it be
- * called by user code.
- */
- public CoreExceptionTest() {
- super(null);
- }
-
- public CoreExceptionTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(CoreExceptionTest.class);
- }
-
- public void testCoreException() {
- final String MESSAGE_STRING = "An exception has occurred";
- IStatus status = new Status(IStatus.ERROR, "org.eclipse.core.tests.runtime", 31415, MESSAGE_STRING, new NumberFormatException());
-
- CoreException e = new CoreException(status);
-
- assertEquals("1.0", status, e.getStatus());
- assertEquals("1.1", MESSAGE_STRING, e.getMessage());
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/IAdapterManagerServiceTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/IAdapterManagerServiceTest.java
deleted file mode 100644
index 8d2e22f..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/IAdapterManagerServiceTest.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import junit.framework.*;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.osgi.framework.BundleContext;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * Tests API on the IAdapterManager class accessed via an OSGi service.
- *
- * This class is a copy of IAdapterManagerTest modified to use an OSGi service
- * instead of the Platform API.
- */
-public class IAdapterManagerServiceTest extends TestCase {
- private static final String NON_EXISTING = "com.does.not.Exist";
- private static final String TEST_ADAPTER = "org.eclipse.core.tests.runtime.TestAdapter";
-
- private ServiceTracker adapterManagerTracker = null;
-
- public IAdapterManagerServiceTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(IAdapterManagerServiceTest.class);
- }
-
- public IAdapterManagerServiceTest() {
- super("");
- }
-
- /*
- * Return the framework log service, if available.
- */
- public IAdapterManager getAdapterManager() {
- if (adapterManagerTracker == null) {
- BundleContext context = RuntimeTestsPlugin.getContext();
- adapterManagerTracker = new ServiceTracker(context, IAdapterManager.class.getName(), null);
- adapterManagerTracker.open();
- }
- return (IAdapterManager) adapterManagerTracker.getService();
- }
-
- protected void tearDown() throws Exception {
- if (adapterManagerTracker != null) {
- adapterManagerTracker.close();
- adapterManagerTracker = null;
- }
- super.tearDown();
- }
-
- /**
- * Tests API method IAdapterManager.hasAdapter.
- */
- public void testHasAdapter() {
- IAdapterManager manager = getAdapterManager();
-
- TestAdaptable adaptable = new TestAdaptable();
- //request non-existing adaptable
- assertTrue("1.0", !manager.hasAdapter("", NON_EXISTING));
-
- //request adapter that is in XML but has no registered factory
- assertTrue("1.1", manager.hasAdapter(adaptable, TEST_ADAPTER));
-
- //request adapter that is not in XML
- assertTrue("1.2", !manager.hasAdapter(adaptable, "java.lang.String"));
-
- //register an adapter factory that maps adaptables to strings
- IAdapterFactory fac = new IAdapterFactory() {
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adapterType == String.class)
- return adaptableObject.toString();
- return null;
- }
-
- public Class[] getAdapterList() {
- return new Class[] {String.class};
- }
- };
- manager.registerAdapters(fac, TestAdaptable.class);
- try {
- //request adapter for factory that we've just added
- assertTrue("1.3", manager.hasAdapter(adaptable, "java.lang.String"));
- } finally {
- manager.unregisterAdapters(fac, TestAdaptable.class);
- }
-
- //request adapter that was unloaded
- assertTrue("1.4", !manager.hasAdapter(adaptable, "java.lang.String"));
- }
-
- /**
- * Tests API method IAdapterManager.getAdapter.
- */
- public void testGetAdapter() {
- IAdapterManager manager = getAdapterManager();
-
- TestAdaptable adaptable = new TestAdaptable();
- //request non-existing adaptable
- assertNull("1.0", manager.getAdapter("", NON_EXISTING));
-
- //request adapter that is in XML but has no registered factory
- Object result = manager.getAdapter(adaptable, TEST_ADAPTER);
- assertTrue("1.1", result instanceof TestAdapter);
-
- //request adapter that is not in XML
- assertNull("1.2", manager.getAdapter(adaptable, "java.lang.String"));
-
- //register an adapter factory that maps adaptables to strings
- IAdapterFactory fac = new IAdapterFactory() {
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adapterType == String.class)
- return adaptableObject.toString();
- return null;
- }
-
- public Class[] getAdapterList() {
- return new Class[] {String.class};
- }
- };
- manager.registerAdapters(fac, TestAdaptable.class);
- try {
- //request adapter for factory that we've just added
- result = manager.getAdapter(adaptable, "java.lang.String");
- assertTrue("1.3", result instanceof String);
- } finally {
- manager.unregisterAdapters(fac, TestAdaptable.class);
- }
- //request adapter that was unloaded
- assertNull("1.4", manager.getAdapter(adaptable, "java.lang.String"));
- }
-
- /**
- * Tests API method IAdapterManager.loadAdapter.
- */
- public void testLoadAdapter() {
- IAdapterManager manager = getAdapterManager();
-
- TestAdaptable adaptable = new TestAdaptable();
- //request non-existing adaptable
- assertNull("1.0", manager.loadAdapter("", NON_EXISTING));
-
- //request adapter that is in XML but has no registered factory
- Object result = manager.loadAdapter(adaptable, TEST_ADAPTER);
- assertTrue("1.1", result instanceof TestAdapter);
-
- //request adapter that is not in XML
- assertNull("1.2", manager.loadAdapter(adaptable, "java.lang.String"));
-
- //register an adapter factory that maps adaptables to strings
- IAdapterFactory fac = new IAdapterFactory() {
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adapterType == String.class)
- return adaptableObject.toString();
- return null;
- }
-
- public Class[] getAdapterList() {
- return new Class[] {String.class};
- }
- };
- manager.registerAdapters(fac, TestAdaptable.class);
- try {
- //request adapter for factory that we've just added
- result = manager.loadAdapter(adaptable, "java.lang.String");
- assertTrue("1.3", result instanceof String);
- } finally {
- manager.unregisterAdapters(fac, TestAdaptable.class);
- }
- //request adapter that was unloaded
- assertNull("1.4", manager.loadAdapter(adaptable, "java.lang.String"));
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/IAdapterManagerTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/IAdapterManagerTest.java
deleted file mode 100644
index 561d5d5..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/IAdapterManagerTest.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import junit.framework.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.tests.harness.BundleTestingHelper;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-/**
- * Tests API on the IAdapterManager class.
- */
-public class IAdapterManagerTest extends TestCase {
- private static final String NON_EXISTING = "com.does.not.Exist";
- private static final String TEST_ADAPTER = "org.eclipse.core.tests.runtime.TestAdapter";
- private static final String TEST_ADAPTER_CL = "testAdapter.testUnknown";
- private IAdapterManager manager;
-
- public IAdapterManagerTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(IAdapterManagerTest.class);
- }
-
- public IAdapterManagerTest() {
- super("");
- }
-
- protected void setUp() throws Exception {
- manager = Platform.getAdapterManager();
- }
-
- /**
- * Tests API method IAdapterManager.hasAdapter.
- */
- public void testHasAdapter() {
- TestAdaptable adaptable = new TestAdaptable();
- //request non-existing adaptable
- assertTrue("1.0", !manager.hasAdapter("", NON_EXISTING));
-
- //request adapter that is in XML but has no registered factory
- assertTrue("1.1", manager.hasAdapter(adaptable, TEST_ADAPTER));
-
- //request adapter that is not in XML
- assertTrue("1.2", !manager.hasAdapter(adaptable, "java.lang.String"));
-
- //register an adapter factory that maps adaptables to strings
- IAdapterFactory fac = new IAdapterFactory() {
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adapterType == String.class)
- return adaptableObject.toString();
- return null;
- }
-
- public Class[] getAdapterList() {
- return new Class[] {String.class};
- }
- };
- manager.registerAdapters(fac, TestAdaptable.class);
- try {
- //request adapter for factory that we've just added
- assertTrue("1.3", manager.hasAdapter(adaptable, "java.lang.String"));
- } finally {
- manager.unregisterAdapters(fac, TestAdaptable.class);
- }
-
- //request adapter that was unloaded
- assertTrue("1.4", !manager.hasAdapter(adaptable, "java.lang.String"));
- }
-
- /**
- * Tests API method IAdapterManager.getAdapter.
- */
- public void testGetAdapter() {
- TestAdaptable adaptable = new TestAdaptable();
- //request non-existing adaptable
- assertNull("1.0", manager.getAdapter("", NON_EXISTING));
-
- //request adapter that is in XML but has no registered factory
- Object result = manager.getAdapter(adaptable, TEST_ADAPTER);
- assertTrue("1.1", result instanceof TestAdapter);
-
- //request adapter that is not in XML
- assertNull("1.2", manager.getAdapter(adaptable, "java.lang.String"));
-
- //register an adapter factory that maps adaptables to strings
- IAdapterFactory fac = new IAdapterFactory() {
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adapterType == String.class)
- return adaptableObject.toString();
- return null;
- }
-
- public Class[] getAdapterList() {
- return new Class[] {String.class};
- }
- };
- manager.registerAdapters(fac, TestAdaptable.class);
- try {
- //request adapter for factory that we've just added
- result = manager.getAdapter(adaptable, "java.lang.String");
- assertTrue("1.3", result instanceof String);
- } finally {
- manager.unregisterAdapters(fac, TestAdaptable.class);
- }
- //request adapter that was unloaded
- assertNull("1.4", manager.getAdapter(adaptable, "java.lang.String"));
- }
-
- /**
- * Tests API method IAdapterManager.loadAdapter.
- */
- public void testLoadAdapter() {
- TestAdaptable adaptable = new TestAdaptable();
- //request non-existing adaptable
- assertNull("1.0", manager.loadAdapter("", NON_EXISTING));
-
- //request adapter that is in XML but has no registered factory
- Object result = manager.loadAdapter(adaptable, TEST_ADAPTER);
- assertTrue("1.1", result instanceof TestAdapter);
-
- //request adapter that is not in XML
- assertNull("1.2", manager.loadAdapter(adaptable, "java.lang.String"));
-
- //register an adapter factory that maps adaptables to strings
- IAdapterFactory fac = new IAdapterFactory() {
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adapterType == String.class)
- return adaptableObject.toString();
- return null;
- }
-
- public Class[] getAdapterList() {
- return new Class[] {String.class};
- }
- };
- manager.registerAdapters(fac, TestAdaptable.class);
- try {
- //request adapter for factory that we've just added
- result = manager.loadAdapter(adaptable, "java.lang.String");
- assertTrue("1.3", result instanceof String);
- } finally {
- manager.unregisterAdapters(fac, TestAdaptable.class);
- }
- //request adapter that was unloaded
- assertNull("1.4", manager.loadAdapter(adaptable, "java.lang.String"));
- }
-
- /**
- * Test adapting to classes not reachable by the default bundle class loader
- * (bug 200068).
- * NOTE: This test uses .class file compiled with 1.4 JRE. As a result,
- * the test can not be run on pre-1.4 JRE.
- */
- public void testAdapterClassLoader() throws MalformedURLException, BundleException, IOException {
- TestAdaptable adaptable = new TestAdaptable();
- assertTrue(manager.hasAdapter(adaptable, TEST_ADAPTER_CL));
- assertNull(manager.loadAdapter(adaptable, TEST_ADAPTER_CL));
- Bundle bundle = null;
- try {
- bundle = BundleTestingHelper.installBundle("0.1", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "adapters/testAdapter_1.0.0");
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle});
-
- assertTrue(manager.hasAdapter(adaptable, TEST_ADAPTER_CL));
- Object result = manager.loadAdapter(adaptable, TEST_ADAPTER_CL);
- assertNotNull(result);
- assertTrue(TEST_ADAPTER_CL.equals(result.getClass().getName()));
- } finally {
- if (bundle != null)
- bundle.uninstall();
- }
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/OperationCanceledExceptionTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/OperationCanceledExceptionTest.java
deleted file mode 100644
index 79a0ca0..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/OperationCanceledExceptionTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.OperationCanceledException;
-
-/**
- * Test cases for the Path class.
- */
-public class OperationCanceledExceptionTest extends RuntimeTest {
- /**
- * Need a zero argument constructor to satisfy the test harness.
- * This constructor should not do any real work nor should it be
- * called by user code.
- */
- public OperationCanceledExceptionTest() {
- super(null);
- }
-
- public OperationCanceledExceptionTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(OperationCanceledExceptionTest.class);
- }
-
- public void testCoreException() {
- final String MESSAGE_STRING = "An exception has occurred";
- OperationCanceledException e = new OperationCanceledException(MESSAGE_STRING);
-
- assertEquals("1.0", MESSAGE_STRING, e.getMessage());
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PathTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PathTest.java
deleted file mode 100644
index e7e69cc..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PathTest.java
+++ /dev/null
@@ -1,831 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
-/**
- * Test cases for the Path class.
- */
-public class PathTest extends RuntimeTest {
- /** Constant value indicating if the current platform is Windows */
- private static final boolean WINDOWS = java.io.File.separatorChar == '\\';
-
- /**
- * Need a zero argument constructor to satisfy the test harness.
- * This constructor should not do any real work nor should it be
- * called by user code.
- */
- public PathTest() {
- super(null);
- }
-
- public PathTest(String name) {
- super(name);
- }
-
- public static Test suite() {
-
- return new TestSuite(PathTest.class);
-
-// TestSuite suite= new TestSuite();
-// suite.addTest(new PathTest("testCanonicalize"));
-// return suite;
- }
-
- public void testAddTrailingSeparator() {
-
- IPath with = new Path("/first/second/third/");
- IPath without = new Path("/first/second/third");
-
- assertSame("1.0", with, with.addTrailingSeparator());
- assertEquals("1.1", with, without.addTrailingSeparator());
- assertTrue("1.2", without.equals(without.addTrailingSeparator()));
-
- assertSame("2.0", Path.ROOT, Path.ROOT.addTrailingSeparator());
- assertEquals("2.1", Path.ROOT, Path.EMPTY.addTrailingSeparator());
-
- with = new Path("//first/second/third/");
- without = new Path("//first/second/third");
-
- assertSame("3.0", with, with.addTrailingSeparator());
- assertEquals("3.1", with, without.addTrailingSeparator());
- assertTrue("3.2", without.equals(without.addTrailingSeparator()));
-
- assertSame("4.0", Path.ROOT, Path.ROOT.addTrailingSeparator());
- assertEquals("4.1", Path.ROOT, Path.EMPTY.addTrailingSeparator());
-
- with = new Path("c:/first/second/third/");
- without = new Path("c:/first/second/third");
-
- assertSame("5.0", with, with.addTrailingSeparator());
- assertEquals("5.1", with, without.addTrailingSeparator());
- assertTrue("5.2", without.equals(without.addTrailingSeparator()));
-
- assertSame("6.0", Path.ROOT, Path.ROOT.addTrailingSeparator());
- assertEquals("6.1", Path.ROOT, Path.EMPTY.addTrailingSeparator());
- }
-
- public void testAppend() {
-
- IPath fore = new Path("/first/second/third/");
- String aftString = "/fourth/fifth";
- IPath aft = new Path(aftString);
- IPath combo = new Path("/first/second/third/fourth/fifth");
-
- assertEquals("1.0", combo, fore.append(aft));
- assertEquals("1.1", combo, fore.removeTrailingSeparator().append(aft));
- assertEquals("1.2", combo, Path.ROOT.append(fore).append(aft));
- assertTrue("1.3", !fore.append(aft).hasTrailingSeparator());
- assertTrue("1.4", !Path.ROOT.append(fore).append(aft).hasTrailingSeparator());
- assertTrue("1.5", !fore.removeTrailingSeparator().append(aft).hasTrailingSeparator());
-
- assertEquals("2.0", combo, fore.append(aftString));
- assertEquals("2.1", combo, fore.removeTrailingSeparator().append(aftString));
- assertEquals("2.2", combo, Path.ROOT.append(fore).append(aftString));
- assertTrue("2.3", !fore.append(aftString).hasTrailingSeparator());
- assertTrue("2.4", !Path.ROOT.append(fore).append(aftString).hasTrailingSeparator());
- assertTrue("2.5", !fore.removeTrailingSeparator().append(aftString).hasTrailingSeparator());
-
- //ensure append preserves correct trailing separator
- assertTrue("3.0", !fore.append("aft").hasTrailingSeparator());
- assertTrue("3.1", fore.append("aft/").hasTrailingSeparator());
- assertTrue("3.2", !fore.append("/aft").hasTrailingSeparator());
- assertTrue("3.3", fore.append("/aft/").hasTrailingSeparator());
- assertTrue("3.4", !fore.append("\\aft").hasTrailingSeparator());
- //backslash is a trailing separator on windows only
- assertTrue("3.5", fore.append("aft\\").hasTrailingSeparator() == WINDOWS);
- assertTrue("3.6", !fore.append("fourth/fifth").hasTrailingSeparator());
- assertTrue("3.7", fore.append("fourth/fifth/").hasTrailingSeparator());
- assertTrue("3.8", !fore.append(new Path("aft")).hasTrailingSeparator());
- assertTrue("3.9", fore.append(new Path("aft/")).hasTrailingSeparator());
- assertTrue("3.10", !fore.append(new Path("fourth/fifth")).hasTrailingSeparator());
- assertTrue("3.11", fore.append(new Path("fourth/fifth/")).hasTrailingSeparator());
-
- //make sure append converts slashes appropriately
- if (WINDOWS) {
- aftString = "fourth\\fifth";
- assertEquals("4.0", combo, fore.append(aftString));
- assertEquals("4.1", combo, fore.removeTrailingSeparator().append(aftString));
- assertEquals("4.2", combo, Path.ROOT.append(fore).append(aftString));
- }
-
- assertEquals("5.0", new Path("/foo"), Path.ROOT.append("../foo"));
- assertEquals("5.1", new Path("/foo"), Path.ROOT.append("./foo"));
- assertEquals("5.2", new Path("c:/foo/xyz"), new Path("c:/foo/bar").append("../xyz"));
- assertEquals("5.3", new Path("c:/foo/bar/xyz"), new Path("c:/foo/bar").append("./xyz"));
-
- //append preserves device and leading separator of receiver
- if (WINDOWS) {
- assertEquals("6.1", new Path("c:foo/bar"), new Path("c:").append("/foo/bar"));
- assertEquals("6.2", new Path("c:foo/bar"), new Path("c:").append("foo/bar"));
- assertEquals("6.3", new Path("c:/foo/bar"), new Path("c:/").append("/foo/bar"));
- assertEquals("6.4", new Path("c:/foo/bar"), new Path("c:/").append("foo/bar"));
- assertEquals("6.5", new Path("c:foo/bar"), new Path("c:").append("z:/foo/bar"));
- assertEquals("6.6", new Path("c:foo/bar"), new Path("c:").append("z:foo/bar"));
- assertEquals("6.7", new Path("c:/foo/bar"), new Path("c:/").append("z:/foo/bar"));
- assertEquals("6.8", new Path("c:/foo/bar"), new Path("c:/").append("z:foo/bar"));
- assertEquals("6.9", new Path("c:/foo"), new Path("c:/").append("z:foo"));
- } else {
- assertEquals("6.1", new Path("c:/foo/bar"), new Path("c:").append("/foo/bar"));
- assertEquals("6.2", new Path("c:/foo/bar/"), new Path("c:").append("foo/bar/"));
- assertEquals("6.3", new Path("/c:/foo/bar"), new Path("/c:").append("/foo/bar"));
- assertEquals("6.4", new Path("/c:/foo/bar"), new Path("/c:").append("foo/bar"));
- }
-
-
- assertEquals("6.10", new Path("foo/bar"), new Path("foo").append(new Path("/bar")));
- assertEquals("6.11", new Path("foo/bar"), new Path("foo").append(new Path("bar")));
- assertEquals("6.12", new Path("/foo/bar"), new Path("/foo/").append(new Path("/bar")));
- assertEquals("6.13", new Path("/foo/bar"), new Path("/foo/").append(new Path("bar")));
-
- assertEquals("6.14", new Path("foo/bar/"), new Path("foo").append(new Path("/bar/")));
- assertEquals("6.15", new Path("foo/bar/"), new Path("foo").append(new Path("bar/")));
- assertEquals("6.16", new Path("/foo/bar/"), new Path("/foo/").append(new Path("/bar/")));
- assertEquals("6.17", new Path("/foo/bar/"), new Path("/foo/").append(new Path("bar/")));
-
- //append preserves isUNC of receiver
- assertEquals("7.0", new Path("/foo/bar"), new Path("/foo").append("//bar"));
- assertEquals("7.1", new Path("/foo/bar/test"), new Path("/foo").append("bar//test"));
- assertEquals("7.2", new Path("//foo/bar"), new Path("//foo").append("bar"));
- assertEquals("7.3", new Path("/bar"), Path.ROOT.append("//bar"));
-
- //append empty path does nothing
- assertEquals("8.0", fore, fore.append(Path.ROOT));
- assertEquals("8.1", fore, fore.append(Path.EMPTY));
- assertEquals("8.2", fore, fore.append(new Path("//")));
- assertEquals("8.3", fore, fore.append(new Path("/")));
- assertEquals("8.4", fore, fore.append(new Path("")));
- assertEquals("8.5", fore, fore.append("//"));
- assertEquals("8.6", fore, fore.append("/"));
- assertEquals("8.7", fore, fore.append(""));
- if (WINDOWS) {
- assertEquals("8.8", fore, fore.append("c://"));
- assertEquals("8.9", fore, fore.append("c:/"));
- assertEquals("8.10", fore, fore.append("c:"));
- }
- }
-
- public void testSegmentCount() {
-
- assertEquals("1.0", 0, Path.ROOT.segmentCount());
- assertEquals("1.1", 0, Path.EMPTY.segmentCount());
-
- assertEquals("2.0", 1, new Path("/first").segmentCount());
- assertEquals("2.1", 1, new Path("/first/").segmentCount());
- assertEquals("2.2", 3, new Path("/first/second/third/").segmentCount());
- assertEquals("2.3", 3, new Path("/first/second/third").segmentCount());
- assertEquals("2.4", 5, new Path("/first/second/third/fourth/fifth").segmentCount());
-
- assertEquals("3.0", 0, new Path("//").segmentCount());
- assertEquals("3.1", 1, new Path("//first").segmentCount());
- assertEquals("3.2", 1, new Path("//first/").segmentCount());
- assertEquals("3.3", 2, new Path("//first/second").segmentCount());
- assertEquals("3.4", 2, new Path("//first/second/").segmentCount());
- }
-
- public void testCanonicalize() {
- // Test collapsing multiple separators
- // double slashes at the beginning of a path
- // are left and assumed to be a UNC path
- assertEquals("//", new Path("///////").toString());
- assertEquals("/a/b/c", new Path("/a/b//c").toString());
- assertEquals("//a/b/c", new Path("//a/b//c").toString());
- assertEquals("a/b/c/", new Path("a/b//c//").toString());
-
- // Test collapsing single dots
- assertEquals("2.0", "/", new Path("/./././.").toString());
- assertEquals("2.1", "/a/b/c", new Path("/a/./././b/c").toString());
- assertEquals("2.2", "/a/b/c", new Path("/a/./b/c/.").toString());
- assertEquals("2.3", "a/b/c", new Path("a/./b/./c").toString());
-
- // Test collapsing double dots
- assertEquals("3.0", "/a/b", new Path("/a/b/c/..").toString());
- assertEquals("3.1", "/", new Path("/a/./b/../..").toString());
- assertEquals("3.2", "../", new Path("../").toString());
- // test bug 46043 - IPath collapseParentReferences
- assertEquals("3.3", "../", new Path("./../").toString());
- assertEquals("3.4", "../", new Path(".././").toString());
- assertEquals("3.5", "..", new Path("./..").toString());
- assertEquals("3.6", ".", new Path(".").toString());
- }
-
- public void testClone() {
-
- IPath anyPath = new Path("/a/b/c");
- assertEquals("1.0", anyPath, anyPath.clone());
- anyPath = new Path("//a/b/c");
- assertEquals("1.1", anyPath, anyPath.clone());
- anyPath = new Path("c:/a/b/c");
- assertEquals("1.2", anyPath, anyPath.clone());
-
- assertEquals("1.3", Path.ROOT, Path.ROOT.clone());
- }
-
- public void testConstructors() {
-
- assertEquals("1.0", "", new Path("").toString());
- assertEquals("1.1", "/", new Path("/").toString());
- assertEquals("1.2", "a", new Path("a").toString());
- assertEquals("1.3", "/a", new Path("/a").toString());
- assertEquals("1.4", "//", new Path("//").toString());
- assertEquals("1.5", "/a/", new Path("/a/").toString());
- assertEquals("1.6", "/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z", new Path("/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z").toString());
- assertEquals("1.7", "...", new Path("...").toString());
- assertEquals("1.8", "/a/b/.../c", new Path("/a/b/.../c").toString());
-
- IPath anyPath = new Path("/first/second/third");
-
- assertEquals("2.0", Path.EMPTY, new Path(""));
- assertEquals("2.1", Path.ROOT, new Path("/"));
- assertEquals("2.2", anyPath, anyPath);
-
- //should handle slash before the device (see bug 84697)
- try {
- if (WINDOWS) {
- assertEquals("3.0", "D:/foo/abc.txt", new Path(new java.io.File("D:\\foo\\abc.txt").toURL().getPath()).toString());
- assertEquals("3.1", "D:/", new Path(new java.io.File("D:/").toURL().getPath()).toString());
- }
- } catch (MalformedURLException e) {
- fail("4.99", e);
- }
- }
-
- public void testFirstSegment() {
-
- assertNull("1.0", Path.ROOT.segment(0));
- assertNull("1.1", Path.EMPTY.segment(0));
-
- assertEquals("2.0", "a", new Path("/a/b/c").segment(0));
- assertEquals("2.1", "a", new Path("a").segment(0));
- assertEquals("2.2", "a", new Path("/a").segment(0));
- assertEquals("2.3", "a", new Path("a/b").segment(0));
- assertEquals("2.4", "a", new Path("//a/b").segment(0));
- if (WINDOWS) {
- assertEquals("2.5", "a", new Path("c:a/b").segment(0));
- assertEquals("2.6", "a", new Path("c:/a/b").segment(0));
- } else {
- assertEquals("2.5", "c:", new Path("c:/a/b").segment(0));
- assertEquals("2.6", "c:", new Path("c:/a\\b").segment(0));
- assertEquals("2.5", "a", new Path("a/c:/b").segment(0));
- assertEquals("2.6", "a\\b", new Path("a\\b/b").segment(0));
- }
-
- }
-
- public void testFromPortableString() {
- assertEquals("1.0", "", Path.fromPortableString("").toString());
- assertEquals("1.1", "/", Path.fromPortableString("/").toString());
- assertEquals("1.2", "a", Path.fromPortableString("a").toString());
- assertEquals("1.3", "/a", Path.fromPortableString("/a").toString());
- assertEquals("1.4", "//", Path.fromPortableString("//").toString());
- assertEquals("1.5", "/a/", Path.fromPortableString("/a/").toString());
-
- assertEquals("2.1", "a:", Path.fromPortableString("a:").toString());
- assertEquals("2.2", "a:", Path.fromPortableString("a::").toString());
- assertEquals("2.3", "a:b:", Path.fromPortableString("a:b::").toString());
- assertEquals("2.4", "a/b:c", Path.fromPortableString("a/b::c").toString());
- assertEquals("2.5", "a/b:c", Path.fromPortableString("a/b:c").toString());
- assertEquals("2.6", "a:b", Path.fromPortableString("a::b").toString());
-
- }
-
- public void testGetFileExtension() {
-
- IPath anyPath = new Path("index.html");
- assertEquals("1.0", anyPath.getFileExtension(), "html");
-
- assertNull("2.0", Path.ROOT.getFileExtension());
- assertNull("2.1", Path.EMPTY.getFileExtension());
- assertNull("2.2", new Path("index").getFileExtension());
- assertNull("2.3", new Path("/a/b/c.txt/").getFileExtension());
-
- assertEquals("3.0", "txt", new Path("/a/b/c.txt").getFileExtension());
- assertEquals("3.1", "txt", new Path("/a/b/c.foo.txt").getFileExtension());
- assertEquals("3.2", "txt", new Path("//a/b/c.foo.txt").getFileExtension());
- assertEquals("3.3", "txt", new Path("c:/a/b/c.foo.txt").getFileExtension());
- assertEquals("3.4", "txt", new Path("c:a/b/c.foo.txt").getFileExtension());
-
- }
-
- public void testHasTrailingSeparator() {
-
- // positive
- assertTrue("1.0", new Path("/first/second/third/").hasTrailingSeparator());
- assertTrue("1.1", new Path("//first/second/third/").hasTrailingSeparator());
- assertTrue("1.2", new Path("c:/first/second/third/").hasTrailingSeparator());
- assertTrue("1.3", new Path("c:first/second/third/").hasTrailingSeparator());
-
- // negative
- assertTrue("2.0", !new Path("first/second/third").hasTrailingSeparator());
- assertTrue("2.1", !Path.ROOT.hasTrailingSeparator());
- assertTrue("2.2", !Path.EMPTY.hasTrailingSeparator());
- assertTrue("2.3", !new Path("//first/second/third").hasTrailingSeparator());
- assertTrue("2.4", !new Path("c:/first/second/third").hasTrailingSeparator());
- assertTrue("2.5", !new Path("c:first/second/third").hasTrailingSeparator());
-
- //paths of length 0 never have a trailing separator
- assertTrue("3.0", !new Path("/first/").removeLastSegments(1).hasTrailingSeparator());
- assertTrue("3.1", !new Path("/first/").removeFirstSegments(1).hasTrailingSeparator());
- assertTrue("3.2", !new Path("/").hasTrailingSeparator());
- assertTrue("3.3", !new Path("/first/").append("..").hasTrailingSeparator());
- assertTrue("3.4", !new Path("/first/").append(new Path("..")).hasTrailingSeparator());
- assertTrue("3.5", !new Path("/first/../").hasTrailingSeparator());
- assertTrue("3.6", !Path.ROOT.addTrailingSeparator().hasTrailingSeparator());
- assertTrue("3.7", !Path.EMPTY.addTrailingSeparator().hasTrailingSeparator());
-
- }
-
- public void testIsAbsolute() {
-
- // positive
- assertTrue("1.0", new Path("/first/second/third").isAbsolute());
- assertTrue("1.1", Path.ROOT.isAbsolute());
- assertTrue("1.2", new Path("//first/second/third").isAbsolute());
- if (WINDOWS) {
- assertTrue("1.3", new Path("c:/first/second/third").isAbsolute());
- } else {
- assertTrue("1.3", new Path("/c:first/second/third").isAbsolute());
- }
-
- // negative
- assertTrue("2.0", !new Path("first/second/third").isAbsolute());
- assertTrue("2.1", !Path.EMPTY.isAbsolute());
- assertTrue("2.2", !new Path("c:first/second/third").isAbsolute());
-
- // unc
- if (WINDOWS) {
- assertTrue("3.0", new Path("c://").isAbsolute());
- } else {
- assertTrue("3.0", new Path("//c:/").isAbsolute());
- }
- assertTrue("3.1", new Path("//").isAbsolute());
- assertTrue("3.2", new Path("//a").isAbsolute());
- assertTrue("3.3", new Path("//a/b/").isAbsolute());
-
- }
-
- public void testIsEmpty() {
-
- // positive
- assertTrue("1.0", Path.EMPTY.isEmpty());
- assertTrue("1.1", new Path("//").isEmpty());
- assertTrue("1.2", new Path("").isEmpty());
- assertTrue("1.1", new Path("c:").isEmpty() == WINDOWS);
-
- // negative
- assertTrue("2.0", !new Path("first/second/third").isEmpty());
- assertTrue("2.1", !Path.ROOT.isEmpty());
- assertTrue("2.2", !new Path("//a").isEmpty());
- assertTrue("2.3", !new Path("c:/").isEmpty());
- }
-
- public void testIsPrefixOf() {
-
- IPath prefix = new Path("/first/second");
- IPath path = new Path("/first/second/third/fourth");
-
- assertTrue("1.0", prefix.isPrefixOf(path));
- // test the case where the arg is longer than the receiver.
- assertTrue("1.1", !path.isPrefixOf(prefix));
- assertTrue("1.2", !new Path("fifth/sixth").isPrefixOf(path));
-
- assertTrue("2.0", prefix.addTrailingSeparator().isPrefixOf(path));
-
- assertTrue("3.0", Path.ROOT.isPrefixOf(path));
- assertTrue("3.1", Path.EMPTY.isPrefixOf(path));
- assertTrue("3.2", !path.isPrefixOf(Path.ROOT));
- assertTrue("3.3", !path.isPrefixOf(Path.EMPTY));
- }
-
- public void testIsRoot() {
-
- // negative
- assertTrue("1.0", !new Path("/first/second").isRoot());
- assertTrue("1.1", !Path.EMPTY.isRoot());
- assertTrue("1.2", !new Path("//").isRoot());
-
- // positive
- assertTrue("2.0", Path.ROOT.isRoot());
- assertTrue("2.1", new Path("/").isRoot());
- }
-
- public void testIsUNC() {
-
- // negative
- assertTrue("1.0", !Path.ROOT.isUNC());
- assertTrue("1.1", !Path.EMPTY.isUNC());
-
- assertTrue("2.0", !new Path("a").isUNC());
- assertTrue("2.1", !new Path("a/b").isUNC());
- assertTrue("2.2", !new Path("/a").isUNC());
- assertTrue("2.3", !new Path("/a/b").isUNC());
-
- assertTrue("3.0", !new Path("c:/a/b").isUNC());
- assertTrue("3.1", !new Path("c:a/b").isUNC());
- assertTrue("3.2", !new Path("/F/../").isUNC());
-
- assertTrue("4.0", !new Path("c://a/").isUNC());
- assertTrue("4.1", !new Path("c:\\/a/b").isUNC());
- assertTrue("4.2", !new Path("c:\\\\").isUNC());
-
- // positive
- assertTrue("5.0", new Path("//").isUNC());
- assertTrue("5.1", new Path("//a").isUNC());
- assertTrue("5.2", new Path("//a/b").isUNC());
- if (WINDOWS) {
- assertTrue("5.3", new Path("\\\\ThisMachine\\HOME\\foo.jar").isUNC());
- assertTrue("6.0", new Path("c://a/").setDevice(null).isUNC());
- assertTrue("6.1", new Path("c:\\/a/b").setDevice(null).isUNC());
- assertTrue("6.2", new Path("c:\\\\").setDevice(null).isUNC());
- }
- }
-
- public void testIsValidPath() {
- IPath test = Path.ROOT;
- // positive
- assertTrue("1.0", test.isValidPath("/first/second/third"));
- assertTrue("1.1", test.isValidPath(""));
- assertTrue("1.2", test.isValidPath("a"));
- assertTrue("1.3", test.isValidPath("c:"));
- assertTrue("1.4", test.isValidPath("//"));
- assertTrue("1.5", test.isValidPath("//a"));
- assertTrue("1.6", test.isValidPath("c:/a"));
- assertTrue("1.7", test.isValidPath("c://a//b//c//d//e//f"));
- assertTrue("1.8", test.isValidPath("//a//b//c//d//e//f"));
-
- // negative
- if (WINDOWS) {
- assertTrue("2.1", !test.isValidPath("c:b:"));
- assertTrue("2.2", !test.isValidPath("c:a/b:"));
- }
- }
-
- public void testLastSegment() {
-
- assertEquals("1.0", "second", new Path("/first/second").lastSegment());
-
- assertEquals("2.0", "first", new Path("first").lastSegment());
- assertEquals("2.1", "first", new Path("/first/").lastSegment());
- assertEquals("2.2", "second", new Path("first/second").lastSegment());
- assertEquals("2.3", "second", new Path("first/second/").lastSegment());
-
- assertNull("3.0", Path.EMPTY.lastSegment());
- assertNull("3.1", Path.ROOT.lastSegment());
- assertNull("3.2", new Path("//").lastSegment());
-
- assertEquals("4.0", "second", new Path("//first/second/").lastSegment());
- assertEquals("4.1", "second", new Path("//first/second").lastSegment());
- assertEquals("4.2", "second", new Path("c:/first/second/").lastSegment());
- assertEquals("4.3", "second", new Path("c:first/second/").lastSegment());
-
- assertEquals("5.0", "first", new Path("//first").lastSegment());
- assertEquals("5.1", "first", new Path("//first/").lastSegment());
- }
-
- public void testMakeAbsolute() {
- IPath anyPath = new Path("first/second/third").makeAbsolute();
- assertTrue("1.0", anyPath.isAbsolute());
- assertEquals("1.1", new Path("/first/second/third"), anyPath);
-
- anyPath = new Path("").makeAbsolute();
- assertTrue("2.0", anyPath.isAbsolute());
- assertEquals("2.1", Path.ROOT, anyPath);
- }
-
- public void testMakeRelative() {
- IPath anyPath = new Path("/first/second/third").makeRelative();
- assertTrue("1.0", !anyPath.isAbsolute());
- assertEquals("1.1", new Path("first/second/third"), anyPath);
-
- anyPath = Path.ROOT.makeRelative();
- assertTrue("2.0", !anyPath.isAbsolute());
- assertEquals("2.1", new Path(""), anyPath);
- }
-
- public void testMakeUNC() {
-
- ArrayList inputs = new ArrayList();
- ArrayList expected = new ArrayList();
- ArrayList expectedNon = new ArrayList();
-
- inputs.add(Path.ROOT);
- expected.add("//");
- expectedNon.add("/");
-
- inputs.add(Path.EMPTY);
- expected.add("//");
- expectedNon.add("");
-
- inputs.add(new Path("a"));
- expected.add("//a");
- expectedNon.add("a");
-
- inputs.add(new Path("a/b"));
- expected.add("//a/b");
- expectedNon.add("a/b");
-
- inputs.add(new Path("/a/b/"));
- expected.add("//a/b/");
- expectedNon.add("/a/b/");
-
- inputs.add(new Path("//"));
- expected.add("//");
- expectedNon.add("/");
-
- inputs.add(new Path("//a"));
- expected.add("//a");
- expectedNon.add("/a");
-
- inputs.add(new Path("//a/b"));
- expected.add("//a/b");
- expectedNon.add("/a/b");
-
- inputs.add(new Path("//a/b/"));
- expected.add("//a/b/");
- expectedNon.add("/a/b/");
-
- inputs.add(new Path("c:", "/"));
- expected.add("//");
- expectedNon.add("c:/");
-
- inputs.add(new Path("c:", ""));
- expected.add("//");
- expectedNon.add("c:");
-
- inputs.add(new Path("c:", "a"));
- expected.add("//a");
- expectedNon.add("c:a");
-
- inputs.add(new Path("c:", "a/b"));
- expected.add("//a/b");
- expectedNon.add("c:a/b");
-
- inputs.add(new Path("c:", "/a"));
- expected.add("//a");
- expectedNon.add("c:/a");
-
- inputs.add(new Path("c:", "/a/b"));
- expected.add("//a/b");
- expectedNon.add("c:/a/b");
-
- assertEquals("0.0", inputs.size(), expected.size());
- assertEquals("0.1", inputs.size(), expectedNon.size());
-
- for (int i = 0; i < inputs.size(); i++) {
- IPath path = (IPath) inputs.get(i);
- IPath result = path.makeUNC(true);
- assertTrue("1.0." + path + " (" + result + ")", result.isUNC());
- assertEquals("1.1." + path, (String) expected.get(i), result.toString());
- result = path.makeUNC(false);
- assertTrue("1.3." + path, !result.isUNC());
- assertEquals("1.4." + path, (String) expectedNon.get(i), result.toString());
- }
- }
-
- /**
- * This test is for bizarre cases that previously caused errors.
- */
- public void testRegression() {
- try {
- new Path("C:\\/eclipse");
- } catch (Exception e) {
- fail("1.0", e);
- }
- try {
- if (WINDOWS) {
- IPath path = new Path("d:\\\\ive");
- assertTrue("2.0", !path.isUNC());
- assertEquals("2.1", 1, path.segmentCount());
- assertEquals("2.2", "ive", path.segment(0));
- }
- } catch (Exception e) {
- fail("2.99", e);
- }
-
- }
-
- public void testRemoveFirstSegments() {
- assertEquals("1.0", new Path("second"), new Path("/first/second").removeFirstSegments(1));
- assertEquals("1.1", new Path("second/third/"), new Path("/first/second/third/").removeFirstSegments(1));
- assertEquals("1.2", Path.EMPTY, new Path("first").removeFirstSegments(1));
- assertEquals("1.3", Path.EMPTY, new Path("/first/").removeFirstSegments(1));
- assertEquals("1.4", new Path("second"), new Path("first/second").removeFirstSegments(1));
- assertEquals("1.5", Path.EMPTY, new Path("").removeFirstSegments(1));
- assertEquals("1.6", Path.EMPTY, Path.ROOT.removeFirstSegments(1));
- assertEquals("1.7", Path.EMPTY, new Path("/first/second/").removeFirstSegments(2));
- assertEquals("1.8", Path.EMPTY, new Path("/first/second/").removeFirstSegments(3));
- assertEquals("1.9", new Path("third/fourth"), new Path("/first/second/third/fourth").removeFirstSegments(2));
-
- if (WINDOWS) {
- assertEquals("2.0", new Path("c:second"), new Path("c:/first/second").removeFirstSegments(1));
- assertEquals("2.1", new Path("c:second/third/"), new Path("c:/first/second/third/").removeFirstSegments(1));
- assertEquals("2.2", new Path("c:"), new Path("c:first").removeFirstSegments(1));
- assertEquals("2.3", new Path("c:"), new Path("c:/first/").removeFirstSegments(1));
- assertEquals("2.4", new Path("c:second"), new Path("c:first/second").removeFirstSegments(1));
- assertEquals("2.5", new Path("c:"), new Path("c:").removeFirstSegments(1));
- assertEquals("2.6", new Path("c:"), new Path("c:/").removeFirstSegments(1));
- assertEquals("2.7", new Path("c:"), new Path("c:/first/second/").removeFirstSegments(2));
- assertEquals("2.8", new Path("c:"), new Path("c:/first/second/").removeFirstSegments(3));
- assertEquals("2.9", new Path("c:third/fourth"), new Path("c:/first/second/third/fourth").removeFirstSegments(2));
- }
-
- assertEquals("3.0", new Path("second"), new Path("//first/second").removeFirstSegments(1));
- assertEquals("3.1", new Path("second/third/"), new Path("//first/second/third/").removeFirstSegments(1));
- assertEquals("3.2", Path.EMPTY, new Path("//first/").removeFirstSegments(1));
- assertEquals("3.3", Path.EMPTY, new Path("//").removeFirstSegments(1));
- assertEquals("3.4", Path.EMPTY, new Path("//first/second/").removeFirstSegments(2));
- assertEquals("3.5", Path.EMPTY, new Path("//first/second/").removeFirstSegments(3));
- assertEquals("3.6", new Path("third/fourth"), new Path("//first/second/third/fourth").removeFirstSegments(2));
- }
-
- public void testRemoveLastSegments() {
-
- assertEquals("1.0", new Path("/first"), new Path("/first/second").removeLastSegments(1));
- assertEquals("1.1", new Path("//first"), new Path("//first/second").removeLastSegments(1));
- assertEquals("1.2", new Path("c:/first"), new Path("c:/first/second").removeLastSegments(1));
- assertEquals("1.3", new Path("c:first"), new Path("c:first/second").removeLastSegments(1));
-
- assertEquals("2.0", new Path("/first/second/"), new Path("/first/second/third/").removeLastSegments(1));
- assertEquals("2.1", new Path("//first/second/"), new Path("//first/second/third/").removeLastSegments(1));
- assertEquals("2.2", new Path("c:/first/second/"), new Path("c:/first/second/third/").removeLastSegments(1));
- assertEquals("2.3", new Path("c:first/second/"), new Path("c:first/second/third/").removeLastSegments(1));
-
- assertEquals("3.0", Path.EMPTY, new Path("first").removeLastSegments(1));
- assertEquals("3.1", Path.ROOT, new Path("/first/").removeLastSegments(1));
- assertEquals("3.2", new Path("first"), new Path("first/second").removeLastSegments(1));
-
- assertEquals("4.0", Path.EMPTY, new Path("").removeLastSegments(1));
- assertEquals("4.1", Path.ROOT, Path.ROOT.removeLastSegments(1));
- assertEquals("4.2", new Path("//"), new Path("//").removeLastSegments(1));
- }
-
- public void testRemoveTrailingSeparator() {
-
- IPath with = new Path("/first/second/third/");
- IPath without = new Path("/first/second/third");
-
- assertSame("1.0", without, without.removeTrailingSeparator());
- assertEquals("1.1", without, with.removeTrailingSeparator());
- // trailing separators have no bearing on path equality so check via
- // other means....
- assertTrue("1.2", !with.removeTrailingSeparator().hasTrailingSeparator());
- assertTrue("1.3", !without.hasTrailingSeparator());
- assertEquals("1.4", without.toString(), with.removeTrailingSeparator().toString());
-
- assertSame("2.0", Path.ROOT, Path.ROOT.removeTrailingSeparator());
- assertEquals("2.1", Path.EMPTY, new Path("").removeTrailingSeparator());
-
- assertEquals("3.0", new Path("//"), new Path("//").removeTrailingSeparator());
- assertEquals("3.1", new Path("//a"), new Path("//a").removeTrailingSeparator());
- assertEquals("3.2", new Path("//a"), new Path("//a/").removeTrailingSeparator());
- assertEquals("3.3", new Path("//a/b"), new Path("//a/b").removeTrailingSeparator());
- assertEquals("3.4", new Path("//a/b"), new Path("//a/b/").removeTrailingSeparator());
-
- assertEquals("4.0", new Path("c:"), new Path("c:").removeTrailingSeparator());
- assertEquals("4.1", new Path("c:/"), new Path("c:/").removeTrailingSeparator());
- assertEquals("4.2", new Path("c:/a"), new Path("c:/a/").removeTrailingSeparator());
- assertEquals("4.3", new Path("c:/a/b"), new Path("c:/a/b").removeTrailingSeparator());
- assertEquals("4.4", new Path("c:/a/b"), new Path("c:/a/b/").removeTrailingSeparator());
-
- assertEquals("5.0", new Path("c:a"), new Path("c:a/").removeTrailingSeparator());
- assertEquals("5.1", new Path("c:a/b"), new Path("c:a/b").removeTrailingSeparator());
- assertEquals("5.2", new Path("c:a/b"), new Path("c:a/b/").removeTrailingSeparator());
- }
-
- public void testSegments() {
-
- IPath anyPath = null;
- String[] segs = null;
-
- // Case One: typical case
- anyPath = new Path("/first/second/third/fourth");
- segs = anyPath.segments();
-
- assertEquals("1.0", 4, segs.length);
- assertEquals("1.1", "first", segs[0]);
- assertEquals("1.2", "second", segs[1]);
- assertEquals("1.3", "third", segs[2]);
- assertEquals("1.4", "fourth", segs[3]);
-
- // Case Two: trailing separator
- anyPath = new Path("/first/second/");
- segs = anyPath.segments();
-
- assertEquals("2.0", 2, segs.length);
- assertEquals("2.1", "first", segs[0]);
- assertEquals("2.2", "second", segs[1]);
-
- // Case Three: no leading or trailing separators
- anyPath = new Path("first/second");
- segs = anyPath.segments();
-
- assertEquals("3.0", 2, segs.length);
- assertEquals("3.1", "first", segs[0]);
- assertEquals("3.2", "second", segs[1]);
-
- // Case Four: single segment
- anyPath = new Path("first");
- segs = anyPath.segments();
-
- assertEquals("4.0", 1, segs.length);
- assertEquals("4.1", "first", segs[0]);
-
- // Case Five(a): no segments
- anyPath = Path.EMPTY;
- segs = anyPath.segments();
-
- assertEquals("5.0", 0, segs.length);
-
- // Case Five(b): no segments
- anyPath = Path.ROOT;
- segs = anyPath.segments();
-
- assertEquals("6.0", 0, segs.length);
-
- // Case Six: UNC path
- anyPath = new Path("//server/volume/a/b/c");
- segs = anyPath.segments();
- assertEquals("7.0", 5, segs.length);
- assertEquals("7.1", "server", segs[0]);
- assertEquals("7.2", "volume", segs[1]);
- assertEquals("7.3", "a", segs[2]);
- assertEquals("7.4", "b", segs[3]);
- assertEquals("7.5", "c", segs[4]);
- }
-
- public void testToString() {
-
- IPath anyPath = new Path("/first/second/third");
- assertEquals("1.0", "/first/second/third", anyPath.toString());
-
- assertEquals("1.1", "/", Path.ROOT.toString());
- assertEquals("1.2", "", Path.EMPTY.toString());
- }
-
- public void testUptoSegment() {
-
- //Case 1, absolute path with no trailing separator
- IPath anyPath = new Path("/first/second/third");
-
- assertEquals("1.0", Path.ROOT, anyPath.uptoSegment(0));
- assertEquals("1.1", new Path("/first"), anyPath.uptoSegment(1));
- assertEquals("1.2", new Path("/first/second"), anyPath.uptoSegment(2));
- assertEquals("1.3", new Path("/first/second/third"), anyPath.uptoSegment(3));
- assertEquals("1.4", new Path("/first/second/third"), anyPath.uptoSegment(4));
-
- //Case 2, absolute path with trailing separator
- anyPath = new Path("/first/second/third/");
-
- assertEquals("2.0", Path.ROOT, anyPath.uptoSegment(0));
- assertEquals("2.1", new Path("/first/"), anyPath.uptoSegment(1));
- assertEquals("2.2", new Path("/first/second/"), anyPath.uptoSegment(2));
- assertEquals("2.3", new Path("/first/second/third/"), anyPath.uptoSegment(3));
- assertEquals("2.4", new Path("/first/second/third/"), anyPath.uptoSegment(4));
-
- //Case 3, relative path with no trailing separator
- anyPath = new Path("first/second/third");
-
- assertEquals("3.0", Path.EMPTY, anyPath.uptoSegment(0));
- assertEquals("3.1", new Path("first"), anyPath.uptoSegment(1));
- assertEquals("3.2", new Path("first/second"), anyPath.uptoSegment(2));
- assertEquals("3.3", new Path("first/second/third"), anyPath.uptoSegment(3));
- assertEquals("3.4", new Path("first/second/third"), anyPath.uptoSegment(4));
-
- //Case 4, relative path with trailing separator
- anyPath = new Path("first/second/third/");
-
- assertEquals("4.0", Path.EMPTY, anyPath.uptoSegment(0));
- assertEquals("4.1", new Path("first/"), anyPath.uptoSegment(1));
- assertEquals("4.2", new Path("first/second/"), anyPath.uptoSegment(2));
- assertEquals("4.3", new Path("first/second/third/"), anyPath.uptoSegment(3));
- assertEquals("4.4", new Path("first/second/third/"), anyPath.uptoSegment(4));
-
- // bug 58835 - upToSegment(0) needs to preserve device
- if (WINDOWS) {
- anyPath = new Path("c:/first/second/third");
- assertEquals("5.0", new Path("c:/"), anyPath.uptoSegment(0));
- anyPath = new Path("c:/first/second/third/");
- assertEquals("5.1", new Path("c:/"), anyPath.uptoSegment(0));
- anyPath = new Path("c:first/second/third/");
- assertEquals("5.2", new Path("c:"), anyPath.uptoSegment(0));
- }
- anyPath = new Path("//one/two/three");
- assertEquals("5.3", new Path("//"), anyPath.uptoSegment(0));
- anyPath = new Path("//one/two/three/");
- assertEquals("5.4", new Path("//"), anyPath.uptoSegment(0));
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PlatformTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PlatformTest.java
deleted file mode 100644
index b1b6f43..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PlatformTest.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.*;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.*;
-
-/**
- * Test cases for the Platform API
- */
-public class PlatformTest extends RuntimeTest {
-
- /**
- * Need a zero argument constructor to satisfy the test harness.
- * This constructor should not do any real work nor should it be
- * called by user code.
- */
- public PlatformTest() {
- super(null);
- }
-
- public PlatformTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(PlatformTest.class.getName());
- suite.addTest(new PlatformTest("testKeyRing1"));
- suite.addTest(new PlatformTest("testKeyRing2"));
- suite.addTest(new PlatformTest("testGetCommandLine"));
- suite.addTest(new PlatformTest("testGetLocation"));
- // suite.addTest(new PlatformTest("testRetrievePlugins"));
- suite.addTest(new PlatformTest("testRunnable"));
- return suite;
- }
-
- public void testKeyRing1() {
- URL serverUrl = null;
- try {
- serverUrl = new URL("http://www.hostname.com/");
- } catch (MalformedURLException e) {
- assertTrue("e1", false);
- }
-
- String realm = "realm1@hostname.com";
- String authScheme = "Basic";
- Map info = new Hashtable(2);
- info.put("username", "nogard");
- info.put("password", "secret");
-
- try {
- Platform.addAuthorizationInfo(serverUrl, realm, authScheme, info);
- } catch (CoreException e) {
- assertTrue("e2", false);
- }
-
- info = Platform.getAuthorizationInfo(serverUrl, realm, authScheme);
-
- assertEquals("00", "nogard", info.get("username"));
- assertEquals("01", "secret", info.get("password"));
-
- try {
- Platform.flushAuthorizationInfo(serverUrl, realm, authScheme);
- } catch (CoreException e) {
- assertTrue("e3", false);
- }
-
- info = Platform.getAuthorizationInfo(serverUrl, realm, authScheme);
-
- assertTrue("02", info == null);
- }
-
- public void testKeyRing2() {
- URL url1 = null;
- URL url2 = null;
- try {
- url1 = new URL("http://www.oti.com/file1");
- url2 = new URL("http://www.oti.com/folder1/");
- } catch (MalformedURLException e) {
- assertTrue("00", false);
- }
-
- String realm1 = "realm1";
- String realm2 = "realm2";
-
- try {
- Platform.addProtectionSpace(url1, realm1);
- } catch (CoreException e) {
- assertTrue("e0", false);
- }
-
- assertEquals("00", realm1, Platform.getProtectionSpace(url1));
- assertEquals("01", realm1, Platform.getProtectionSpace(url2));
-
- try {
- Platform.addProtectionSpace(url2, realm1);
- } catch (CoreException e) {
- assertTrue("e1", false);
- }
-
- assertEquals("02", realm1, Platform.getProtectionSpace(url1));
- assertEquals("03", realm1, Platform.getProtectionSpace(url2));
-
- try {
- Platform.addProtectionSpace(url2, realm2);
- } catch (CoreException e) {
- assertTrue("e2", false);
- }
-
- assertTrue("04", Platform.getProtectionSpace(url1) == null);
- assertEquals("05", realm2, Platform.getProtectionSpace(url2));
-
- try {
- Platform.addProtectionSpace(url1, realm1);
- } catch (CoreException e) {
- assertTrue("e3", false);
- }
-
- assertEquals("05", realm1, Platform.getProtectionSpace(url1));
- assertEquals("06", realm1, Platform.getProtectionSpace(url2));
- }
-
- public void testGetCommandLine() {
- assertNotNull("1.0", Platform.getCommandLineArgs());
- }
-
- public void testGetLocation() {
- assertNotNull("1.0", Platform.getLocation());
- }
-
- public void testRetrievePlugins() {
- assertNull("1.0", Platform.getPlugin(""));
- assertNull("1.1", Platform.getPlugin("qwert666yuiop"));
-
- IPluginRegistry registry = Platform.getPluginRegistry();
- IPluginDescriptor descriptors[] = registry.getPluginDescriptors();
-
- for (int i = 0; i < descriptors.length; i++) {
- assertNotNull("2." + i, Platform.getPlugin(descriptors[i].getUniqueIdentifier()).getDescriptor().getInstallURL());
- IPath location;
- try {
- location = Platform.getPluginStateLocation(descriptors[i].getPlugin());
- assertTrue("3." + i, true);
- } catch (CoreException e) {
- assertTrue("3." + i, false);
- continue; // no point continuing this descriptor
- }
-
- assertNotNull("4." + i, location);
- }
- }
-
- public void testRunnable() {
- final Vector exceptions = new Vector();
-
- final List collected = new ArrayList();
-
- // add a log listener to ensure that we report using the right plug-in id
- ILogListener logListener = new ILogListener() {
- public void logging(IStatus status, String plugin) {
- collected.add(status);
- }
- };
- Platform.addLogListener(logListener);
-
- final Exception exception = new Exception("PlatformTest.testRunnable: this exception is thrown on purpose as part of the test.");
- ISafeRunnable runnable = new ISafeRunnable() {
- public void handleException(Throwable exception) {
- exceptions.addElement(exception);
- }
-
- public void run() throws Exception {
- throw exception;
- }
- };
-
- Platform.run(runnable);
-
- Platform.removeLogListener(logListener);
-
- assertEquals("1.0", exceptions.size(), 1);
- assertEquals("1.1", exception, exceptions.firstElement());
-
- // ensures the status object produced has the right plug-in id (bug 83614)
- assertEquals("2.0", collected.size(), 1);
- assertEquals("2.1", RuntimeTest.PI_RUNTIME_TESTS, ((IStatus) collected.get(0)).getPlugin());
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PluginVersionIdentifierTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PluginVersionIdentifierTest.java
deleted file mode 100644
index 73cf201..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PluginVersionIdentifierTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.PluginVersionIdentifier;
-
-public class PluginVersionIdentifierTest extends RuntimeTest {
-
- public PluginVersionIdentifierTest() {
- super(null);
- }
-
- public PluginVersionIdentifierTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(PluginVersionIdentifierTest.class.getName());
- suite.addTest(new PluginVersionIdentifierTest("testConstructor"));
- suite.addTest(new PluginVersionIdentifierTest("testEqual"));
- suite.addTest(new PluginVersionIdentifierTest("testComparisons"));
- return suite;
- }
-
- public void testConstructor() {
-
- assertEquals("1.0", "123.456.789", new PluginVersionIdentifier(123, 456, 789).toString());
- assertEquals("1.1", "123.456.789", new PluginVersionIdentifier("123.456.789").toString());
- assertEquals("1.2", "123.456.0", new PluginVersionIdentifier("123.456").toString());
-
- assertTrue("2.0", "0.123.456" != new PluginVersionIdentifier("123.456").toString());
-
- try {
- new PluginVersionIdentifier("-1.123.456");
- } catch (Exception e) {
- assertTrue("3.0", true);
- }
-
- PluginVersionIdentifier plugin = new PluginVersionIdentifier("1.123.456");
- assertTrue("4.0", plugin.getMajorComponent() == 1);
- assertTrue("4.1", plugin.getMinorComponent() == 123);
- assertTrue("4.2", plugin.getServiceComponent() == 456);
-
- }
-
- // should test the hashcode() method that is currently missing.
- public void testEqual() {
-
- assertTrue("1.0", new PluginVersionIdentifier(123, 456, 789).equals(new PluginVersionIdentifier("123.456.789")));
- assertTrue("1.1", !new PluginVersionIdentifier(123, 456, 789).equals(new PluginVersionIdentifier("123.456")));
-
- }
-
- public void testComparisons() {
-
- PluginVersionIdentifier plugin1 = new PluginVersionIdentifier("1.896.456");
- PluginVersionIdentifier plugin2 = new PluginVersionIdentifier("1.123.456");
- PluginVersionIdentifier plugin3 = new PluginVersionIdentifier("2.123.456");
- PluginVersionIdentifier plugin4 = new PluginVersionIdentifier("2.123.222");
-
- assertTrue("1.0", plugin1.isGreaterThan(plugin2));
- assertTrue("1.1", plugin3.isGreaterThan(plugin2));
- assertTrue("1.2", !plugin1.isGreaterThan(plugin4));
-
- assertTrue("2.0", plugin3.isEquivalentTo(plugin4));
- assertTrue("2.1", !plugin1.isEquivalentTo(plugin2));
- assertTrue("2.2", !plugin1.isEquivalentTo(plugin3));
-
- assertTrue("3.0", plugin1.isCompatibleWith(plugin2));
- assertTrue("3.1", !plugin1.isCompatibleWith(plugin3));
-
- }
-
- public void testValidate() {
- // success cases
- assertTrue("1.0", PluginVersionIdentifier.validateVersion("1").isOK());
- assertTrue("1.1", PluginVersionIdentifier.validateVersion("1.0").isOK());
- assertTrue("1.2", PluginVersionIdentifier.validateVersion("1.0.2").isOK());
- assertTrue("1.3", PluginVersionIdentifier.validateVersion("1.0.2.3456").isOK());
- assertTrue("1.3", PluginVersionIdentifier.validateVersion("1.2.3.-4").isOK());
-
- // failure cases
- assertTrue("2.0", !PluginVersionIdentifier.validateVersion("").isOK());
- assertTrue("2.1", !PluginVersionIdentifier.validateVersion("-1").isOK());
- assertTrue("2.2", !PluginVersionIdentifier.validateVersion(null).isOK());
- assertTrue("2.3", !PluginVersionIdentifier.validateVersion("/").isOK());
- assertTrue("2.4", !PluginVersionIdentifier.validateVersion("1.foo.2").isOK());
- assertTrue("2.5", !PluginVersionIdentifier.validateVersion("1./.3").isOK());
- assertTrue("2.6", !PluginVersionIdentifier.validateVersion(".").isOK());
- assertTrue("2.7", !PluginVersionIdentifier.validateVersion(".1").isOK());
- assertTrue("2.8", !PluginVersionIdentifier.validateVersion("1.2.").isOK());
- assertTrue("2.9", !PluginVersionIdentifier.validateVersion("1.2.3.4.5").isOK());
- assertTrue("2.10", !PluginVersionIdentifier.validateVersion("1.-2").isOK());
- assertTrue("2.11", !PluginVersionIdentifier.validateVersion("1.2.-3").isOK());
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceExportTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceExportTest.java
deleted file mode 100644
index fc5664d..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceExportTest.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.*;
-
-/**
- * Tests the Preferences import/export feature.
- */
-public class PreferenceExportTest extends RuntimeTest {
- public static Test suite() {
- return new TestSuite(PreferenceExportTest.class);
- }
-
- public PreferenceExportTest() {
- super("");
- }
-
- /**
- * Constructor for PreferenceExportTest.
- * @param name
- */
- public PreferenceExportTest(String name) {
- super(name);
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
-
- //remove all properties from runtime tests plugin
- Plugin testPlugin = Platform.getPlugin(PI_RUNTIME_TESTS);
- Preferences prefs = testPlugin.getPluginPreferences();
- String[] defaultNames = prefs.defaultPropertyNames();
- for (int i = 0; i < defaultNames.length; i++) {
- prefs.setDefault(defaultNames[i], Preferences.STRING_DEFAULT_DEFAULT);
- }
- String[] names = prefs.propertyNames();
- for (int i = 0; i < names.length; i++) {
- prefs.setToDefault(names[i]);
- }
- testPlugin.savePluginPreferences();
- }
-
- /**
- * Tests exporting a preference that is different from the default value, but the same
- * as the default-default value. See bug 31458.
- */
- public void testExportEmptyPreference() {
- final String key1 = "SomeTestKey";
- final String key2 = "SomeOtherTestKey";
- final String default1 = "SomeTestValue";
- final int default2 = 5;
- IPath exportPath = new Path(System.getProperty("java.io.tmpdir")).append(Long.toString(System.currentTimeMillis()));
- exportPath.toFile().delete();
- //add a property change listener that asserts key identity
- Plugin testPlugin = Platform.getPlugin(PI_RUNTIME_TESTS);
- Preferences prefs = testPlugin.getPluginPreferences();
- try {
- //add a preference on the runtime plugin
- prefs.setDefault(key1, default1);
- prefs.setValue(key1, Preferences.STRING_DEFAULT_DEFAULT);
- prefs.setDefault(key2, default2);
- prefs.setValue(key2, Preferences.INT_DEFAULT_DEFAULT);
-
- testPlugin.savePluginPreferences();
-
- //export preferences
- try {
- Preferences.exportPreferences(exportPath);
- } catch (CoreException e) {
- fail("1.1", e);
- }
-
- //change the property value
- prefs.setToDefault(key1);
- prefs.setToDefault(key2);
-
- assertEquals("1.0", default1, prefs.getString(key1));
- assertEquals("1.1", default2, prefs.getInt(key2));
-
- //reimport the property
- try {
- Preferences.importPreferences(exportPath);
- } catch (CoreException e) {
- fail("1.2", e);
- }
-
- //ensure the imported preference is set
- assertEquals("2.0", Preferences.STRING_DEFAULT_DEFAULT, prefs.getString(key1));
- assertEquals("2.1", Preferences.INT_DEFAULT_DEFAULT, prefs.getInt(key2));
-
- } finally {
- exportPath.toFile().delete();
- }
- }
-
- /**
- * Tests that identity tests on preference keys after
- * export/import will still work. This is to safeguard
- * against programming errors in property change listeners.
- * See bug 20193.
- */
- public void testKeyIdentityAfterExport() {
- final String key = "SomeTestKey";
- String initialValue = "SomeTestValue";
- IPath exportPath = new Path(System.getProperty("java.io.tmpdir")).append(Long.toString(System.currentTimeMillis()));
- exportPath.toFile().delete();
- //add a property change listener that asserts key identity
- Plugin testPlugin = Platform.getPlugin(PI_RUNTIME_TESTS);
- Preferences prefs = testPlugin.getPluginPreferences();
- Preferences.IPropertyChangeListener listener = new Preferences.IPropertyChangeListener() {
- public void propertyChange(Preferences.PropertyChangeEvent event) {
- assertSame("1.0", event.getProperty(), key);
- }
- };
- prefs.addPropertyChangeListener(listener);
- try {
- //add a preference on the runtime plugin
- prefs.setValue(key, initialValue);
- testPlugin.savePluginPreferences();
-
- //export preferences
- try {
- Preferences.exportPreferences(exportPath);
- } catch (CoreException e) {
- fail("1.1", e);
- }
-
- //change the property value
- prefs.setValue(key, "SomeOtherValue");
-
- //reimport the property
- try {
- Preferences.importPreferences(exportPath);
- } catch (CoreException e) {
- fail("1.2", e);
- }
-
- //set the property to default
- prefs.setToDefault(key);
-
- //reimport the property
- try {
- Preferences.importPreferences(exportPath);
- } catch (CoreException e) {
- fail("1.3", e);
- }
- } finally {
- exportPath.toFile().delete();
- if (prefs != null)
- prefs.removePropertyChangeListener(listener);
- }
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceForwarderTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceForwarderTest.java
deleted file mode 100644
index 1f384f7..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceForwarderTest.java
+++ /dev/null
@@ -1,866 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import java.io.*;
-import java.util.*;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.internal.preferences.legacy.PreferenceForwarder;
-import org.eclipse.core.internal.runtime.RuntimeLog;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
-import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * Test suite for API class org.eclipse.core.runtime.Preferences
- */
-public class PreferenceForwarderTest extends RuntimeTest {
-
- class Tracer implements Preferences.IPropertyChangeListener {
- public StringBuffer log = new StringBuffer();
-
- private String typeCode(Object value) {
- if (value == null)
- return ""; //$NON-NLS-1$
- if (value instanceof Boolean)
- return "B"; //$NON-NLS-1$
- if (value instanceof Integer)
- return "I"; //$NON-NLS-1$
- if (value instanceof Long)
- return "L"; //$NON-NLS-1$
- if (value instanceof Float)
- return "F"; //$NON-NLS-1$
- if (value instanceof Double)
- return "D"; //$NON-NLS-1$
- if (value instanceof String)
- return "S"; //$NON-NLS-1$
- assertTrue("0.0", false); //$NON-NLS-1$
- return null;
- }
-
- public void propertyChange(Preferences.PropertyChangeEvent event) {
- log.append('[');
- log.append(event.getProperty());
- log.append(':');
- log.append(typeCode(event.getOldValue()));
- log.append(event.getOldValue() == null ? "null" : event.getOldValue()); //$NON-NLS-1$
- log.append("->"); //$NON-NLS-1$
- log.append(typeCode(event.getNewValue()));
- log.append(event.getNewValue() == null ? "null" : event.getNewValue()); //$NON-NLS-1$
- log.append(']');
- }
- }
-
- public PreferenceForwarderTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- // all test methods are named "test..."
- return new TestSuite(PreferenceForwarderTest.class);
-
-// TestSuite suite = new TestSuite();
-// suite.addTest(new PreferenceForwarderTest("testListenerOnRemove"));
-// return suite;
- }
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() {
- // do nothing
- }
-
- /*
- * @see TestCase#tearDown()
- */
- protected void tearDown() {
- // do nothing
- }
-
- public void testConstants() {
- // make sure that the preference store constants are defined properly
- assertEquals("1.0", false, Preferences.BOOLEAN_DEFAULT_DEFAULT);
- assertEquals("1.1", 0, Preferences.INT_DEFAULT_DEFAULT);
- assertEquals("1.2", 0L, Preferences.LONG_DEFAULT_DEFAULT);
- assertEquals("1.3", 0.0f, Preferences.FLOAT_DEFAULT_DEFAULT, 0.0f);
- assertEquals("1.4", 0.0, Preferences.DOUBLE_DEFAULT_DEFAULT, 0.0);
- assertEquals("1.5", "", Preferences.STRING_DEFAULT_DEFAULT);
- }
-
- public void testBasics() {
-
- Preferences ps = new PreferenceForwarder(getUniqueString());
- final String k1 = "key1";
- final String v1 = "1";
- final String v2 = "2";
- final String v3 = "3";
-
- // check that a random property in a newly created store
- // appearchs to have default-default values of whatever type asked for
- assertEquals("1.0", true, ps.isDefault(k1));
- assertEquals("1.1", Preferences.BOOLEAN_DEFAULT_DEFAULT, ps.getBoolean(k1));
- assertEquals("1.2", Preferences.INT_DEFAULT_DEFAULT, ps.getInt(k1));
- assertEquals("1.3", Preferences.LONG_DEFAULT_DEFAULT, ps.getLong(k1));
- assertEquals("1.4", Preferences.FLOAT_DEFAULT_DEFAULT, ps.getFloat(k1), 0.0f);
- assertEquals("1.5", Preferences.DOUBLE_DEFAULT_DEFAULT, ps.getDouble(k1), 0.0);
- assertEquals("1.6", Preferences.STRING_DEFAULT_DEFAULT, ps.getString(k1));
-
- assertEquals("1.7", Preferences.BOOLEAN_DEFAULT_DEFAULT, ps.getDefaultBoolean(k1));
- assertEquals("1.8", Preferences.INT_DEFAULT_DEFAULT, ps.getDefaultInt(k1));
- assertEquals("1.9", Preferences.LONG_DEFAULT_DEFAULT, ps.getDefaultLong(k1));
- assertEquals("1.10", Preferences.FLOAT_DEFAULT_DEFAULT, ps.getDefaultFloat(k1), 0.0f);
- assertEquals("1.11", Preferences.DOUBLE_DEFAULT_DEFAULT, ps.getDefaultDouble(k1), 0.0);
- assertEquals("1.12", Preferences.STRING_DEFAULT_DEFAULT, ps.getDefaultString(k1));
-
- // test set/getString
- // give it a value
- ps.setValue(k1, v1);
- assertTrue("2.0", ps.isDefault(k1) == false);
- assertEquals("2.1", v1, ps.getString(k1));
- assertEquals("2.2", Preferences.STRING_DEFAULT_DEFAULT, ps.getDefaultString(k1));
- // change the value
- ps.setValue(k1, v2);
- assertTrue("2.3", ps.isDefault(k1) == false);
- assertEquals("2.4", v2, ps.getString(k1));
- assertEquals("2.5", Preferences.STRING_DEFAULT_DEFAULT, ps.getDefaultString(k1));
- // change to same value as default
- ps.setValue(k1, ps.getDefaultString(k1));
- assertTrue("2.6", ps.isDefault(k1) == true);
- assertEquals("2.7", ps.getDefaultString(k1), ps.getString(k1));
- assertEquals("2.8", Preferences.STRING_DEFAULT_DEFAULT, ps.getDefaultString(k1));
- // reset to default
- ps.setValue(k1, v2);
- ps.setToDefault(k1);
- assertTrue("2.9", ps.isDefault(k1) == true);
- assertEquals("2.10", Preferences.STRING_DEFAULT_DEFAULT, ps.getString(k1));
- assertEquals("2.11", Preferences.STRING_DEFAULT_DEFAULT, ps.getDefaultString(k1));
- // change default
- ps.setDefault(k1, v1);
- assertTrue("2.12", ps.isDefault(k1) == true);
- assertEquals("2.13", v1, ps.getString(k1));
- assertEquals("2.14", v1, ps.getDefaultString(k1));
- // set the value
- ps.setValue(k1, v2);
- assertTrue("2.15", ps.isDefault(k1) == false);
- assertEquals("2.16", v2, ps.getString(k1));
- assertEquals("2.17", v1, ps.getDefaultString(k1));
- // change to same value as default
- ps.setValue(k1, ps.getDefaultString(k1));
- assertTrue("2.18", ps.isDefault(k1) == true);
- assertEquals("2.19", ps.getDefaultString(k1), ps.getString(k1));
- assertEquals("2.20", v1, ps.getDefaultString(k1));
- // reset to default
- ps.setValue(k1, v2);
- ps.setToDefault(k1);
- assertTrue("2.21", ps.isDefault(k1) == true);
- assertEquals("2.22", v1, ps.getString(k1));
- assertEquals("2.23", v1, ps.getDefaultString(k1));
- // change default
- ps.setDefault(k1, v3);
- assertTrue("2.24", ps.isDefault(k1) == true);
- assertEquals("2.25", v3, ps.getString(k1));
- assertEquals("2.26", v3, ps.getDefaultString(k1));
-
- }
-
- public void testBoolean() {
-
- Preferences ps = new PreferenceForwarder(getUniqueString());
- final String k1 = "key1";
-
- assertEquals("1.0", false, Preferences.BOOLEAN_DEFAULT_DEFAULT);
- assertEquals("1.1", Preferences.BOOLEAN_DEFAULT_DEFAULT, ps.getBoolean(k1));
-
- ps.setValue(k1, true);
- assertEquals("1.2", true, ps.getBoolean(k1));
- ps.setValue(k1, false);
- assertEquals("1.3", false, ps.getBoolean(k1));
-
- ps.setDefault(k1, true);
- assertEquals("1.4", true, ps.getDefaultBoolean(k1));
- ps.setDefault(k1, false);
- assertEquals("1.5", false, ps.getDefaultBoolean(k1));
-
- }
-
- public void testInteger() {
-
- Preferences ps = new PreferenceForwarder(getUniqueString());
- final String k1 = "key1";
- final int[] values = {0, 1002, -201788, Integer.MAX_VALUE, Integer.MIN_VALUE};
-
- assertEquals("1.0", 0, Preferences.INT_DEFAULT_DEFAULT);
- assertEquals("1.1", Preferences.INT_DEFAULT_DEFAULT, ps.getInt(k1));
-
- for (int i = 0; i < values.length; i++) {
- int v1 = values[i];
- int v2 = v1 + 1;
- ps.setValue(k1, v1);
- assertEquals("1.2", v1, ps.getInt(k1));
- ps.setDefault(k1, v2);
- assertEquals("1.3", v2, ps.getDefaultInt(k1));
- }
- }
-
- public void testLong() {
-
- Preferences ps = new PreferenceForwarder(getUniqueString());
- final String k1 = "key1";
- final long[] values = {0L, 1002L, -201788L, Long.MAX_VALUE, Long.MIN_VALUE};
-
- assertEquals("1.0", 0L, Preferences.LONG_DEFAULT_DEFAULT);
- assertEquals("1.1", Preferences.LONG_DEFAULT_DEFAULT, ps.getLong(k1));
-
- for (int i = 0; i < values.length; i++) {
- long v1 = values[i];
- long v2 = v1 + 1;
- ps.setValue(k1, v1);
- assertEquals("1.2", v1, ps.getLong(k1));
- ps.setDefault(k1, v2);
- assertEquals("1.3", v2, ps.getDefaultLong(k1));
- }
- }
-
- public void testFloat() {
-
- Preferences ps = new PreferenceForwarder(getUniqueString());
- final String k1 = "key1";
- final float[] values = {0.0f, 1002.5f, -201788.55f, Float.MAX_VALUE, Float.MIN_VALUE};
- final float tol = 1.0e-20f;
-
- assertEquals("1.0", 0.0f, Preferences.FLOAT_DEFAULT_DEFAULT, tol);
- assertEquals("1.1", Preferences.FLOAT_DEFAULT_DEFAULT, ps.getFloat(k1), tol);
-
- for (int i = 0; i < values.length; i++) {
- float v1 = values[i];
- float v2 = v1 + 1.0f;
- ps.setValue(k1, v1);
- assertEquals("1.2", v1, ps.getFloat(k1), tol);
- ps.setDefault(k1, v2);
- assertEquals("1.3", v2, ps.getDefaultFloat(k1), tol);
- }
-
- try {
- ps.setValue(k1, Float.NaN);
- assertTrue("1.4", false);
- } catch (IllegalArgumentException e) {
- // NaNs should be rejected
- }
-
- }
-
- public void testDouble() {
-
- Preferences ps = new PreferenceForwarder(getUniqueString());
- final String k1 = "key1";
- final double[] values = {0.0, 1002.5, -201788.55, Double.MAX_VALUE, Double.MIN_VALUE};
- final double tol = 1.0e-20;
-
- assertEquals("1.0", 0.0, Preferences.DOUBLE_DEFAULT_DEFAULT, tol);
- assertEquals("1.1", Preferences.DOUBLE_DEFAULT_DEFAULT, ps.getDouble(k1), tol);
-
- for (int i = 0; i < values.length; i++) {
- double v1 = values[i];
- double v2 = v1 + 1.0;
- ps.setValue(k1, v1);
- assertEquals("1.2", v1, ps.getDouble(k1), tol);
- ps.setDefault(k1, v2);
- assertEquals("1.3", v2, ps.getDefaultDouble(k1), tol);
- }
-
- try {
- ps.setValue(k1, Float.NaN);
- assertTrue("1.4", false);
- } catch (IllegalArgumentException e) {
- // NaNs should be rejected
- }
-
- }
-
- public void testString() {
-
- Preferences ps = new PreferenceForwarder(getUniqueString());
- final String k1 = "key1";
- final String[] values = {"", "hello", " x ", "\n"};
-
- assertEquals("1.0", "", Preferences.STRING_DEFAULT_DEFAULT);
- assertEquals("1.1", ps.getString(k1), Preferences.STRING_DEFAULT_DEFAULT);
-
- for (int i = 0; i < values.length; i++) {
- String v1 = values[i];
- String v2 = v1 + "x";
- ps.setValue(k1, v1);
- assertEquals("1.2", v1, ps.getString(k1));
- ps.setDefault(k1, v2);
- assertEquals("1.3", v2, ps.getDefaultString(k1));
- }
- }
-
- public void testPropertyNames() {
-
- Preferences ps = new PreferenceForwarder(getUniqueString());
-
- // there are no properties initially
- assertEquals("1.0", 0, ps.propertyNames().length);
-
- String[] keys = {"a", "b", "c", "d"};
-
- // setting defaults does not add name to set
- for (int i = 0; i < keys.length; i++) {
- ps.setDefault(keys[i], "default");
- }
- assertEquals("1.1", 0, ps.propertyNames().length);
-
- // setting real values does add name to set
- for (int i = 0; i < keys.length; i++) {
- ps.setValue(keys[i], "actual");
- }
- assertEquals("1.2", keys.length, ps.propertyNames().length);
-
- Set s1 = new HashSet(Arrays.asList(keys));
- Set s2 = new HashSet(Arrays.asList(ps.propertyNames()));
- assertEquals("1.3", s1, s2);
-
- // setting to default does remove name from set
- for (int i = 0; i < keys.length; i++) {
- ps.setToDefault(keys[i]);
- Set s = new HashSet(Arrays.asList(ps.propertyNames()));
- assertTrue("1.4", !s.contains(keys[i]));
- }
- assertEquals("1.5", 0, ps.propertyNames().length);
- }
-
- public void testContains() {
-
- Preferences ps = new PreferenceForwarder(getUniqueString());
-
- // there are no properties initially
- assertEquals("1.0", false, ps.contains("a"));
-
- // setting defaults adds name
- ps.setDefault("a", "default");
- assertEquals("1.1", true, ps.contains("a"));
-
- // setting value adds name
- assertEquals("1.2", false, ps.contains("b"));
- ps.setValue("b", "any");
- assertEquals("1.3", true, ps.contains("b"));
-
- // setting value does not remove entry already there
- ps.setValue("a", "any");
- assertEquals("1.4", true, ps.contains("a"));
- assertEquals("1.5", true, ps.contains("b"));
-
- // setting to default removes name from set unless there is a default too
- ps.setToDefault("b");
- assertEquals("1.6", false, ps.contains("b"));
- ps.setToDefault("a");
- assertEquals("1.7", true, ps.contains("a"));
-
- // test bug 62586
- // fail gracefully in PreferenceForwarder.contains(null)
- try {
- assertTrue("2.0", !ps.contains(null));
- } catch (NullPointerException e) {
- fail("2.1", e);
- }
- }
-
- public void testDefaultPropertyNames() {
-
- Preferences ps = new PreferenceForwarder(getUniqueString());
-
- // there are no default properties initially
- assertEquals("1.0", 0, ps.defaultPropertyNames().length);
-
- String[] keys = {"a", "b", "c", "d"};
-
- // setting actual values does not add name to set
- for (int i = 0; i < keys.length; i++) {
- ps.setValue(keys[i], "actual");
- }
- assertEquals("1.1", 0, ps.defaultPropertyNames().length);
-
- // setting defaults does add name to set
- for (int i = 0; i < keys.length; i++) {
- ps.setDefault(keys[i], "default");
- }
- assertEquals("1.2", keys.length, ps.defaultPropertyNames().length);
-
- Set s1 = new HashSet(Arrays.asList(keys));
- Set s2 = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertEquals("1.3", s1, s2);
-
- // setting to default does not remove name from set
- for (int i = 0; i < keys.length; i++) {
- ps.setToDefault(keys[i]);
- Set s = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertTrue("1.4", s.contains(keys[i]));
- }
- assertEquals("1.5", keys.length, ps.defaultPropertyNames().length);
-
- // setting to default-default does not remove name from set either
- for (int i = 0; i < keys.length; i++) {
- ps.setDefault(keys[i], Preferences.STRING_DEFAULT_DEFAULT);
- Set s = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertTrue("1.6.1", s.contains(keys[i]));
-
- ps.setDefault(keys[i], Preferences.BOOLEAN_DEFAULT_DEFAULT);
- s = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertTrue("1.6.2", s.contains(keys[i]));
-
- ps.setDefault(keys[i], Preferences.INT_DEFAULT_DEFAULT);
- s = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertTrue("1.6.3", s.contains(keys[i]));
-
- ps.setDefault(keys[i], Preferences.LONG_DEFAULT_DEFAULT);
- s = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertTrue("1.6.4", s.contains(keys[i]));
-
- ps.setDefault(keys[i], Preferences.FLOAT_DEFAULT_DEFAULT);
- s = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertTrue("1.6.5", s.contains(keys[i]));
-
- ps.setDefault(keys[i], Preferences.DOUBLE_DEFAULT_DEFAULT);
- s = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertTrue("1.6.6", s.contains(keys[i]));
- }
- assertEquals("1.7", keys.length, ps.defaultPropertyNames().length);
- }
-
- public void test55138() {
- final Preferences ps = new PreferenceForwarder(getUniqueString());
-
- final Tracer tracer1 = new Tracer();
- String key = "foo";
-
- // register one listener
- ps.addPropertyChangeListener(tracer1);
- assertEquals("1.0", "", tracer1.log.toString());
-
- // boolean value
- boolean booleanDefault = true;
- boolean booleanValue = false;
- ps.setDefault(key, booleanDefault);
- assertEquals("2.0", "", tracer1.log.toString());
-
- tracer1.log.setLength(0);
- ps.setValue(key, booleanValue);
- assertEquals("2.1", "[foo:Btrue->Bfalse]", tracer1.log.toString());
-
- ps.setValue(key, booleanDefault);
- assertEquals("2.2", "[foo:Btrue->Bfalse][foo:Bfalse->Btrue]", tracer1.log.toString());
-
- // int value
- int intDefault = 10;
- int intValue = 11;
- tracer1.log.setLength(0);
- ps.setDefault(key, intDefault);
- assertEquals("3.0", "", tracer1.log.toString());
-
- ps.setValue(key, intValue);
- assertEquals("3.1", "[foo:I10->I11]", tracer1.log.toString());
-
- ps.setValue(key, intDefault);
- assertEquals("3.2", "[foo:I10->I11][foo:I11->I10]", tracer1.log.toString());
-
- // double value
- double doubleDefault = 10.0;
- double doubleValue = 11.0;
- tracer1.log.setLength(0);
- ps.setDefault(key, doubleDefault);
- assertEquals("4.0", "", tracer1.log.toString());
-
- tracer1.log.setLength(0);
- ps.setValue(key, doubleValue);
- assertEquals("4.1", "[foo:D10.0->D11.0]", tracer1.log.toString());
-
- ps.setValue(key, doubleDefault);
- assertEquals("4.2", "[foo:D10.0->D11.0][foo:D11.0->D10.0]", tracer1.log.toString());
-
- // float value
- float floatDefault = 10.0f;
- float floatValue = 11.0f;
- tracer1.log.setLength(0);
- ps.setDefault(key, floatDefault);
- assertEquals("5.0", "", tracer1.log.toString());
-
- tracer1.log.setLength(0);
- ps.setValue(key, floatValue);
- assertEquals("5.1", "[foo:F10.0->F11.0]", tracer1.log.toString());
-
- ps.setValue(key, floatDefault);
- assertEquals("5.2", "[foo:F10.0->F11.0][foo:F11.0->F10.0]", tracer1.log.toString());
-
- // long value
- long longDefault = 10L;
- long longValue = 11L;
- tracer1.log.setLength(0);
- ps.setDefault(key, longDefault);
- assertEquals("6.0", "", tracer1.log.toString());
-
- tracer1.log.setLength(0);
- ps.setValue(key, longValue);
- assertEquals("6.1", "[foo:L10->L11]", tracer1.log.toString());
-
- ps.setValue(key, longDefault);
- assertEquals("6.2", "[foo:L10->L11][foo:L11->L10]", tracer1.log.toString());
- }
-
- public void testListeners() {
-
- final Preferences ps = new PreferenceForwarder(getUniqueString());
-
- final Tracer tracer1 = new Tracer();
- final Tracer tracer2 = new Tracer();
-
- // register one listener
- ps.addPropertyChangeListener(tracer1);
- assertEquals("1.0", "", tracer1.log.toString());
-
- // make sure it is notified in a type appropriate manner
- ps.setValue("a", "1");
- assertEquals("1.0.1", "[a:S->S1]", tracer1.log.toString());
-
- ps.setToDefault("a");
- tracer1.log.setLength(0);
- ps.setValue("a", true);
- assertEquals("1.0.2", "[a:Bfalse->Btrue]", tracer1.log.toString());
-
- ps.setToDefault("a");
- tracer1.log.setLength(0);
- ps.setValue("a", 100);
- assertEquals("1.0.3", "[a:I0->I100]", tracer1.log.toString());
-
- ps.setToDefault("a");
- tracer1.log.setLength(0);
- ps.setValue("a", 100L);
- assertEquals("1.0.4", "[a:L0->L100]", tracer1.log.toString());
-
- ps.setToDefault("a");
- tracer1.log.setLength(0);
- ps.setValue("a", 2.0f);
- assertEquals("1.0.5", "[a:F0.0->F2.0]", tracer1.log.toString());
-
- ps.setToDefault("a");
- tracer1.log.setLength(0);
- ps.setValue("a", 2.0);
- assertEquals("1.0.6", "[a:D0.0->D2.0]", tracer1.log.toString());
-
- // make sure it is notified of a series of events
- ps.setToDefault("a");
- tracer1.log.setLength(0);
- ps.setValue("a", "1");
- assertEquals("1.1", "[a:S->S1]", tracer1.log.toString());
-
- ps.setValue("a", "2");
- assertEquals("1.2", "[a:S->S1][a:S1->S2]", tracer1.log.toString());
-
- ps.setValue("a", ps.getDefaultString("a"));
- assertEquals("1.2.1", "[a:S->S1][a:S1->S2][a:S2->S]", tracer1.log.toString());
-
- ps.setValue("a", "3");
- assertEquals("1.2.2", "[a:S->S1][a:S1->S2][a:S2->S][a:S->S3]", tracer1.log.toString());
-
- ps.setToDefault("a");
- assertEquals("1.2.3", "[a:S->S1][a:S1->S2][a:S2->S][a:S->S3][a:S3->S]", tracer1.log.toString());
-
- // change to same value - no one notified
- ps.setValue("a", "2");
- tracer1.log.setLength(0);
- assertEquals("1.3", "", tracer1.log.toString());
-
- // register second listener
- ps.addPropertyChangeListener(tracer2);
-
- // make sure both are notified
- ps.setValue("a", "3");
- assertEquals("1.4", "[a:S2->S3]", tracer1.log.toString());
- assertEquals("1.5", "[a:S2->S3]", tracer2.log.toString());
-
- // deregister is honored
- ps.removePropertyChangeListener(tracer2);
- tracer1.log.setLength(0);
- tracer2.log.setLength(0);
- ps.setValue("a", "1");
- assertEquals("1.6", "[a:S3->S1]", tracer1.log.toString());
- assertEquals("1.7", "", tracer2.log.toString());
-
- // duplicate deregister is ignored
- ps.removePropertyChangeListener(tracer2);
- tracer1.log.setLength(0);
- tracer2.log.setLength(0);
- ps.setValue("a", "2");
- assertEquals("1.8", "[a:S1->S2]", tracer1.log.toString());
- assertEquals("1.9", "", tracer2.log.toString());
-
- // duplicate register is ignored
- ps.addPropertyChangeListener(tracer1);
- tracer1.log.setLength(0);
- ps.setValue("a", "1");
- assertEquals("1.10", "[a:S2->S1]", tracer1.log.toString());
-
- // last deregister is honored
- ps.removePropertyChangeListener(tracer1);
- tracer1.log.setLength(0);
- ps.setValue("a", "4");
- assertEquals("1.11", "", tracer1.log.toString());
-
- // adds 2 and removes 1 during during callback!
- class Trouble implements Preferences.IPropertyChangeListener {
- public void propertyChange(Preferences.PropertyChangeEvent event) {
- ps.removePropertyChangeListener(tracer1);
- ps.addPropertyChangeListener(tracer2);
- }
- }
-
- ps.setValue("a", "0");
- ps.addPropertyChangeListener(tracer1);
- ps.addPropertyChangeListener(new Trouble());
- tracer1.log.setLength(0);
- tracer2.log.setLength(0);
- ps.setValue("a", "1");
- ps.setValue("a", "2");
- assertEquals("1.12", "[a:S0->S1]", tracer1.log.toString());
- assertEquals("1.13", "[a:S1->S2]", tracer2.log.toString());
-
- }
-
- public void testLoadStore() {
-
- final Preferences ps = new PreferenceForwarder(getUniqueString());
-
- ps.setValue("b1", true);
- ps.setValue("i1", 1);
- ps.setValue("l1", 2L);
- ps.setValue("f1", 1.0f);
- ps.setValue("d1", 1.0);
- ps.setValue("s1", "x");
- String[] keys = {"b1", "i1", "l1", "f1", "d1", "s1",};
-
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- try {
- ps.store(out, "test header");
- } catch (IOException e) {
- assertTrue("0.1", false);
- }
-
- ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
-
- final Preferences ps2 = new PreferenceForwarder(getUniqueString());
- try {
- ps2.load(in);
- } catch (IOException e) {
- assertTrue("0.2", false);
- }
-
- assertEquals("1.1", true, ps2.getBoolean("b1"));
- assertEquals("1.2", 1, ps2.getInt("i1"));
- assertEquals("1.3", 2L, ps2.getLong("l1"));
- assertEquals("1.4", 1.0f, ps2.getFloat("f1"), 1e-20f);
- assertEquals("1.5", 1.0, ps2.getDouble("d1"), 1e-20);
- assertEquals("1.6", "x", ps2.getString("s1"));
-
- Set s1 = new HashSet(Arrays.asList(keys));
- Set s2 = new HashSet(Arrays.asList(ps2.propertyNames()));
- assertEquals("1.7", s1, s2);
-
- // load discards current values
- in = new ByteArrayInputStream(out.toByteArray());
- final Preferences ps3 = new PreferenceForwarder(getUniqueString());
- ps3.setValue("s1", "y");
- try {
- ps3.load(in);
- assertEquals("1.8", "x", ps3.getString("s1"));
- Set k1 = new HashSet(Arrays.asList(keys));
- Set k2 = new HashSet(Arrays.asList(ps3.propertyNames()));
- assertEquals("1.9", k1, k2);
- } catch (IOException e) {
- assertTrue("1.10", false);
- }
-
- }
-
- public void testNeedsSaving() {
-
- Preferences ps = new PreferenceForwarder(getUniqueString());
-
- // setValue dirties
- ps = new PreferenceForwarder(getUniqueString());
- assertEquals("1.0", false, ps.needsSaving());
- ps.setValue("b1", true);
- assertEquals("1.1", true, ps.needsSaving());
-
- ps = new PreferenceForwarder(getUniqueString());
- assertEquals("2.0", false, ps.needsSaving());
- ps.setValue("i1", 1);
- assertEquals("2.1", true, ps.needsSaving());
-
- ps = new PreferenceForwarder(getUniqueString());
- assertEquals("3.0", false, ps.needsSaving());
- ps.setValue("l1", 2L);
- assertEquals("3.1", true, ps.needsSaving());
-
- ps = new PreferenceForwarder(getUniqueString());
- assertEquals("4.0", false, ps.needsSaving());
- ps.setValue("f1", 1.0f);
- assertEquals("4.1", true, ps.needsSaving());
-
- ps = new PreferenceForwarder(getUniqueString());
- assertEquals("5.0", false, ps.needsSaving());
- ps.setValue("d1", 1.0);
- assertEquals("5.1", true, ps.needsSaving());
-
- ps = new PreferenceForwarder(getUniqueString());
- assertEquals("6.0", false, ps.needsSaving());
- ps.setValue("s1", "x");
- assertEquals("6.1", true, ps.needsSaving());
-
- // setToDefault does not dirty if value not set
- ps = new PreferenceForwarder(getUniqueString());
- assertEquals("7.0", false, ps.needsSaving());
- ps.setToDefault("any");
- assertEquals("7.1", false, ps.needsSaving());
-
- // setToDefault dirties if value was set
- try {
- ps = new PreferenceForwarder(getUniqueString());
- assertEquals("7.2", false, ps.needsSaving());
- ps.setValue("any", "x");
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- ps.store(out, "test header");
- ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
- ps.load(in);
- assertEquals("7.3", false, ps.needsSaving());
- ps.setToDefault("any");
- assertEquals("7.4", true, ps.needsSaving());
- } catch (IOException e) {
- assertTrue("7.5", false);
- }
-
- // setDefault, getT, getDefaultT do not dirty
- ps = new PreferenceForwarder(getUniqueString());
- assertEquals("8.0", false, ps.needsSaving());
- ps.setDefault("b1", true);
- ps.getBoolean("b1");
- ps.getDefaultBoolean("b1");
- ps.setDefault("i1", 1);
- ps.getInt("i1");
- ps.getDefaultInt("i1");
- ps.setDefault("l1", 1L);
- ps.getLong("l1");
- ps.getDefaultLong("l1");
- ps.setDefault("f1", 1.0f);
- ps.getFloat("f1");
- ps.getDefaultFloat("f1");
- ps.setDefault("d1", 1.0);
- ps.getDouble("d1");
- ps.getDefaultDouble("d1");
- ps.setDefault("s1", "x");
- ps.getString("s1");
- ps.getDefaultString("s1");
- assertEquals("8.1", false, ps.needsSaving());
-
- try {
- ps = new PreferenceForwarder(getUniqueString());
- assertEquals("9.1", false, ps.needsSaving());
- ps.setValue("b1", true);
- assertEquals("9.2", true, ps.needsSaving());
- ByteArrayOutputStream out = new ByteArrayOutputStream();
-
- // store makes not dirty
- ps.store(out, "test header");
- assertEquals("9.3", false, ps.needsSaving());
-
- // load comes in not dirty
- ps.setValue("b1", false);
- assertEquals("9.4", true, ps.needsSaving());
- ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
- ps.load(in);
- assertEquals("9.5", false, ps.needsSaving());
- } catch (IOException e) {
- assertTrue("9.0", false);
- }
- }
-
- /* Comment this test out until we are able to use session tests
- * with it. - ddw
- * public void testPluginPrefs() {
- IPluginRegistry registry = InternalPlatform.getPluginRegistry();
- IPluginDescriptor resPlugin = registry.getPluginDescriptor("org.eclipse.core.resources");
- Preferences perfs = null;
- try {
- perfs = resPlugin.getPlugin().getPluginPreferences();
- } catch (CoreException ce) {
- fail("0.1 core exception from getPlugin");
- }
- boolean oneBoolean = perfs.getBoolean("OneBoolean");
- double oneDouble = perfs.getDouble("OneDouble");
- float oneFloat = perfs.getFloat("OneFloat");
- int oneInt = perfs.getInt("OneInt");
- long oneLong = perfs.getLong("OneLong");
- String oneString = perfs.getString("OneString");
- assertTrue("1.0 boolean", oneBoolean);
- assertTrue("2.0 double", oneDouble == 4);
- assertTrue("3.0 float", oneFloat == 4.3f);
- assertTrue("4.0 int", oneInt == 5);
- assertTrue("5.0 long", oneLong == 6);
- assertTrue("6.0 string", oneString.equals("A string from the plugin root directory"));
- int a = 4;
- int b = 3;
- }
- */
-
- /*
- * Regression test for bug 178815.
- */
- public void testListenerOnRemove() {
- // create a new log listener that will fail if anything is written
- ILogListener logListener = new ILogListener() {
- public void logging(IStatus status, String plugin) {
- CoreException ex = new CoreException(status);
- fail("0.99", ex);
- }
- };
-
- // set a preference value to get everything initialized
- String id = getUniqueString();
- Preferences ps = new PreferenceForwarder(id);
- ps.setValue("key", "value");
-
- // add a property change listener which will cause one to be
- // added at the preference node level
- IPropertyChangeListener listener = new Preferences.IPropertyChangeListener(){
- public void propertyChange(PropertyChangeEvent event) {
- }
- };
- ps.addPropertyChangeListener(listener);
- ps.setValue("key2", "value2");
- IEclipsePreferences node = new InstanceScope().getNode(id);
-
- // add our log listener and remove the node. nothing should be logged.
- RuntimeLog.addLogListener(logListener);
- try {
- node.removeNode();
- } catch (BackingStoreException e) {
- fail("4.99", e);
- } catch (IllegalStateException e) {
- fail("5.00", e);
- } finally {
- RuntimeLog.removeLogListener(logListener);
- }
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferencesTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferencesTest.java
deleted file mode 100644
index 93f6901..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferencesTest.java
+++ /dev/null
@@ -1,780 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import java.io.*;
-import java.util.*;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.Preferences;
-
-/**
- * Test suite for API class org.eclipse.core.runtime.Preferences
- */
-public class PreferencesTest extends RuntimeTest {
-
- class Tracer implements Preferences.IPropertyChangeListener {
- public StringBuffer log = new StringBuffer();
-
- private String typeCode(Object value) {
- if (value == null) {
- return "";
- }
- if (value instanceof Boolean) {
- return "B";
- }
- if (value instanceof Integer) {
- return "I";
- }
- if (value instanceof Long) {
- return "L";
- }
- if (value instanceof Float) {
- return "F";
- }
- if (value instanceof Double) {
- return "D";
- }
- if (value instanceof String) {
- return "S";
- }
- assertTrue("0.0", false);
- return null;
- }
-
- public void propertyChange(Preferences.PropertyChangeEvent event) {
- log.append("[");
- log.append(event.getProperty());
- log.append(":");
- log.append(typeCode(event.getOldValue()));
- log.append(event.getOldValue() == null ? "null" : event.getOldValue());
- log.append("->");
- log.append(typeCode(event.getNewValue()));
- log.append(event.getNewValue() == null ? "null" : event.getNewValue());
- log.append("]");
- }
- }
-
- public PreferencesTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- // all test methods are named "test..."
- return new TestSuite(PreferencesTest.class);
- // TestSuite suite = new TestSuite();
- // suite.addTest(new PreferencesTest("testListeners2"));
- // return suite;
- }
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() {
- // do nothing
- }
-
- /*
- * @see TestCase#tearDown()
- */
- protected void tearDown() {
- // do nothing
- }
-
- public void testConstants() {
- // make sure that the preference store constants are defined properly
- assertTrue(Preferences.BOOLEAN_DEFAULT_DEFAULT == false);
- assertTrue(Preferences.INT_DEFAULT_DEFAULT == 0);
- assertTrue(Preferences.LONG_DEFAULT_DEFAULT == 0L);
- assertTrue(Preferences.FLOAT_DEFAULT_DEFAULT == 0.0f);
- assertTrue(Preferences.DOUBLE_DEFAULT_DEFAULT == 0.0);
- assertTrue(Preferences.STRING_DEFAULT_DEFAULT.equals(""));
- }
-
- public void testBasics() {
-
- Preferences ps = new Preferences();
- final String k1 = "key1";
- final String v1 = "1";
- final String v2 = "2";
- final String v3 = "3";
-
- // check that a random property in a newly created store
- // appearchs to have default-default values of whatever type asked for
- assertTrue("1.0", ps.isDefault(k1) == true);
- assertTrue("1.1", ps.getBoolean(k1) == Preferences.BOOLEAN_DEFAULT_DEFAULT);
- assertTrue("1.2", ps.getInt(k1) == Preferences.INT_DEFAULT_DEFAULT);
- assertTrue("1.3", ps.getLong(k1) == Preferences.LONG_DEFAULT_DEFAULT);
- assertTrue("1.4", ps.getFloat(k1) == Preferences.FLOAT_DEFAULT_DEFAULT);
- assertTrue("1.5", ps.getDouble(k1) == Preferences.DOUBLE_DEFAULT_DEFAULT);
- assertTrue("1.6", ps.getString(k1).equals(Preferences.STRING_DEFAULT_DEFAULT));
-
- assertTrue("1.7", ps.getDefaultBoolean(k1) == Preferences.BOOLEAN_DEFAULT_DEFAULT);
- assertTrue("1.8", ps.getDefaultInt(k1) == Preferences.INT_DEFAULT_DEFAULT);
- assertTrue("1.9", ps.getDefaultLong(k1) == Preferences.LONG_DEFAULT_DEFAULT);
- assertTrue("1.10", ps.getDefaultFloat(k1) == Preferences.FLOAT_DEFAULT_DEFAULT);
- assertTrue("1.11", ps.getDefaultDouble(k1) == Preferences.DOUBLE_DEFAULT_DEFAULT);
- assertTrue("1.12", ps.getDefaultString(k1).equals(Preferences.STRING_DEFAULT_DEFAULT));
-
- // test set/getString
- // give it a value
- ps.setValue(k1, v1);
- assertTrue("2.0", ps.isDefault(k1) == false);
- assertTrue("2.1", ps.getString(k1).equals(v1));
- assertTrue("2.2", ps.getDefaultString(k1).equals(Preferences.STRING_DEFAULT_DEFAULT));
- // change the value
- ps.setValue(k1, v2);
- assertTrue("2.3", ps.isDefault(k1) == false);
- assertTrue("2.4", ps.getString(k1).equals(v2));
- assertTrue("2.5", ps.getDefaultString(k1).equals(Preferences.STRING_DEFAULT_DEFAULT));
- // change to same value as default
- ps.setValue(k1, ps.getDefaultString(k1));
- assertTrue("2.6", ps.isDefault(k1) == true);
- assertTrue("2.7", ps.getString(k1).equals(ps.getDefaultString(k1)));
- assertTrue("2.8", ps.getDefaultString(k1).equals(Preferences.STRING_DEFAULT_DEFAULT));
- // reset to default
- ps.setValue(k1, v2);
- ps.setToDefault(k1);
- assertTrue("2.9", ps.isDefault(k1) == true);
- assertTrue("2.10", ps.getString(k1).equals(Preferences.STRING_DEFAULT_DEFAULT));
- assertTrue("2.11", ps.getDefaultString(k1).equals(Preferences.STRING_DEFAULT_DEFAULT));
- // change default
- ps.setDefault(k1, v1);
- assertTrue("2.12", ps.isDefault(k1) == true);
- assertTrue("2.13", ps.getString(k1).equals(v1));
- assertTrue("2.14", ps.getDefaultString(k1).equals(v1));
- // set the value
- ps.setValue(k1, v2);
- assertTrue("2.15", ps.isDefault(k1) == false);
- assertTrue("2.16", ps.getString(k1).equals(v2));
- assertTrue("2.17", ps.getDefaultString(k1).equals(v1));
- // change to same value as default
- ps.setValue(k1, ps.getDefaultString(k1));
- assertTrue("2.18", ps.isDefault(k1) == true);
- assertTrue("2.19", ps.getString(k1).equals(ps.getDefaultString(k1)));
- assertTrue("2.20", ps.getDefaultString(k1).equals(v1));
- // reset to default
- ps.setValue(k1, v2);
- ps.setToDefault(k1);
- assertTrue("2.21", ps.isDefault(k1) == true);
- assertTrue("2.22", ps.getString(k1).equals(v1));
- assertTrue("2.23", ps.getDefaultString(k1).equals(v1));
- // change default
- ps.setDefault(k1, v3);
- assertTrue("2.24", ps.isDefault(k1) == true);
- assertTrue("2.25", ps.getString(k1).equals(v3));
- assertTrue("2.26", ps.getDefaultString(k1).equals(v3));
-
- }
-
- public void testBoolean() {
-
- Preferences ps = new Preferences();
- final String k1 = "key1";
-
- assertEquals("1.0", false, Preferences.BOOLEAN_DEFAULT_DEFAULT);
- assertEquals("1.1", Preferences.BOOLEAN_DEFAULT_DEFAULT, ps.getBoolean(k1));
-
- ps.setValue(k1, true);
- assertEquals("1.2", true, ps.getBoolean(k1));
- ps.setValue(k1, false);
- assertEquals("1.3", false, ps.getBoolean(k1));
-
- ps.setDefault(k1, true);
- assertEquals("1.4", true, ps.getDefaultBoolean(k1));
- ps.setDefault(k1, false);
- assertEquals("1.5", false, ps.getDefaultBoolean(k1));
-
- }
-
- public void testInteger() {
-
- Preferences ps = new Preferences();
- final String k1 = "key1";
- final int[] values = {0, 1002, -201788, Integer.MAX_VALUE, Integer.MIN_VALUE};
-
- assertEquals("1.0", 0, Preferences.INT_DEFAULT_DEFAULT);
- assertEquals("1.1", Preferences.INT_DEFAULT_DEFAULT, ps.getInt(k1));
-
- for (int i = 0; i < values.length; i++) {
- int v1 = values[i];
- int v2 = v1 + 1;
- ps.setValue(k1, v1);
- assertEquals("1.2", v1, ps.getInt(k1));
- ps.setDefault(k1, v2);
- assertEquals("1.3", v2, ps.getDefaultInt(k1));
- }
- }
-
- public void testLong() {
-
- Preferences ps = new Preferences();
- final String k1 = "key1";
- final long[] values = {0L, 1002L, -201788L, Long.MAX_VALUE, Long.MIN_VALUE};
-
- assertEquals("1.0", 0L, Preferences.LONG_DEFAULT_DEFAULT);
- assertEquals("1.1", Preferences.LONG_DEFAULT_DEFAULT, ps.getLong(k1));
-
- for (int i = 0; i < values.length; i++) {
- long v1 = values[i];
- long v2 = v1 + 1;
- ps.setValue(k1, v1);
- assertEquals("1.2", v1, ps.getLong(k1));
- ps.setDefault(k1, v2);
- assertEquals("1.3", v2, ps.getDefaultLong(k1));
- }
- }
-
- public void testFloat() {
-
- Preferences ps = new Preferences();
- final String k1 = "key1";
- final float[] values = {0.0f, 1002.5f, -201788.55f, Float.MAX_VALUE, Float.MIN_VALUE};
- final float tol = 1.0e-20f;
-
- assertEquals("1.0", 0.0f, Preferences.FLOAT_DEFAULT_DEFAULT, tol);
- assertEquals("1.1", Preferences.FLOAT_DEFAULT_DEFAULT, ps.getFloat(k1), tol);
-
- for (int i = 0; i < values.length; i++) {
- float v1 = values[i];
- float v2 = v1 + 1.0f;
- ps.setValue(k1, v1);
- assertEquals("1.2", v1, ps.getFloat(k1), tol);
- ps.setDefault(k1, v2);
- assertEquals("1.3", v2, ps.getDefaultFloat(k1), tol);
- }
-
- try {
- ps.setValue(k1, Float.NaN);
- assertTrue("1.4", false);
- } catch (IllegalArgumentException e) {
- // NaNs should be rejected
- }
-
- }
-
- public void testDouble() {
-
- Preferences ps = new Preferences();
- final String k1 = "key1";
- final double[] values = {0.0, 1002.5, -201788.55, Double.MAX_VALUE, Double.MIN_VALUE};
- final double tol = 1.0e-20;
-
- assertEquals("1.0", 0.0, Preferences.DOUBLE_DEFAULT_DEFAULT, tol);
- assertEquals("1.1", Preferences.DOUBLE_DEFAULT_DEFAULT, ps.getDouble(k1), tol);
-
- for (int i = 0; i < values.length; i++) {
- double v1 = values[i];
- double v2 = v1 + 1.0;
- ps.setValue(k1, v1);
- assertEquals("1.2", v1, ps.getDouble(k1), tol);
- ps.setDefault(k1, v2);
- assertEquals("1.3", v2, ps.getDefaultDouble(k1), tol);
- }
-
- try {
- ps.setValue(k1, Float.NaN);
- assertTrue("1.4", false);
- } catch (IllegalArgumentException e) {
- // NaNs should be rejected
- }
-
- }
-
- public void testString() {
-
- Preferences ps = new Preferences();
- final String k1 = "key1";
- final String[] values = {"", "hello", " x ", "\n"};
-
- assertEquals("1.0", "", Preferences.STRING_DEFAULT_DEFAULT);
- assertEquals("1.1", ps.getString(k1), Preferences.STRING_DEFAULT_DEFAULT);
-
- for (int i = 0; i < values.length; i++) {
- String v1 = values[i];
- String v2 = v1 + "x";
- ps.setValue(k1, v1);
- assertEquals("1.2", v1, ps.getString(k1));
- ps.setDefault(k1, v2);
- assertEquals("1.3", v2, ps.getDefaultString(k1));
- }
- }
-
- public void testPropertyNames() {
-
- Preferences ps = new Preferences();
-
- // there are no properties initially
- assertEquals("1.0", 0, ps.propertyNames().length);
-
- String[] keys = {"a", "b", "c", "d"};
-
- // setting defaults does not add name to set
- for (int i = 0; i < keys.length; i++) {
- ps.setDefault(keys[i], "default");
- }
- assertEquals("1.1", 0, ps.propertyNames().length);
-
- // setting real values does add name to set
- for (int i = 0; i < keys.length; i++) {
- ps.setValue(keys[i], "actual");
- }
- assertEquals("1.2", keys.length, ps.propertyNames().length);
-
- Set s1 = new HashSet(Arrays.asList(keys));
- Set s2 = new HashSet(Arrays.asList(ps.propertyNames()));
- assertEquals("1.3", s1, s2);
-
- // setting to default does remove name from set
- for (int i = 0; i < keys.length; i++) {
- ps.setToDefault(keys[i]);
- Set s = new HashSet(Arrays.asList(ps.propertyNames()));
- assertTrue("1.4", !s.contains(keys[i]));
- }
- assertEquals("1.5", 0, ps.propertyNames().length);
- }
-
- public void testContains() {
-
- Preferences ps = new Preferences();
-
- // there are no properties initially
- assertEquals("1.0", false, ps.contains("a"));
-
- // setting defaults adds name
- ps.setDefault("a", "default");
- assertEquals("1.1", true, ps.contains("a"));
-
- // setting value adds name
- assertEquals("1.2", false, ps.contains("b"));
- ps.setValue("b", "any");
- assertEquals("1.3", true, ps.contains("b"));
-
- // setting value does not remove entry already there
- ps.setValue("a", "any");
- assertEquals("1.4", true, ps.contains("a"));
- assertEquals("1.5", true, ps.contains("b"));
-
- // setting to default removes name from set unless there is a default too
- ps.setToDefault("b");
- assertEquals("1.6", false, ps.contains("b"));
- ps.setToDefault("a");
- assertEquals("1.7", true, ps.contains("a"));
-
- // bug 51309 - if a default-default value is stored
- // as a default it is still a part of #contains
- assertTrue("2.0", !ps.contains("c"));
- ps.setDefault("c", Preferences.STRING_DEFAULT_DEFAULT);
- assertTrue("2.1", ps.contains("c"));
- }
-
- public void testDefaultPropertyNames() {
-
- Preferences ps = new Preferences();
-
- // there are no default properties initially
- assertEquals("1.0", 0, ps.defaultPropertyNames().length);
-
- String[] keys = {"a", "b", "c", "d"};
-
- // setting actual values does not add name to set
- for (int i = 0; i < keys.length; i++) {
- ps.setValue(keys[i], "actual");
- }
- assertEquals("1.1", 0, ps.defaultPropertyNames().length);
-
- // setting defaults does add name to set
- for (int i = 0; i < keys.length; i++) {
- ps.setDefault(keys[i], "default");
- }
- assertEquals("1.2", keys.length, ps.defaultPropertyNames().length);
-
- Set s1 = new HashSet(Arrays.asList(keys));
- Set s2 = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertEquals("1.3", s1, s2);
-
- // setting to default does not remove name from set
- for (int i = 0; i < keys.length; i++) {
- ps.setToDefault(keys[i]);
- Set s = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertTrue("1.4", s.contains(keys[i]));
- }
- assertEquals("1.5", keys.length, ps.defaultPropertyNames().length);
-
- // setting to default-default does not remove name from set either
- for (int i = 0; i < keys.length; i++) {
- ps.setDefault(keys[i], Preferences.STRING_DEFAULT_DEFAULT);
- Set s = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertTrue("1.6.1", s.contains(keys[i]));
-
- ps.setDefault(keys[i], Preferences.BOOLEAN_DEFAULT_DEFAULT);
- s = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertTrue("1.6.2", s.contains(keys[i]));
-
- ps.setDefault(keys[i], Preferences.INT_DEFAULT_DEFAULT);
- s = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertTrue("1.6.3", s.contains(keys[i]));
-
- ps.setDefault(keys[i], Preferences.LONG_DEFAULT_DEFAULT);
- s = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertTrue("1.6.4", s.contains(keys[i]));
-
- ps.setDefault(keys[i], Preferences.FLOAT_DEFAULT_DEFAULT);
- s = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertTrue("1.6.5", s.contains(keys[i]));
-
- ps.setDefault(keys[i], Preferences.DOUBLE_DEFAULT_DEFAULT);
- s = new HashSet(Arrays.asList(ps.defaultPropertyNames()));
- assertTrue("1.6.6", s.contains(keys[i]));
- }
- assertEquals("1.7", keys.length, ps.defaultPropertyNames().length);
- }
-
- public void testListeners2() {
-
- final Preferences ps = new Preferences();
- final Tracer tracer = new Tracer();
- String key = "a";
-
- ps.addPropertyChangeListener(tracer);
-
- // go from a default value to a real value
- ps.setDefault(key, 1);
- ps.setValue(key, 2);
- assertEquals("1.0", "[a:I1->I2]", tracer.log.toString());
-
- // real value to another real value
- tracer.log.setLength(0);
- ps.setValue(key, 3);
- assertEquals("1.1", "[a:I2->I3]", tracer.log.toString());
-
- // back to the default
- tracer.log.setLength(0);
- ps.setToDefault(key);
- // TODO strings are reported because we don't know the type
- assertEquals("1.2", "[a:S3->S1]", tracer.log.toString());
-
- // remove the default and then add a real value
- tracer.log.setLength(0);
- ps.setDefault(key, 0);
- ps.setValue(key, 2);
- assertEquals("1.3", "[a:I0->I2]", tracer.log.toString());
-
- // then remove the value
- tracer.log.setLength(0);
- ps.setValue(key, ps.getDefaultInt(key));
- assertEquals("1.4", "[a:I2->I0]", tracer.log.toString());
- }
-
- public void testListeners() {
-
- final Preferences ps = new Preferences();
-
- final Tracer tracer1 = new Tracer();
- final Tracer tracer2 = new Tracer();
-
- // register one listener
- ps.addPropertyChangeListener(tracer1);
- assertEquals("1.0", "", tracer1.log.toString());
-
- // make sure it is notified in a type appropriate manner
- ps.setValue("a", "1");
- assertEquals("1.0.1", "[a:S->S1]", tracer1.log.toString());
-
- ps.setToDefault("a");
- tracer1.log.setLength(0);
- ps.setValue("a", true);
- assertEquals("1.0.2", "[a:Bfalse->Btrue]", tracer1.log.toString());
-
- ps.setToDefault("a");
- tracer1.log.setLength(0);
- ps.setValue("a", 100);
- assertEquals("1.0.3", "[a:I0->I100]", tracer1.log.toString());
-
- ps.setToDefault("a");
- tracer1.log.setLength(0);
- ps.setValue("a", 100L);
- assertEquals("1.0.4", "[a:L0->L100]", tracer1.log.toString());
-
- ps.setToDefault("a");
- tracer1.log.setLength(0);
- ps.setValue("a", 2.0f);
- assertEquals("1.0.5", "[a:F0.0->F2.0]", tracer1.log.toString());
-
- ps.setToDefault("a");
- tracer1.log.setLength(0);
- ps.setValue("a", 2.0);
- assertEquals("1.0.6", "[a:D0.0->D2.0]", tracer1.log.toString());
-
- // make sure it is notified of a series of events
- ps.setToDefault("a");
- tracer1.log.setLength(0);
- ps.setValue("a", "1");
- assertEquals("1.1", "[a:S->S1]", tracer1.log.toString());
-
- ps.setValue("a", "2");
- assertEquals("1.2", "[a:S->S1][a:S1->S2]", tracer1.log.toString());
-
- ps.setValue("a", ps.getDefaultString("a"));
- assertEquals("1.2.1", "[a:S->S1][a:S1->S2][a:S2->S]", tracer1.log.toString());
-
- ps.setValue("a", "3");
- assertEquals("1.2.2", "[a:S->S1][a:S1->S2][a:S2->S][a:S->S3]", tracer1.log.toString());
-
- ps.setToDefault("a");
- assertEquals("1.2.3", "[a:S->S1][a:S1->S2][a:S2->S][a:S->S3][a:S3->null]", tracer1.log.toString());
-
- // change to same value - no one notified
- ps.setValue("a", "2");
- tracer1.log.setLength(0);
- assertEquals("1.3", "", tracer1.log.toString());
-
- // register second listener
- ps.addPropertyChangeListener(tracer2);
-
- // make sure both are notified
- ps.setValue("a", "3");
- assertEquals("1.4", "[a:S2->S3]", tracer1.log.toString());
- assertEquals("1.5", "[a:S2->S3]", tracer2.log.toString());
-
- // deregister is honored
- ps.removePropertyChangeListener(tracer2);
- tracer1.log.setLength(0);
- tracer2.log.setLength(0);
- ps.setValue("a", "1");
- assertEquals("1.6", "[a:S3->S1]", tracer1.log.toString());
- assertEquals("1.7", "", tracer2.log.toString());
-
- // duplicate deregister is ignored
- ps.removePropertyChangeListener(tracer2);
- tracer1.log.setLength(0);
- tracer2.log.setLength(0);
- ps.setValue("a", "2");
- assertEquals("1.8", "[a:S1->S2]", tracer1.log.toString());
- assertEquals("1.9", "", tracer2.log.toString());
-
- // duplicate register is ignored
- ps.addPropertyChangeListener(tracer1);
- tracer1.log.setLength(0);
- ps.setValue("a", "1");
- assertEquals("1.10", "[a:S2->S1]", tracer1.log.toString());
-
- // last deregister is honored
- ps.removePropertyChangeListener(tracer1);
- tracer1.log.setLength(0);
- ps.setValue("a", "4");
- assertEquals("1.11", "", tracer1.log.toString());
-
- // adds 2 and removes 1 during during callback!
- class Trouble implements Preferences.IPropertyChangeListener {
- public void propertyChange(Preferences.PropertyChangeEvent event) {
- ps.removePropertyChangeListener(tracer1);
- ps.addPropertyChangeListener(tracer2);
- }
- }
-
- ps.setValue("a", "0");
- ps.addPropertyChangeListener(tracer1);
- ps.addPropertyChangeListener(new Trouble());
- tracer1.log.setLength(0);
- tracer2.log.setLength(0);
- ps.setValue("a", "1");
- ps.setValue("a", "2");
- assertEquals("1.12", "[a:S0->S1]", tracer1.log.toString());
- assertEquals("1.13", "[a:S1->S2]", tracer2.log.toString());
-
- }
-
- public void testLoadStore() {
-
- final Preferences ps = new Preferences();
-
- ps.setValue("b1", true);
- ps.setValue("i1", 1);
- ps.setValue("l1", 2L);
- ps.setValue("f1", 1.0f);
- ps.setValue("d1", 1.0);
- ps.setValue("s1", "x");
- String[] keys = {"b1", "i1", "l1", "f1", "d1", "s1",};
-
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- try {
- ps.store(out, "test header");
- } catch (IOException e) {
- assertTrue("0.1", false);
- }
-
- ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
-
- final Preferences ps2 = new Preferences();
- try {
- ps2.load(in);
- } catch (IOException e) {
- assertTrue("0.2", false);
- }
-
- assertEquals("1.1", true, ps2.getBoolean("b1"));
- assertEquals("1.2", 1, ps2.getInt("i1"));
- assertEquals("1.3", 2L, ps2.getLong("l1"));
- assertEquals("1.4", 1.0f, ps2.getFloat("f1"), 1e-20f);
- assertEquals("1.5", 1.0, ps2.getDouble("d1"), 1e-20);
- assertEquals("1.6", "x", ps2.getString("s1"));
-
- Set s1 = new HashSet(Arrays.asList(keys));
- Set s2 = new HashSet(Arrays.asList(ps2.propertyNames()));
- assertEquals("1.7", s1, s2);
-
- // load discards current values
- in = new ByteArrayInputStream(out.toByteArray());
- final Preferences ps3 = new Preferences();
- ps3.setValue("s1", "y");
- try {
- ps3.load(in);
- assertEquals("1.8", "x", ps3.getString("s1"));
- Set k1 = new HashSet(Arrays.asList(keys));
- Set k2 = new HashSet(Arrays.asList(ps3.propertyNames()));
- assertEquals("1.9", k1, k2);
- } catch (IOException e) {
- assertTrue("1.10", false);
- }
-
- }
-
- public void testNeedsSaving() {
-
- Preferences ps = new Preferences();
-
- // setValue dirties
- ps = new Preferences();
- assertEquals("1.0", false, ps.needsSaving());
- ps.setValue("b1", true);
- assertEquals("1.1", true, ps.needsSaving());
-
- ps = new Preferences();
- assertEquals("2.0", false, ps.needsSaving());
- ps.setValue("i1", 1);
- assertEquals("2.1", true, ps.needsSaving());
-
- ps = new Preferences();
- assertEquals("3.0", false, ps.needsSaving());
- ps.setValue("l1", 2L);
- assertEquals("3.1", true, ps.needsSaving());
-
- ps = new Preferences();
- assertEquals("4.0", false, ps.needsSaving());
- ps.setValue("f1", 1.0f);
- assertEquals("4.1", true, ps.needsSaving());
-
- ps = new Preferences();
- assertEquals("5.0", false, ps.needsSaving());
- ps.setValue("d1", 1.0);
- assertEquals("5.1", true, ps.needsSaving());
-
- ps = new Preferences();
- assertEquals("6.0", false, ps.needsSaving());
- ps.setValue("s1", "x");
- assertEquals("6.1", true, ps.needsSaving());
-
- // setToDefault does not dirty if value not set
- ps = new Preferences();
- assertEquals("7.0", false, ps.needsSaving());
- ps.setToDefault("any");
- assertEquals("7.1", false, ps.needsSaving());
-
- // setToDefault dirties if value was set
- try {
- ps = new Preferences();
- assertEquals("7.2", false, ps.needsSaving());
- ps.setValue("any", "x");
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- ps.store(out, "test header");
- ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
- ps.load(in);
- assertEquals("7.3", false, ps.needsSaving());
- ps.setToDefault("any");
- assertEquals("7.4", true, ps.needsSaving());
- } catch (IOException e) {
- assertTrue("7.5", false);
- }
-
- // setDefault, getT, getDefaultT do not dirty
- ps = new Preferences();
- assertEquals("8.0", false, ps.needsSaving());
- ps.setDefault("b1", true);
- ps.getBoolean("b1");
- ps.getDefaultBoolean("b1");
- ps.setDefault("i1", 1);
- ps.getInt("i1");
- ps.getDefaultInt("i1");
- ps.setDefault("l1", 1L);
- ps.getLong("l1");
- ps.getDefaultLong("l1");
- ps.setDefault("f1", 1.0f);
- ps.getFloat("f1");
- ps.getDefaultFloat("f1");
- ps.setDefault("d1", 1.0);
- ps.getDouble("d1");
- ps.getDefaultDouble("d1");
- ps.setDefault("s1", "x");
- ps.getString("s1");
- ps.getDefaultString("s1");
- assertEquals("8.1", false, ps.needsSaving());
-
- try {
- ps = new Preferences();
- assertEquals("9.1", false, ps.needsSaving());
- ps.setValue("b1", true);
- assertEquals("9.2", true, ps.needsSaving());
- ByteArrayOutputStream out = new ByteArrayOutputStream();
-
- // store makes not dirty
- ps.store(out, "test header");
- assertEquals("9.3", false, ps.needsSaving());
-
- // load comes in not dirty
- ps.setValue("b1", false);
- assertEquals("9.4", true, ps.needsSaving());
- ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
- ps.load(in);
- assertEquals("9.5", false, ps.needsSaving());
- } catch (IOException e) {
- assertTrue("9.0", false);
- }
- }
-
- /* Comment this test out until we are able to use session tests
- * with it. - ddw
- * public void testPluginPrefs() {
- IPluginRegistry registry = InternalPlatform.getPluginRegistry();
- IPluginDescriptor resPlugin = registry.getPluginDescriptor("org.eclipse.core.resources");
- Preferences perfs = null;
- try {
- perfs = resPlugin.getPlugin().getPluginPreferences();
- } catch (CoreException ce) {
- fail("0.1 core exception from getPlugin");
- }
- boolean oneBoolean = perfs.getBoolean("OneBoolean");
- double oneDouble = perfs.getDouble("OneDouble");
- float oneFloat = perfs.getFloat("OneFloat");
- int oneInt = perfs.getInt("OneInt");
- long oneLong = perfs.getLong("OneLong");
- String oneString = perfs.getString("OneString");
- assertTrue("1.0 boolean", oneBoolean);
- assertTrue("2.0 double", oneDouble == 4);
- assertTrue("3.0 float", oneFloat == 4.3f);
- assertTrue("4.0 int", oneInt == 5);
- assertTrue("5.0 long", oneLong == 6);
- assertTrue("6.0 string", oneString.equals("A string from the plugin root directory"));
- int a = 4;
- int b = 3;
- }
- */
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/ProgressMonitorWrapperTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/ProgressMonitorWrapperTest.java
deleted file mode 100644
index d2b162e..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/ProgressMonitorWrapperTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.*;
-
-/**
- * Test cases for the Path class.
- */
-public class ProgressMonitorWrapperTest extends RuntimeTest {
- /**
- * Need a zero argument constructor to satisfy the test harness.
- * This constructor should not do any real work nor should it be
- * called by user code.
- */
- public ProgressMonitorWrapperTest() {
- super(null);
- }
-
- public ProgressMonitorWrapperTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(ProgressMonitorWrapperTest.class);
- }
-
- /**
- * @deprecated to suppress deprecation warnings
- */
- public void testProgressMonitorWrapper() {
- NullProgressMonitor nullMonitor = new NullProgressMonitor();
- SubProgressMonitor wrapped = new SubProgressMonitor(nullMonitor, 10);
- ProgressMonitorWrapper wrapper = new ProgressMonitorWrapper(wrapped) {};
-
- assertSame("1.0", nullMonitor, wrapped.getWrappedProgressMonitor());
- assertSame("1.1", wrapped, wrapper.getWrappedProgressMonitor());
-
- assertTrue("1.2", !nullMonitor.isCanceled());
- assertTrue("1.3", !wrapped.isCanceled());
- assertTrue("1.4", !wrapper.isCanceled());
-
- nullMonitor.setCanceled(true);
- assertTrue("1.5", nullMonitor.isCanceled());
- assertTrue("1.6", wrapped.isCanceled());
- assertTrue("1.7", wrapper.isCanceled());
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/QualifiedNameTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/QualifiedNameTest.java
deleted file mode 100644
index cf26506..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/QualifiedNameTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.QualifiedName;
-
-/**
- * Test cases for the QualifiedName class.
- */
-
-public class QualifiedNameTest extends RuntimeTest {
-
- /**
- * Need a zero argument constructor to satisfy the test harness.
- * This constructor should not do any real work nor should it be
- * called by user code.
- */
- public QualifiedNameTest() {
- super(null);
- }
-
- /**
- * Constructor for QualifiedNameTest
- */
- public QualifiedNameTest(String name) {
- super(name);
- }
-
- public static Test suite() {
-
- TestSuite suite = new TestSuite(QualifiedNameTest.class.getName());
- suite.addTest(new QualifiedNameTest("testQualifiers"));
- suite.addTest(new QualifiedNameTest("testLocalNames"));
- suite.addTest(new QualifiedNameTest("testEqualsAndHashcode"));
- return suite;
- }
-
- public void testQualifiers() {
-
- try {
- new QualifiedName("foo", "bar");
- } catch (Exception e) {
- fail("1.0");
- }
-
- try {
- new QualifiedName(null, "bar");
- } catch (Exception e) {
- fail("1.1");
- }
-
- try {
- new QualifiedName(" ", "bar");
- } catch (Exception e) {
- fail("1.2");
- }
-
- try {
- new QualifiedName("", "bar");
- } catch (Exception e) {
- fail("1.3");
- }
-
- }
-
- public void testLocalNames() {
-
- try {
- new QualifiedName("foo", null);
- fail("2.0");
- } catch (Exception e) {
- // expected
- }
-
- try {
- new QualifiedName("foo", "");
- fail("2.1");
- } catch (Exception e) {
- // expected
- }
-
- try {
- new QualifiedName("foo", " ");
- } catch (Exception e) {
- fail("2.2");
- }
-
- try {
- new QualifiedName("foo", " port ");
- } catch (Exception e) {
- fail("2.3");
- }
-
- }
-
- public void testEqualsAndHashcode() {
-
- QualifiedName qN1 = new QualifiedName("org.eclipse.runtime", "myClass");
- QualifiedName qN2 = new QualifiedName("org.eclipse.runtime", "myClass");
- assertTrue("1.0", qN1.equals(qN2));
- assertTrue("1.1", qN2.equals(qN1));
- assertEquals("1.2", qN1.hashCode(), qN2.hashCode());
-
- assertTrue("2.0", !qN1.equals(new String("org.eclipse.runtime.myClass")));
-
- QualifiedName qN3 = new QualifiedName(null, "myClass");
- assertTrue("3.0", !qN1.equals(qN3));
-
- QualifiedName qN4 = new QualifiedName("org.eclipse.runtime", " myClass");
- assertTrue("3.1", !qN1.equals(qN4));
-
- QualifiedName qN5 = new QualifiedName("org.eclipse.runtime", "myClass ");
- assertTrue("3.2", !qN1.equals(qN5));
-
- QualifiedName qN6 = new QualifiedName(null, "myClass");
- QualifiedName qN7 = new QualifiedName(null, "myClass");
- assertTrue("4.0", qN6.equals(qN7));
- assertTrue("4.1", qN7.equals(qN6));
- assertEquals("4.2", qN7.hashCode(), qN6.hashCode());
-
- QualifiedName qN8 = new QualifiedName(" ", "myClass");
- assertTrue("5.0", !qN8.equals(qN7));
- QualifiedName qN9 = new QualifiedName("", "myClass");
- assertTrue("5.1", !qN8.equals(qN9));
-
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/RuntimeTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/RuntimeTest.java
deleted file mode 100644
index 722c0a9..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/RuntimeTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import org.eclipse.core.tests.harness.CoreTest;
-import org.osgi.framework.BundleContext;
-
-/**
- * Common superclass for all runtime tests.
- */
-public abstract class RuntimeTest extends CoreTest {
- public static final String PI_RUNTIME_TESTS = RuntimeTestsPlugin.PI_RUNTIME_TESTS;
-
- /**
- * Constructor required by test framework.
- */
- public RuntimeTest(String name) {
- super(name);
- }
-
- /**
- * Constructor required by test framework.
- */
- public RuntimeTest() {
- super();
- }
-
- public BundleContext getContext() {
- return RuntimeTestsPlugin.getContext();
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/RuntimeTestsPlugin.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/RuntimeTestsPlugin.java
deleted file mode 100644
index 158a14e..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/RuntimeTestsPlugin.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-public class RuntimeTestsPlugin extends Plugin {
-
- public static final String PI_RUNTIME_TESTS = "org.eclipse.core.tests.runtime"; //$NON-NLS-1$
-
- private static RuntimeTestsPlugin plugin;
- private BundleContext context;
-
- public static final String TEST_FILES_ROOT = "Plugin_Testing/";
-
- public RuntimeTestsPlugin() {
- plugin = this;
- }
-
- public void start(BundleContext context) throws Exception {
- super.start(context);
- this.context = context;
- }
-
- public void stop(BundleContext context) throws Exception {
- context = null;
- }
-
- public static BundleContext getContext() {
- return plugin != null ? plugin.context : null;
- }
-
- public static Plugin getPlugin() {
- return plugin;
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/StatusTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/StatusTest.java
deleted file mode 100644
index ba89c28..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/StatusTest.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import java.util.Arrays;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.*;
-
-public class StatusTest extends RuntimeTest {
-
- private int status1Severity = IStatus.OK;
- private String status1PluginId = "org.eclipse.core.tests.runtime";
- private int status1Code = -20;
- private String status1Message = "Something was canceled";
- private Exception status1Exception = new OperationCanceledException();
- private Status status1;
-
- private int status2Severity = IStatus.ERROR;
- private String status2PluginId = " ";
- private int status2Code = IStatus.OK;
- private String status2Message = "";
- private Exception status2Exception = null;
- private Status status2;
-
- private String multistatus1PluginId = "org.eclipse.core.tests.multistatus1";
- private int multistatus1Code = 20;
- private IStatus[] multistatus1Children = new IStatus[0];
- private String multistatus1Message = "Multistatus #1 message";
- private Throwable multistatus1Exception = new OperationCanceledException();
- private MultiStatus multistatus1;
-
- private MultiStatus multistatus2;
-
- public StatusTest() {
- super(null);
- }
-
- public StatusTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(StatusTest.class.getName());
- suite.addTest(new StatusTest("testSingleStatusReturnValues"));
- suite.addTest(new StatusTest("testMultiStatusReturnValues"));
- suite.addTest(new StatusTest("testAdd"));
- suite.addTest(new StatusTest("testAddAll"));
- suite.addTest(new StatusTest("testIsOK"));
- suite.addTest(new StatusTest("testMerge"));
- return suite;
- }
-
- protected void setUp() {
- status1 = new Status(status1Severity, status1PluginId, status1Code, status1Message, status1Exception);
- status2 = new Status(status2Severity, status2PluginId, status2Code, status2Message, status2Exception);
-
- multistatus1 = new MultiStatus(multistatus1PluginId, multistatus1Code, multistatus1Children, multistatus1Message, multistatus1Exception);
- multistatus2 = new MultiStatus(" ", 45, new Status[0], "", null);
- multistatus2.add(status1);
- multistatus2.add(status1);
- }
-
- public void testMultiStatusReturnValues() {
- assertEquals("1.1", multistatus1PluginId, multistatus1.getPlugin());
- assertEquals("1.2", multistatus1Code, multistatus1.getCode());
- assertTrue("1.3", Arrays.equals(multistatus1Children, multistatus1.getChildren()));
- assertEquals("1.4", multistatus1Message, multistatus1.getMessage());
- assertEquals("1.5", multistatus1Exception, multistatus1.getException());
- assertTrue("1.6", multistatus1.isMultiStatus());
- assertEquals("1.7", IStatus.OK, multistatus1.getSeverity());
- assertTrue("1.8", multistatus1.isOK());
- assertEquals("1.9", false, status1.matches(IStatus.ERROR | IStatus.WARNING | IStatus.INFO));
- }
-
- public void testSingleStatusReturnValues() {
- assertEquals("1.0", status1Severity, status1.getSeverity());
- assertEquals("1.1", status1PluginId, status1.getPlugin());
- assertEquals("1.2", status1Code, status1.getCode());
- assertEquals("1.3", status1Message, status1.getMessage());
- assertEquals("1.4", status1Exception, status1.getException());
- assertEquals("1.5", 0, status1.getChildren().length);
- assertEquals("1.6", false, status1.isMultiStatus());
- assertEquals("1.7", status1Severity == IStatus.OK, status1.isOK());
- assertEquals("1.8", status1.matches(IStatus.ERROR | IStatus.WARNING | IStatus.INFO), !status1.isOK());
-
- assertEquals("2.0", status2Severity, status2.getSeverity());
- assertEquals("2.1", status2PluginId, status2.getPlugin());
- assertEquals("2.2", status2Code, status2.getCode());
- assertEquals("2.3", status2Message, status2.getMessage());
- assertEquals("2.4", status2Exception, status2.getException());
- assertEquals("2.5", 0, status2.getChildren().length);
- assertEquals("2.6", false, status2.isMultiStatus());
- assertEquals("2.7", status2Severity == IStatus.OK, status2.isOK());
- assertEquals("2.8", status2.matches(IStatus.ERROR), !status2.isOK());
- }
-
- public void testAdd() {
-
- multistatus1.add(status1);
- assertEquals("1.0", status1, (multistatus1.getChildren())[0]);
-
- multistatus1.add(multistatus2);
- assertEquals("1.1", multistatus2, (multistatus1.getChildren())[1]);
-
- multistatus1.add(multistatus1);
- assertEquals("1.2", multistatus1, (multistatus1.getChildren())[2]);
-
- }
-
- public void testAddAll() {
-
- multistatus1.add(status2);
- multistatus1.addAll(multistatus2);
- Status[] array = new Status[3];
- array[0] = status2;
- array[1] = status1;
- array[2] = status1;
-
- assertTrue("1.0", multistatus1.getChildren().length == 3);
- assertTrue("1.1", Arrays.equals(array, multistatus1.getChildren()));
-
- multistatus1.add(multistatus2);
- multistatus1.addAll(multistatus1);
- Status[] array2 = new Status[8];
- array2[0] = status2;
- array2[1] = status1;
- array2[2] = status1;
- array2[3] = multistatus2;
- array2[4] = status2;
- array2[5] = status1;
- array2[6] = status1;
- array2[7] = multistatus2;
-
- assertTrue("2.0", multistatus1.getChildren().length == 8);
- assertTrue("2.1", Arrays.equals(array2, multistatus1.getChildren()));
-
- }
-
- public void testIsOK() {
-
- assertTrue("1.0", multistatus2.isOK());
-
- multistatus1.add(status2);
- multistatus1.addAll(multistatus2);
- assertTrue("1.1", !multistatus1.isOK());
-
- }
-
- public void testMerge() {
-
- multistatus1.merge(status2);
- multistatus1.merge(multistatus2);
- Status[] array = new Status[3];
- array[0] = status2;
- array[1] = status1;
- array[2] = status1;
-
- assertTrue("1.0", multistatus1.getChildren().length == 3);
- assertTrue("1.1", Arrays.equals(array, multistatus1.getChildren()));
-
- multistatus1.merge(multistatus1);
- Status[] array2 = new Status[6];
- array2[0] = status2;
- array2[1] = status1;
- array2[2] = status1;
- array2[3] = status2;
- array2[4] = status1;
- array2[5] = status1;
-
- assertTrue("2.0", multistatus1.getChildren().length == 6);
- assertTrue("2.1", Arrays.equals(array2, multistatus1.getChildren()));
-
- multistatus2.add(multistatus1);
- assertTrue("3.0", !multistatus2.isOK());
- multistatus2.merge(multistatus2.getChildren()[2]);
- assertTrue("3.1", multistatus2.getChildren().length == 9);
-
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorSmallTicksTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorSmallTicksTest.java
deleted file mode 100644
index ff607f2..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorSmallTicksTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import junit.framework.TestCase;
-import org.eclipse.core.runtime.SubMonitor;
-
-/**
- * Ensures that creating a SubMonitor with a small number of
- * ticks will not prevent it from reporting accurate progress.
- */
-public class SubMonitorSmallTicksTest extends TestCase {
-
- private TestProgressMonitor topmostMonitor;
- private SubMonitor smallTicksChild;
- private long startTime;
-
- private static int TOTAL_WORK = 1000;
-
- protected void setUp() throws Exception {
- topmostMonitor = new TestProgressMonitor();
- smallTicksChild = SubMonitor.convert(topmostMonitor, 10);
- super.setUp();
- startTime = System.currentTimeMillis();
- }
-
- public void testWorked() {
- SubMonitor bigTicksChild = smallTicksChild.newChild(10).setWorkRemaining(TOTAL_WORK);
- for (int i = 0; i < TOTAL_WORK; i++) {
- bigTicksChild.worked(1);
- }
- bigTicksChild.done();
- }
-
- public void testInternalWorked() {
- double delta = 10.0d / TOTAL_WORK;
-
- for (int i = 0; i < TOTAL_WORK; i++) {
- smallTicksChild.internalWorked(delta);
- }
- }
-
- protected void tearDown() throws Exception {
- smallTicksChild.done();
- topmostMonitor.done();
- long endTime = System.currentTimeMillis();
- SubMonitorTest.reportPerformance(getClass().getName(), getName(), startTime, endTime);
- topmostMonitor.assertOptimal();
- super.tearDown();
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorTest.java
deleted file mode 100644
index da414c4..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorTest.java
+++ /dev/null
@@ -1,816 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Stefan Xenos - initial API and implementation
- * Stefan Xenos - bug 174539 - add a 1-argument convert(...) method
- * Stefan Xenos - bug 174040 - SubMonitor#convert doesn't always set task name
- * Stefan Xenos - bug 206942 - Regression test for infinite progress reporting rate
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import java.util.*;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubMonitor;
-
-/**
- *
- */
-public class SubMonitorTest extends TestCase {
-
- private long startTime;
- /**
- * <p>Number of calls to worked() within each test. This was chosen to be significantly larger
- * than 1000 to test how well the monitor can optimize unnecessary resolution
- * in reported progress, but small enough that the test completes in a reasonable
- * amount of time.</p>
- *
- * <p>Note: changing this constant will invalidate comparisons with old performance data.</p>
- */
- public static final int PROGRESS_SIZE = SubProgressTest.PROGRESS_SIZE;
- /**
- * <p>Depth of the chain chain of progress monitors. In all of the tests, we create
- * a nested chain of progress monitors rathar than a single monitor, to test its
- * scalability under recursion. We pick a number representing a moderately deep
- * recursion, but is still small enough that it could correspond to a real call stack
- * without causing overflow.</p>
- *
- * <p>Note: changing this constant will invalidate comparisons with old performance data.</p>
- */
- public static final int CHAIN_DEPTH = SubProgressTest.CHAIN_DEPTH;
-
- public SubMonitorTest() {
- super();
- }
-
- public SubMonitorTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- startTime = System.currentTimeMillis();
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- long endTime = System.currentTimeMillis();
- reportPerformance(getClass().getName(), getName(), startTime, endTime);
- super.tearDown();
- }
-
- /**
- * Reports progress by iterating over a loop of the given size, reporting 1 progress
- * at each iteration. Simulates the progress of worked(int) in loops.
- *
- * @param monitor progress monitor (callers are responsible for calling done() if necessary)
- * @param loopSize size of the loop
- */
- private static void reportWorkInLoop(IProgressMonitor monitor, int loopSize) {
- monitor.beginTask("", loopSize);
- for (int i = 0; i < loopSize; i++) {
- monitor.worked(1);
- }
- }
-
- /**
- * Reports progress by iterating over a loop of the given size, reporting 1 progress
- * at each iteration. Simulates the progress of internalWorked(double) in loops.
- *
- * @param monitor progress monitor (callers are responsible for calling done() if necessary)
- * @param loopSize size of the loop
- */
- private static void reportFloatingPointWorkInLoop(IProgressMonitor monitor, int loopSize) {
- monitor.beginTask("", loopSize);
- for (int i = 0; i < loopSize; i++) {
- monitor.internalWorked(1.0d);
- }
- }
-
- /**
- * Runs an "infinite progress" loop. Each iteration will consume 1/ratio
- * of the remaining work, and will run for the given number of iterations.
- * Retuns the number of ticks reported (out of 1000).
- *
- * @param ratio
- * @return the number of ticks reported
- */
- private double runInfiniteProgress(int ratio, int iterations) {
- TestProgressMonitor monitor = new TestProgressMonitor();
- SubMonitor mon = SubMonitor.convert(monitor);
-
- for (int i = 0; i < iterations; i++) {
- mon.setWorkRemaining(ratio);
- mon.worked(1);
- }
-
- return monitor.getTotalWork();
- }
-
- public void testInfiniteProgress() {
- // In theory when reporting "infinite" progress, the actual progress reported after
- // n iterations should be f(n) = T(1-(1-R)^n)
- //
- // where T is the total ticks allocated on the root (T=1000) and R is the ratio
- // (R=1/the_argument_to_setWorkRemaining).
-
- // Reporting 1% per iteration, we should be at 993.4 ticks after 500 iterations
- double test1 = runInfiniteProgress(100, 500);
- assertEquals(993.4, test1, 1.0);
-
- // Reporting 0.1% per iteration, we should be at 950.2 ticks after 3000 iterations
- double test2 = runInfiniteProgress(1000, 3000);
- assertEquals(950.2, test2, 1.0);
-
- // Reporting 0.01% per iteration, we should be at 393.5 ticks after 5000 iterations
- double test3 = runInfiniteProgress(10000, 5000);
- assertEquals(393.5, test3, 1.0);
-
- // Reporting 0.01% per iteration, we should be at 864.7 ticks after 20000 iterations
- double test4 = runInfiniteProgress(10000, 20000);
- assertEquals(864.7, test4, 1.0);
-
- // Reporting 0.01% per iteration, we should be at 9.9 ticks after 100 iterations
- double test5 = runInfiniteProgress(10000, 100);
- assertEquals(9.9, test5, 1.0);
- }
-
- /**
- * Ensures that we don't lose any progress when calling setWorkRemaining
- */
- public void testSetWorkRemaining() {
- TestProgressMonitor monitor = new TestProgressMonitor();
- SubMonitor mon = SubMonitor.convert(monitor, 0);
-
- for (int i = 1000; i >= 0; i--) {
- mon.setWorkRemaining(i);
- mon.internalWorked(0.5);
-
- mon.setWorkRemaining(i);
- mon.internalWorked(0.5);
-
- mon.internalWorked(-0.5); // should not affect progress
- }
-
- monitor.done();
- monitor.assertOptimal();
- }
-
- /**
- * Tests that SubMonitor.done() will clean up after an unconsumed child
- * that was created with the explicit constructor
- */
- public void testCleanupConstructedChildren() {
- TestProgressMonitor top = new TestProgressMonitor();
-
- SubMonitor monitor = SubMonitor.convert(top, 1000);
- monitor.beginTask("", 1000);
-
- monitor.newChild(500);
- SubMonitor child2 = monitor.newChild(100);
-
- child2.done();
-
- Assert.assertEquals("Ensure that done() reports unconsumed progress, even if beginTask wasn't called", 600.0, top.getTotalWork(), 0.01d);
-
- SubMonitor child3 = monitor.newChild(100);
-
- SubMonitor child3andAHalf = monitor.newChild(-10); // should not affect progress
- child3andAHalf.done();
-
- monitor.done();
-
- Assert.assertEquals("Ensure that done() cleans up after unconsumed children that were created by their constructor", 1000.0, top.getTotalWork(), 0.01d);
-
- child3.worked(100);
-
- Assert.assertEquals("Ensure that children can't report any progress if their parent has completed", 1000.0, top.getTotalWork(), 0.01d);
- }
-
- /**
- * Tests SubMonitor under typical usage. This is the same
- * as the performance test as the same name, but it verifies correctness
- * rather than performance.
- */
- public void testTypicalUsage() {
- TestProgressMonitor monitor = new TestProgressMonitor();
- SubMonitorTest.runTestTypicalUsage(monitor);
- monitor.assertOptimal();
- }
-
- /**
- * Tests creating a tree of SubMonitors. This is the same
- * as the performance test as the same name, but it verifies correctness
- * rather than performance.
- */
- public void testCreateTree() {
- TestProgressMonitor monitor = new TestProgressMonitor();
- SubMonitorTest.runTestCreateTree(monitor);
- monitor.assertOptimal();
- }
-
- /**
- * Tests claimed problem reported in bug 2100394.
- */
- public void testBug210394() {
- TestProgressMonitor testMonitor = new TestProgressMonitor();
- SubMonitor monitor = SubMonitor.convert(testMonitor);
- monitor.beginTask("", 2);
-
- SubMonitor step1 = monitor.newChild(1);
- step1.done();
-
- assertEquals(500.0, testMonitor.getTotalWork(), 1.0);
-
- SubMonitor step2 = monitor.newChild(2);
- // Here we find out that we had really 5 additional steps to accomplish
- SubMonitor subStep2 = SubMonitor.convert(step2, 5);
- subStep2.worked(1);
- assertEquals(600.0, testMonitor.getTotalWork(), 1.0);
- subStep2.worked(1);
- assertEquals(700.0, testMonitor.getTotalWork(), 1.0);
- subStep2.worked(1);
- assertEquals(800.0, testMonitor.getTotalWork(), 1.0);
- subStep2.worked(1);
- assertEquals(900.0, testMonitor.getTotalWork(), 1.0);
- subStep2.worked(1);
- assertEquals(1000.0, testMonitor.getTotalWork(), 1.0);
- }
-
- /**
- * Ensures that SubMonitor won't report more than 100% progress
- * when a child is created with more than the amount of available progress.
- */
- public void testChildOverflow() {
- TestProgressMonitor top = new TestProgressMonitor();
-
- SubMonitor mon1 = SubMonitor.convert(top, 1000);
- Assert.assertEquals(0.0, top.getTotalWork(), 0.1d);
-
- SubMonitor child2 = mon1.newChild(700);
- child2.done();
-
- Assert.assertEquals(700.0, top.getTotalWork(), 0.1d);
-
- SubMonitor child3 = mon1.newChild(700);
- child3.done();
-
- Assert.assertEquals("The reported work should not exceed 1000", 1000.0, top.getTotalWork(), 0.1d);
-
- mon1.done();
-
- top.done();
- }
-
- /**
- * Tests the 1-argument convert(...) method
- */
- public void testConvert() {
- TestProgressMonitor top = new TestProgressMonitor();
- SubMonitor mon1 = SubMonitor.convert(top);
- Assert.assertEquals(0.0, top.getTotalWork(), 0.1d);
- mon1.worked(10);
- Assert.assertEquals(0.0, top.getTotalWork(), 0.1d);
- mon1.setWorkRemaining(100);
- mon1.worked(50);
- Assert.assertEquals(500.0, top.getTotalWork(), 0.1d);
- mon1.done();
- Assert.assertEquals(1000.0, top.getTotalWork(), 0.1d);
- top.done();
- }
-
- /**
- * Tests the function of the SUPPRESS_* flags
- */
- public void testFlags() {
- TestProgressMonitor top = new TestProgressMonitor();
-
- SubMonitor mon1 = SubMonitor.convert(top, "initial", 100);
-
- // Ensure that we've called begintask on the root with the correct argument
- Assert.assertEquals(top.getBeginTaskCalls(), 1);
- Assert.assertEquals(top.getBeginTaskName(), "initial");
-
- mon1.beginTask("beginTask", 1000);
-
- // Ensure that beginTask on the child does NOT result in more than 1 call to beginTask on the root
- Assert.assertEquals(top.getBeginTaskCalls(), 1);
-
- // Ensure that the task name was propogated correctly
- Assert.assertEquals(top.getTaskName(), "beginTask");
-
- mon1.setTaskName("setTaskName");
- Assert.assertEquals(top.getTaskName(), "setTaskName");
-
- mon1.subTask("subTask");
- Assert.assertEquals(top.getSubTaskName(), "subTask");
-
- // Create a child monitor that permits calls to beginTask
- {
- SubMonitor mon2 = mon1.newChild(10, SubMonitor.SUPPRESS_NONE);
-
- // Ensure that everything is propogated
- mon2.beginTask("mon2.beginTask", 100);
- Assert.assertEquals(top.getTaskName(), "mon2.beginTask");
-
- mon2.setTaskName("mon2.setTaskName");
- Assert.assertEquals(top.getTaskName(), "mon2.setTaskName");
-
- mon2.subTask("mon2.subTask");
- Assert.assertEquals(top.getSubTaskName(), "mon2.subTask");
- }
- }
-
- private String[] runChildTest(int depth, TestProgressMonitor root, IProgressMonitor child, int ticks) {
- ArrayList results = new ArrayList();
- child.beginTask("beginTask" + depth, ticks);
- results.add(root.getTaskName());
- child.subTask("subTask" + depth);
- results.add(root.getSubTaskName());
- child.setTaskName("setTaskName" + depth);
- results.add(root.getTaskName());
- return (String[]) results.toArray(new String[results.size()]);
- }
-
- /**
- * Tests the style bits in SubProgressMonitor
- */
- public void testStyles() {
-
- int[] styles = new int[] {SubMonitor.SUPPRESS_NONE, SubMonitor.SUPPRESS_BEGINTASK, SubMonitor.SUPPRESS_SETTASKNAME, SubMonitor.SUPPRESS_SUBTASK, SubMonitor.SUPPRESS_BEGINTASK | SubMonitor.SUPPRESS_SETTASKNAME, SubMonitor.SUPPRESS_BEGINTASK | SubMonitor.SUPPRESS_SUBTASK, SubMonitor.SUPPRESS_SETTASKNAME | SubMonitor.SUPPRESS_SUBTASK, SubMonitor.SUPPRESS_ALL_LABELS};
-
- HashMap expected = new HashMap();
- expected.put("style 5 below style 7", new String[] {"", "", ""});
- expected.put("style 7 below style 5", new String[] {"beginTask0", "", "beginTask0"});
- expected.put("style 7 below style 4", new String[] {"beginTask0", "subTask0", "beginTask0"});
- expected.put("style 5 below style 6", new String[] {"", "subTask0", ""});
- expected.put("style 3 below style 7", new String[] {"", "", ""});
- expected.put("style 5 below style 5", new String[] {"beginTask0", "", "beginTask0"});
- expected.put("style 7 below style 3", new String[] {"setTaskName0", "", "setTaskName0"});
- expected.put("style 7 below style 2", new String[] {"setTaskName0", "subTask0", "setTaskName0"});
- expected.put("style 5 below style 4", new String[] {"beginTask0", "subTask0", "beginTask0"});
- expected.put("style 3 below style 6", new String[] {"", "subTask0", ""});
- expected.put("style 1 below style 7", new String[] {"", "", ""});
- expected.put("style 3 below style 5", new String[] {"beginTask0", "", "beginTask0"});
- expected.put("style 5 below style 3", new String[] {"beginTask1", "", "beginTask1"});
- expected.put("style 7 below style 1", new String[] {"setTaskName0", "", "setTaskName0"});
- expected.put("style 3 below style 4", new String[] {"beginTask0", "subTask0", "beginTask0"});
- expected.put("style 5 below style 2", new String[] {"beginTask1", "subTask0", "beginTask1"});
- expected.put("style 7 below style 0", new String[] {"setTaskName0", "subTask0", "setTaskName0"});
- expected.put("style 1 below style 6", new String[] {"", "subTask0", ""});
- expected.put("style 1 below style 5", new String[] {"beginTask0", "", "beginTask0"});
- expected.put("style 3 below style 3", new String[] {"setTaskName0", "", "setTaskName1"});
- expected.put("style 5 below style 1", new String[] {"beginTask1", "", "beginTask1"});
- expected.put("style 1 below style 4", new String[] {"beginTask0", "subTask0", "beginTask0"});
- expected.put("style 3 below style 2", new String[] {"setTaskName0", "subTask0", "setTaskName1"});
- expected.put("style 5 below style 0", new String[] {"beginTask1", "subTask0", "beginTask1"});
- expected.put("style 1 below style 3", new String[] {"beginTask1", "", "setTaskName1"});
- expected.put("style 3 below style 1", new String[] {"setTaskName0", "", "setTaskName1"});
- expected.put("style 1 below style 2", new String[] {"beginTask1", "subTask0", "setTaskName1"});
- expected.put("style 3 below style 0", new String[] {"setTaskName0", "subTask0", "setTaskName1"});
- expected.put("style 1 below style 1", new String[] {"beginTask1", "", "setTaskName1"});
- expected.put("style 1 below style 0", new String[] {"beginTask1", "subTask0", "setTaskName1"});
- expected.put("style 3 as top-level monitor", new String[] {"", "", "setTaskName0"});
- expected.put("style 7 as top-level monitor", new String[] {"", "", ""});
- expected.put("style 2 as top-level monitor", new String[] {"", "subTask0", "setTaskName0"});
- expected.put("style 6 as top-level monitor", new String[] {"", "subTask0", ""});
- expected.put("style 6 below style 7", new String[] {"", "", ""});
- expected.put("style 6 below style 6", new String[] {"", "subTask1", ""});
- expected.put("style 4 below style 7", new String[] {"", "", ""});
- expected.put("style 6 below style 5", new String[] {"beginTask0", "", "beginTask0"});
- expected.put("style 6 below style 4", new String[] {"beginTask0", "subTask1", "beginTask0"});
- expected.put("style 4 below style 6", new String[] {"", "subTask1", ""});
- expected.put("style 2 below style 7", new String[] {"", "", ""});
- expected.put("style 4 below style 5", new String[] {"beginTask0", "", "beginTask0"});
- expected.put("style 6 below style 3", new String[] {"setTaskName0", "", "setTaskName0"});
- expected.put("style 4 below style 4", new String[] {"beginTask0", "subTask1", "beginTask0"});
- expected.put("style 6 below style 2", new String[] {"setTaskName0", "subTask1", "setTaskName0"});
- expected.put("style 2 below style 6", new String[] {"", "subTask1", ""});
- expected.put("style 0 below style 7", new String[] {"", "", ""});
- expected.put("style 2 below style 5", new String[] {"beginTask0", "", "beginTask0"});
- expected.put("style 6 below style 1", new String[] {"setTaskName0", "", "setTaskName0"});
- expected.put("style 4 below style 3", new String[] {"beginTask1", "", "beginTask1"});
- expected.put("style 2 below style 4", new String[] {"beginTask0", "subTask1", "beginTask0"});
- expected.put("style 6 below style 0", new String[] {"setTaskName0", "subTask1", "setTaskName0"});
- expected.put("style 4 below style 2", new String[] {"beginTask1", "subTask1", "beginTask1"});
- expected.put("style 0 below style 6", new String[] {"", "subTask1", ""});
- expected.put("style 0 below style 5", new String[] {"beginTask0", "", "beginTask0"});
- expected.put("style 4 below style 1", new String[] {"beginTask1", "", "beginTask1"});
- expected.put("style 2 below style 3", new String[] {"setTaskName0", "", "setTaskName1"});
- expected.put("style 0 below style 4", new String[] {"beginTask0", "subTask1", "beginTask0"});
- expected.put("style 4 below style 0", new String[] {"beginTask1", "subTask1", "beginTask1"});
- expected.put("style 2 below style 2", new String[] {"setTaskName0", "subTask1", "setTaskName1"});
- expected.put("style 1 as top-level monitor", new String[] {"beginTask0", "", "setTaskName0"});
- expected.put("style 2 below style 1", new String[] {"setTaskName0", "", "setTaskName1"});
- expected.put("style 0 below style 3", new String[] {"beginTask1", "", "setTaskName1"});
- expected.put("style 2 below style 0", new String[] {"setTaskName0", "subTask1", "setTaskName1"});
- expected.put("style 0 below style 2", new String[] {"beginTask1", "subTask1", "setTaskName1"});
- expected.put("style 0 below style 1", new String[] {"beginTask1", "", "setTaskName1"});
- expected.put("style 0 below style 0", new String[] {"beginTask1", "subTask1", "setTaskName1"});
- expected.put("style 5 as top-level monitor", new String[] {"beginTask0", "", "beginTask0"});
- expected.put("style 0 as top-level monitor", new String[] {"beginTask0", "subTask0", "setTaskName0"});
- expected.put("style 4 as top-level monitor", new String[] {"beginTask0", "subTask0", "beginTask0"});
- expected.put("style 7 below style 7", new String[] {"", "", ""});
- expected.put("style 7 below style 6", new String[] {"", "subTask0", ""});
- HashMap results = new HashMap();
-
- for (int i = 0; i < styles.length; i++) {
- int style = styles[i];
- {
- TestProgressMonitor top = new TestProgressMonitor();
- top.beginTask("", 100);
- SubMonitor converted = SubMonitor.convert(top, 100);
-
- SubMonitor styled = converted.newChild(100, style);
- styled.setWorkRemaining(100);
-
- String testName = "style " + style + " as top-level monitor";
- results.put(testName, runChildTest(0, top, styled, 100 * styles.length));
- }
-
- for (int j = 0; j < styles.length; j++) {
- int innerStyle = styles[j];
-
- TestProgressMonitor newTop = new TestProgressMonitor();
- newTop.beginTask("", 100);
- SubMonitor newConverted = SubMonitor.convert(newTop, 100);
-
- SubMonitor innerStyled = newConverted.newChild(100, style);
-
- runChildTest(0, newTop, innerStyled, 100);
-
- SubMonitor innerChild = innerStyled.newChild(100, innerStyle);
- String testName = "style " + innerStyle + " below style " + style;
- results.put(testName, runChildTest(1, newTop, innerChild, 100));
- innerChild.done();
- }
- }
-
- String failure = null;
- // Output the code for the observed results, in case one of them has changed intentionally
- for (Iterator iter = results.entrySet().iterator(); iter.hasNext();) {
- Map.Entry next = (Map.Entry) iter.next();
- String[] expectedResult = (String[]) expected.get(next.getKey());
- if (expectedResult == null)
- expectedResult = new String[0];
-
- String[] value = (String[]) next.getValue();
- if (compareArray(value, expectedResult))
- continue;
-
- System.out.print("expected.put(\"" + next.getKey() + "\", new String[] {");
- failure = (String) next.getKey();
- String list = concatArray(value);
- System.out.println(list + "});");
- }
-
- if (failure != null) // Now actually throw an assertation if one of the results failed
- Assert.assertEquals(failure, concatArray((String[]) expected.get(failure)), concatArray((String[]) results.get(failure)));
- }
-
- private boolean compareArray(String[] value, String[] expectedResult) {
- if (value == null || expectedResult == null)
- return value == null && expectedResult == null;
-
- if (value.length != expectedResult.length)
- return false;
- for (int i = 0; i < expectedResult.length; i++) {
- String next = expectedResult[i];
- if (!next.equals(value[i]))
- return false;
- }
- return true;
- }
-
- private String concatArray(String[] value) {
- if (value == null)
- return "";
-
- StringBuffer buf = new StringBuffer();
- boolean isFirst = true;
- for (int i = 0; i < value.length; i++) {
- String nextValue = value[i];
- if (!isFirst)
- buf.append(", ");
- isFirst = false;
- buf.append("\"" + nextValue + "\"");
- }
- String list = buf.toString();
- return list;
- }
-
- /**
- * Ensures that SubMonitor doesn't propogate redundant progress to its parent.
- */
- public void testRedundantWork() {
- TestProgressMonitor top = new TestProgressMonitor();
-
- SubMonitor monitor = SubMonitor.convert(top, 10000);
- for (int i = 0; i < 10000; i++) {
- monitor.setTaskName("Task name");
- monitor.subTask("Subtask");
- monitor.worked(0);
- monitor.internalWorked(0.0);
-
- // Report some real work
- monitor.worked(1);
- }
-
- top.done();
- top.assertOptimal();
- }
-
- public void testCancellation() {
- TestProgressMonitor root = new TestProgressMonitor();
-
- SubMonitor spm = SubMonitor.convert(root, 1000);
-
- // Test that changes at the root propogate to the child
- root.setCanceled(true);
- Assert.assertTrue(spm.isCanceled());
- root.setCanceled(false);
- Assert.assertFalse(spm.isCanceled());
-
- // Test that changes to the child propogate to the root
- spm.setCanceled(true);
- Assert.assertTrue(root.isCanceled());
- spm.setCanceled(false);
- Assert.assertFalse(root.isCanceled());
-
- // Test a chain of depth 2
-
- SubMonitor spm2 = spm.newChild(1000);
-
- // Test that changes at the root propogate to the child
- root.setCanceled(true);
- Assert.assertTrue(spm2.isCanceled());
- root.setCanceled(false);
- Assert.assertFalse(spm2.isCanceled());
-
- // Test that changes to the child propogate to the root
- spm2.setCanceled(true);
- Assert.assertTrue(root.isCanceled());
- spm2.setCanceled(false);
- Assert.assertFalse(root.isCanceled());
- }
-
- public void testNullParent() {
- // Touch everything in the public API to ensure we don't throw an NPE
- SubMonitor mon = SubMonitor.convert(null, 1000);
- mon.setWorkRemaining(500);
- mon.worked(250);
- mon.newChild(200);
-
- mon.internalWorked(50.0);
- Assert.assertFalse(mon.isCanceled());
- mon.setCanceled(true);
- Assert.assertTrue(mon.isCanceled());
- mon.subTask("subtask");
- mon.setTaskName("taskname");
- mon.done();
- }
-
- /**
- * Tests the automatic cleanup when progress monitors are created via their constructor
- */
- public void testNewChild() {
- TestProgressMonitor top = new TestProgressMonitor();
- SubMonitor mon = SubMonitor.convert(top, 1000);
-
- Assert.assertEquals("Ensure no work has been reported yet", 0.0, top.getTotalWork(), 0.01d);
-
- mon.newChild(100);
-
- Assert.assertEquals("Ensure no work has been reported yet", 0.0, top.getTotalWork(), 0.01d);
-
- mon.newChild(200);
-
- Assert.assertEquals("Ensure monitor1 was collected", 100.0, top.getTotalWork(), 0.01d);
-
- // The following behavior is necessary to make it possible to pass multiple progress monitors as
- // arguments to the same method.
- Assert.assertEquals("Monitor2 should not have been collected yet (when the public constructor is used, collection should happen when beginTask() or setWorkRemaining() is called.", 100.0, top.getTotalWork(), 0.01d);
-
- SubMonitor monitor4 = mon.newChild(300);
-
- Assert.assertEquals("Now monitor2 should be collected", 300.0, top.getTotalWork(), 0.01d);
-
- monitor4.done();
-
- Assert.assertEquals("Now monitor4 should be collected", 600.0, top.getTotalWork(), 0.01d);
-
- mon.newChild(10);
-
- Assert.assertEquals("Creating a child when there are no active children should not report any work", 600.0, top.getTotalWork(), 0.01d);
-
- mon.worked(20);
-
- // Test for bug 210394
- Assert.assertEquals("Reporting work should cause the active child to be destroyed", 630.0, top.getTotalWork(), 0.01d);
-
- mon.newChild(10);
-
- Assert.assertEquals("monitor5 should have been cleaned up", 630.0, top.getTotalWork(), 0.01d);
-
- mon.internalWorked(60);
-
- Assert.assertEquals("Calling internalWorked should clean up active children", 700.0, top.getTotalWork(), 0.01d);
-
- // Now create a chain of undisposed children
- SubMonitor monitor7 = mon.newChild(100);
-
- SubMonitor monitor8 = monitor7.newChild(40);
-
- monitor8.newChild(10);
-
- mon.done();
-
- Assert.assertEquals("Calling done should clean up unused work", 1000.0, top.getTotalWork(), 0.01d);
- }
-
- /**
- * Tests creating progress monitors under a custom progress monitor
- * parent. This is the same as the performance test as the same name,
- * but it verifies correctness rather than performance.
- */
- public void testCreateChildrenUnderCustomParent() {
- TestProgressMonitor monitor = new TestProgressMonitor();
- createChildrenUnderParent(monitor, SubMonitorTest.PROGRESS_SIZE);
-
- // We don't actually expect the progress to be optimal in this case since the progress monitor wouldn't
- // know what it was rooted under and would have had to report more progress than necessary... but we
- // should be able to check that there was no redundancy.
-
- Assert.assertTrue(monitor.getRedundantWorkCalls() == 0);
- Assert.assertTrue(monitor.getWorkCalls() >= 100);
- }
-
- /**
- * Creates a chain of n nested progress monitors. Calls beginTask on all monitors
- * except for the innermost one.
- *
- * @param parent
- * @param depth
- * @return the innermost SubMonitor
- */
- public static SubMonitor createSubProgressChain(SubMonitor parent, int depth) {
- depth--;
- parent.beginTask("", 100);
- SubMonitor current = parent;
- while (depth > 0) {
- current.setWorkRemaining(100);
- current = current.newChild(100);
- depth--;
- }
- return current;
- }
-
- /**
- * Creates a balanced binary tree of progress monitors, without calling worked. Tests
- * progress monitor creation and cleanup time, and ensures that excess progress is
- * being collected when IProgressMonitor.done() is called.
- *
- * @param monitor progress monitor (callers are responsible for calling done() if necessary)
- * @param loopSize total size of the recursion tree
- */
- public static void createBalancedTree(IProgressMonitor parent, int loopSize) {
- SubMonitor monitor = SubMonitor.convert(parent, 100);
- int leftBranch = loopSize / 2;
- int rightBranch = loopSize - leftBranch;
-
- if (leftBranch > 1) {
- createBalancedTree(monitor.newChild(50), leftBranch);
- }
-
- if (rightBranch > 1) {
- createBalancedTree(monitor.newChild(50), rightBranch);
- }
- }
-
- /**
- * <p>The innermost loop for the create tree test. We make this a static method so
- * that it can be used both in this performance test and in the correctness test.</p>
- *
- * <p>The performance test ensures that it is fast to create a lot of progress monitors.</p>
- *
- * <p>The correctness test ensures that creating and destroying SubMonitors
- * is enough to report progress, even if worked(int) and worked(double) are never called</p>
- */
- public static void runTestCreateTree(IProgressMonitor monitor) {
- SubMonitor progress = SubMonitor.convert(monitor, 100);
- SubMonitor nestedMonitor = SubMonitorTest.createSubProgressChain(progress, SubMonitorTest.CHAIN_DEPTH);
-
- SubMonitorTest.createBalancedTree(nestedMonitor, SubMonitorTest.PROGRESS_SIZE);
-
- progress.done();
- monitor.done();
- }
-
- /**
- * Reports progress by creating a balanced binary tree of progress monitors. Simulates
- * mixed usage of IProgressMonitor in a typical usage. Calls isCanceled once each time work
- * is reported. Half of the work is reported using internalWorked and half is reported using worked,
- * to simulate mixed usage of the progress monitor.
- *
- * @param monitor progress monitor (callers are responsible for calling done() if necessary)
- * @param loopSize total size of the recursion tree
- */
- public static void reportWorkInBalancedTree(IProgressMonitor parent, int loopSize) {
- SubMonitor monitor = SubMonitor.convert(parent, 100);
- int leftBranch = loopSize / 2;
- int rightBranch = loopSize - leftBranch;
-
- if (leftBranch > 1) {
- reportWorkInBalancedTree(monitor.newChild(50), leftBranch);
- } else {
- monitor.worked(25);
- monitor.internalWorked(25.0);
- monitor.isCanceled();
- }
-
- if (rightBranch > 1) {
- reportWorkInBalancedTree(monitor.newChild(50), rightBranch);
- } else {
- monitor.worked(25);
- monitor.internalWorked(25.0);
- monitor.isCanceled();
- }
- }
-
- /**
- * The innermost loop for the recursion test. We make this a static method so
- * that it can be used both in this performance test and in the correctness test.
- */
- public static void runTestTypicalUsage(IProgressMonitor monitor) {
- SubMonitor progress = SubMonitor.convert(monitor, 100);
- SubMonitor nestedMonitor = SubMonitorTest.createSubProgressChain(progress, SubMonitorTest.CHAIN_DEPTH);
-
- SubMonitorTest.reportWorkInBalancedTree(nestedMonitor, SubMonitorTest.PROGRESS_SIZE);
-
- progress.done();
- monitor.done();
- }
-
- /**
- * Tests SubMonitor.worked. This is the same
- * as the performance test as the same name, but it verifies correctness
- * rather than performance.
- */
- public void testWorked() {
- TestProgressMonitor monitor = new TestProgressMonitor();
- SubMonitor progress = SubMonitor.convert(monitor, 100);
- SubMonitor nestedMonitor = createSubProgressChain(progress, SubProgressTest.CHAIN_DEPTH);
-
- reportWorkInLoop(nestedMonitor, SubProgressTest.PROGRESS_SIZE);
-
- progress.done();
- monitor.done();
-
- monitor.assertOptimal();
- }
-
- /**
- * Tests SubMonitor.worked. This is the same
- * as the performance test as the same name, but it verifies correctness
- * rather than performance.
- */
- public void testInternalWorked() {
- TestProgressMonitor monitor = new TestProgressMonitor();
- SubMonitor progress = SubMonitor.convert(monitor, 100);
- SubMonitor nestedMonitor = createSubProgressChain(progress, SubProgressTest.CHAIN_DEPTH);
-
- reportFloatingPointWorkInLoop(nestedMonitor, SubProgressTest.PROGRESS_SIZE);
-
- progress.done();
- monitor.done();
-
- monitor.assertOptimal();
- }
-
- /**
- * Creates and destroys the given number of child progress monitors under the given parent.
- *
- * @param monitor monitor to create children under. The caller must call done on this monitor
- * if necessary.
- * @param progressSize total number of children to create.
- */
- private static void createChildrenUnderParent(IProgressMonitor parent, int progressSize) {
- SubMonitor monitor = SubMonitor.convert(parent, progressSize);
-
- for (int count = 0; count < progressSize; count++) {
- SubMonitor mon = monitor.newChild(1);
- mon.beginTask("", 100);
- }
- }
-
- static public void reportPerformance(String className, String methodName, long startTime, long endTime) {
- if (false) // enable to see performance results for the progress monitors
- System.out.println(className + "#" + methodName + " elapsed time: " + (endTime - startTime) / 1000.0d + "s");
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubProgressSubclass.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubProgressSubclass.java
deleted file mode 100644
index 43badfc..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubProgressSubclass.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-/**
- * @deprecated to suppress deprecation warnings
- */
-public class SubProgressSubclass extends SubProgressMonitor {
-
- public int internalWorkedCalls = 0;
-
- public SubProgressSubclass(IProgressMonitor monitor, int ticks, int style) {
- super(monitor, ticks, style);
- }
-
- public SubProgressSubclass(IProgressMonitor monitor, int ticks) {
- super(monitor, ticks);
- }
-
- public void internalWorked(double work) {
- internalWorkedCalls++;
- super.internalWorked(work);
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubProgressTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubProgressTest.java
deleted file mode 100644
index f5f3ba9..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubProgressTest.java
+++ /dev/null
@@ -1,597 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import java.util.*;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-/**
- *
- */
-public class SubProgressTest extends TestCase {
-
- private long startTime;
- /**
- * <p>Depth of the chain chain of progress monitors. In all of the tests, we create
- * a nested chain of progress monitors rathar than a single monitor, to test its
- * scalability under recursion. We pick a number representing a moderately deep
- * recursion, but is still small enough that it could correspond to a real call stack
- * without causing overflow.</p>
- *
- * <p>Note: changing this constant will invalidate comparisons with old performance data.</p>
- */
- public static final int CHAIN_DEPTH = 100;
- /**
- * <p>Number of calls to worked() within each test. This was chosen to be significantly larger
- * than 1000 to test how well the monitor can optimize unnecessary resolution
- * in reported progress, but small enough that the test completes in a reasonable
- * amount of time.</p>
- *
- * <p>Note: changing this constant will invalidate comparisons with old performance data.</p>
- */
- public static final int PROGRESS_SIZE = 100000;
-
- public SubProgressTest() {
- super();
- }
-
- public SubProgressTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- startTime = System.currentTimeMillis();
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- long endTime = System.currentTimeMillis();
- SubMonitorTest.reportPerformance(getClass().getName(), getName(), startTime, endTime);
- super.tearDown();
- }
-
- /**
- * Calls done on the given progress monitor and all of its parents, to a maximum
- * of the given depth.
- *
- * @deprecated to suppress deprecation warnings
- *
- * @param monitor
- * @param depth
- */
- public static void callDoneOnChain(IProgressMonitor monitor, int depth) {
- IProgressMonitor current = monitor;
- for (int count = 0; count < depth; count++) {
- current.done();
- if (!(current instanceof SubProgressMonitor))
- return;
- SubProgressMonitor cur = (SubProgressMonitor) current;
- current = cur.getWrappedProgressMonitor();
- }
- }
-
- /**
- * Test behaviors that subclasses of SubProgressMonitor will expect from their base class.
- * @deprecated to suppress deprecation warnings
- */
- public void testCustomSubclass() {
- TestProgressMonitor top = new TestProgressMonitor();
- top.beginTask("", 1000);
-
- SubProgressSubclass customSubclass = new SubProgressSubclass(top, 1000);
- customSubclass.beginTask("", 10000);
-
- for (int count = 0; count < 10000; count++)
- customSubclass.worked(1);
-
- Assert.assertEquals("If there is a custom subclass of SubProgressMonitor, all calls to worked() should delegate to internalWorked", 10000, customSubclass.internalWorkedCalls);
- customSubclass.done();
- top.done();
- }
-
- /**
- * Tests the style bits in SubProgressMonitor
- * @deprecated to suppress deprecation warnings
- */
- public void testStyles() {
-
- int[] styles = new int[] {0, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK | SubProgressMonitor.SUPPRESS_SUBTASK_LABEL};
-
- HashMap expected = new HashMap();
- expected.put("style 0 below style 2", new String[] {"setTaskName0", "", "setTaskName1"});
- expected.put("style 2 below style 0", new String[] {"setTaskName1", "beginTask1 ", "setTaskName1"});
- expected.put("style 6 below style 0", new String[] {"setTaskName1", "beginTask1 ", "setTaskName1"});
- expected.put("style 2 below style 4", new String[] {"setTaskName1", "beginTask0 beginTask1 ", "setTaskName1"});
- expected.put("style 0 below style 0", new String[] {"setTaskName0", "subTask1", "setTaskName1"});
- expected.put("style 6 as top-level monitor", new String[] {"", "", "setTaskName0"});
- expected.put("style 6 below style 2", new String[] {"setTaskName1", "", "setTaskName1"});
- expected.put("style 6 below style 6", new String[] {"setTaskName1", "", "setTaskName1"});
- expected.put("style 0 below style 6", new String[] {"setTaskName0", "", "setTaskName1"});
- expected.put("style 4 below style 2", new String[] {"setTaskName1", "", "setTaskName1"});
- expected.put("style 0 as top-level monitor", new String[] {"", "subTask0", "setTaskName0"});
- expected.put("style 0 below style 4", new String[] {"setTaskName0", "beginTask0 subTask1", "setTaskName1"});
- expected.put("style 4 below style 0", new String[] {"setTaskName1", "beginTask1 subTask1", "setTaskName1"});
- expected.put("style 4 as top-level monitor", new String[] {"", "beginTask0 subTask0", "setTaskName0"});
- expected.put("style 2 below style 6", new String[] {"setTaskName1", "", "setTaskName1"});
- expected.put("style 4 below style 6", new String[] {"setTaskName1", "", "setTaskName1"});
- expected.put("style 2 below style 2", new String[] {"setTaskName1", "", "setTaskName1"});
- expected.put("style 2 as top-level monitor", new String[] {"", "", "setTaskName0"});
- expected.put("style 6 below style 4", new String[] {"setTaskName1", "beginTask0 beginTask1 ", "setTaskName1"});
- expected.put("style 4 below style 4", new String[] {"setTaskName1", "beginTask0 beginTask1 subTask1", "setTaskName1"});
- HashMap results = new HashMap();
-
- for (int i = 0; i < styles.length; i++) {
- int style = styles[i];
- TestProgressMonitor top = new TestProgressMonitor();
- top.beginTask("", 100);
- SubProgressMonitor child = new SubProgressMonitor(top, 100, style);
-
- String testName = "style " + style + " as top-level monitor";
- results.put(testName, runChildTest(0, top, child, 100 * styles.length));
-
- for (int j = 0; j < styles.length; j++) {
- int innerStyle = styles[j];
- SubProgressMonitor innerChild = new SubProgressMonitor(child, 100, innerStyle);
- testName = "style " + innerStyle + " below style " + style;
- results.put(testName, runChildTest(1, top, innerChild, 100));
- innerChild.done();
- }
- child.done();
- }
-
- String failure = null;
- // Output the code for the observed results, in case one of them has changed intentionally
- for (Iterator iter = results.entrySet().iterator(); iter.hasNext();) {
- Map.Entry next = (Map.Entry) iter.next();
- String[] expectedResult = (String[]) expected.get(next.getKey());
- String[] value = (String[]) next.getValue();
- if (compareArray(value, expectedResult))
- continue;
-
- System.out.print("expected.put(\"" + next.getKey() + "\", new String[] {");
- failure = (String) next.getKey();
- String list = concatArray(value);
- System.out.println(list + "});");
- }
-
- if (failure != null) // Now actually throw an assertation if one of the results failed
- Assert.assertEquals(failure, concatArray((String[]) expected.get(failure)), concatArray((String[]) results.get(failure)));
- }
-
- private boolean compareArray(String[] value, String[] expectedResult) {
- if (value.length != expectedResult.length)
- return false;
- for (int i = 0; i < expectedResult.length; i++) {
- String next = expectedResult[i];
- if (!next.equals(value[i]))
- return false;
- }
- return true;
- }
-
- private String concatArray(String[] value) {
- StringBuffer buf = new StringBuffer();
- boolean isFirst = true;
- for (int i = 0; i < value.length; i++) {
- String nextValue = value[i];
- if (!isFirst)
- buf.append(", ");
- isFirst = false;
- buf.append("\"" + nextValue + "\"");
- }
- String list = buf.toString();
- return list;
- }
-
- private String[] runChildTest(int depth, TestProgressMonitor root, IProgressMonitor child, int ticks) {
- ArrayList results = new ArrayList();
- child.beginTask("beginTask" + depth, ticks);
- results.add(root.getTaskName());
- child.subTask("subTask" + depth);
- results.add(root.getSubTaskName());
- child.setTaskName("setTaskName" + depth);
- results.add(root.getTaskName());
- return (String[]) results.toArray(new String[results.size()]);
- }
-
- /**
- * Tests SubProgressMonitor nesting when using the default constructor. (Tests
- * parents in floating point mode)
- * @deprecated to suppress deprecation warnings
- */
- public void testConstructorNestingFP() {
- TestProgressMonitor top = new TestProgressMonitor();
- top.beginTask("", 2000);
-
- // Create an SPM, put it in floating-point mode, and consume half its work
- SubProgressMonitor fpMonitor = new SubProgressMonitor(top, 1000);
- fpMonitor.beginTask("", 100);
- fpMonitor.internalWorked(50.0);
- fpMonitor.internalWorked(-10.0); // should have no effect
-
- Assert.assertEquals(500.0, top.getTotalWork(), 0.01d);
-
- // Create a child monitor, and ensure that it grabs the correct amount of work
- // from the parent.
- SubProgressMonitor childMonitor = new SubProgressMonitor(fpMonitor, 20);
- childMonitor.beginTask("", 100);
- childMonitor.worked(100);
- childMonitor.done();
-
- Assert.assertEquals(700.0, top.getTotalWork(), 0.01d);
-
- // Create a child monitor, and ensure that it grabs the correct amount of work
- // from the parent.
- SubProgressMonitor childMonitor2 = new SubProgressMonitor(fpMonitor, 30);
- childMonitor2.beginTask("", 100);
- childMonitor2.worked(100);
- childMonitor2.done();
-
- Assert.assertEquals(1000.0, top.getTotalWork(), 0.01d);
-
- // Ensure that creating another child will have no effect
- SubProgressMonitor childMonitor3 = new SubProgressMonitor(fpMonitor, 10);
- childMonitor3.beginTask("", 100);
- childMonitor3.worked(100);
- childMonitor3.done();
-
- Assert.assertEquals(1000.0, top.getTotalWork(), 0.01d);
- fpMonitor.worked(100);
- Assert.assertEquals(1000.0, top.getTotalWork(), 0.01d);
- fpMonitor.done();
- Assert.assertEquals(1000.0, top.getTotalWork(), 0.01d);
- }
-
- /**
- * Tests SubProgressMonitor nesting when using the default constructor. Tests constructors
- * in int mode.
- * @deprecated to suppress deprecation warnings
- */
- public void testConstructorNestingInt() {
- TestProgressMonitor top = new TestProgressMonitor();
- top.beginTask("", 2000);
-
- // Create an SPM leave it in int mode, and consume half its work
- SubProgressMonitor fpMonitor = new SubProgressMonitor(top, 1000);
- fpMonitor.beginTask("", 100);
- fpMonitor.worked(50);
-
- Assert.assertEquals(500.0, top.getTotalWork(), 0.01d);
-
- // Create a child monitor, and ensure that it grabs the correct amount of work
- // from the parent.
- SubProgressMonitor childMonitor = new SubProgressMonitor(fpMonitor, 20);
- childMonitor.beginTask("", 100);
- childMonitor.worked(100);
- childMonitor.done();
-
- Assert.assertEquals(700.0, top.getTotalWork(), 0.01d);
-
- // Create a child monitor, and ensure that it grabs the correct amount of work
- // from the parent.
- SubProgressMonitor childMonitor2 = new SubProgressMonitor(fpMonitor, 30);
- childMonitor2.beginTask("", 100);
- childMonitor2.worked(100);
- childMonitor2.done();
-
- Assert.assertEquals(1000.0, top.getTotalWork(), 0.01d);
-
- // Ensure that creating another child will have no effect
- SubProgressMonitor childMonitor3 = new SubProgressMonitor(fpMonitor, 10);
- childMonitor3.beginTask("", 100);
- childMonitor3.worked(100);
- childMonitor3.done();
-
- Assert.assertEquals(1000.0, top.getTotalWork(), 0.01d);
- fpMonitor.worked(100);
- Assert.assertEquals(1000.0, top.getTotalWork(), 0.01d);
- fpMonitor.done();
- Assert.assertEquals(1000.0, top.getTotalWork(), 0.01d);
- }
-
- /**
- * Tests the automatic cleanup when progress monitors are created via their constructor
- * @deprecated to suppress deprecation warnings
- */
- public void testParallelChildren() {
- TestProgressMonitor top = new TestProgressMonitor();
- top.beginTask("", 1000);
- SubProgressMonitor mon = new SubProgressMonitor(top, 1000);
- mon.beginTask("", 1000);
-
- SubProgressMonitor monitor1 = new SubProgressMonitor(mon, 200);
- SubProgressMonitor monitor2 = new SubProgressMonitor(mon, 200);
-
- Assert.assertEquals("Ensure no work has been reported yet", 0.0, top.getTotalWork(), 0.01d);
- monitor1.beginTask("", 1000);
- Assert.assertEquals("Ensure no work has been reported yet", 0.0, top.getTotalWork(), 0.01d);
- monitor2.beginTask("", 1000);
- Assert.assertEquals("Should not have cleaned up monitor 1", 0.0, top.getTotalWork(), 0.01d);
- monitor1.done();
-
- Assert.assertEquals("Should have cleaned up monitor 1", 200.0, top.getTotalWork(), 0.01d);
- monitor1.worked(1000);
- Assert.assertEquals("Monitor1 shouldn't report work once it's complete", 200.0, top.getTotalWork(), 0.01d);
- monitor2.worked(500);
- Assert.assertEquals(300.0, top.getTotalWork(), 0.01d);
-
- // Create a monitor that will leak - monitors won't be auto-completed until their done methods are
- // called
- SubProgressMonitor monitor3 = new SubProgressMonitor(mon, 300);
- Assert.assertEquals("Monitor2 should not have been cleaned up yet", 300.0, top.getTotalWork(), 0.01d);
- SubProgressMonitor monitor4 = new SubProgressMonitor(mon, 300);
- monitor4.beginTask("", 100);
- mon.done();
- Assert.assertNotNull(monitor3);
-
- Assert.assertEquals("All leaked work should have been collected", 1000.0, top.getTotalWork(), 0.01d);
- }
-
- /**
- * @deprecated to suppress deprecation warnings
- */
- public void testCancellation() {
- TestProgressMonitor root = new TestProgressMonitor();
- root.beginTask("", 1000);
-
- SubProgressMonitor spm = new SubProgressMonitor(root, 1000);
-
- // Test that changes at the root propogate to the child
- root.setCanceled(true);
- Assert.assertTrue(spm.isCanceled());
- root.setCanceled(false);
- Assert.assertFalse(spm.isCanceled());
-
- // Test that changes to the child propogate to the root
- spm.setCanceled(true);
- Assert.assertTrue(root.isCanceled());
- spm.setCanceled(false);
- Assert.assertFalse(root.isCanceled());
-
- // Test a chain of depth 2
- spm.beginTask("", 1000);
- SubProgressMonitor spm2 = new SubProgressMonitor(spm, 1000);
-
- // Test that changes at the root propogate to the child
- root.setCanceled(true);
- Assert.assertTrue(spm2.isCanceled());
- root.setCanceled(false);
- Assert.assertFalse(spm2.isCanceled());
-
- // Test that changes to the child propogate to the root
- spm2.setCanceled(true);
- Assert.assertTrue(root.isCanceled());
- spm2.setCanceled(false);
- Assert.assertFalse(root.isCanceled());
- }
-
- /**
- * Tests creating progress monitors under a custom progress monitor
- * parent. This is the same as the performance test as the same name,
- * but it verifies correctness rather than performance.
- */
- public void testCreateChildrenUnderCustomParent() {
- TestProgressMonitor monitor = new TestProgressMonitor();
- createChildrenUnderParent(monitor, SubProgressTest.PROGRESS_SIZE);
-
- // We don't actually expect the progress to be optimal in this case since the progress monitor wouldn't
- // know what it was rooted under and would have had to report more progress than necessary... but we
- // should be able to check that there was no redundancy.
-
- Assert.assertTrue(monitor.getRedundantWorkCalls() == 0);
- Assert.assertTrue(monitor.getWorkCalls() >= 100);
- }
-
- /**
- * Creates a chain of n nested progress monitors. Calls beginTask on all monitors
- * except for the innermost one.
- *
- * @deprecated to suppress deprecation warnings
- *
- * @param parent
- * @param depth
- * @return the innermost SubProgressMonitor
- */
- private static SubProgressMonitor createSubProgressChain(IProgressMonitor parent, int depth) {
- SubProgressMonitor current;
- do {
- parent.beginTask("", 100);
- current = new SubProgressMonitor(parent, 100);
- parent = current;
- depth--;
- } while (depth > 0);
- return current;
- }
-
- /**
- * Reports progress by iterating over a loop of the given size, reporting 1 progress
- * at each iteration. Simulates the progress of worked(int) in loops.
- *
- * @param monitor progress monitor (callers are responsible for calling done() if necessary)
- * @param loopSize size of the loop
- */
- private static void reportWorkInLoop(IProgressMonitor monitor, int loopSize) {
- monitor.beginTask("", loopSize);
- for (int i = 0; i < loopSize; i++)
- monitor.worked(1);
- }
-
- /**
- * Reports progress by iterating over a loop of the given size, reporting 1 progress
- * at each iteration. Simulates the progress of internalWorked(double) in loops.
- *
- * @param monitor progress monitor (callers are responsible for calling done() if necessary)
- * @param loopSize size of the loop
- */
- private static void reportFloatingPointWorkInLoop(IProgressMonitor monitor, int loopSize) {
- monitor.beginTask("", loopSize);
- for (int i = 0; i < loopSize; i++)
- monitor.internalWorked(1.0d);
- }
-
- /**
- * Reports progress by creating a balanced binary tree of progress monitors. Simulates
- * mixed usage of IProgressMonitor in a typical usage. Calls isCanceled once each time work
- * is reported. Half of the work is reported using internalWorked and half is reported using worked,
- * to simulate mixed usage of the progress monitor.
- *
- * @deprecated to suppress deprecation warnings
- *
- * @param monitor progress monitor (callers are responsible for calling done() if necessary)
- * @param loopSize total size of the recursion tree
- */
- public static void reportWorkInBalancedTree(IProgressMonitor monitor, int loopSize) {
- monitor.beginTask("", 100);
- int leftBranch = loopSize / 2;
- int rightBranch = loopSize - leftBranch;
-
- if (leftBranch > 1) {
- SubProgressMonitor leftProgress = new SubProgressMonitor(monitor, 50);
- reportWorkInBalancedTree(leftProgress, leftBranch);
- leftProgress.done();
- } else {
- monitor.worked(25);
- monitor.internalWorked(25.0);
- monitor.isCanceled();
- }
-
- if (rightBranch > 1) {
- SubProgressMonitor rightProgress = new SubProgressMonitor(monitor, 50);
- reportWorkInBalancedTree(rightProgress, rightBranch);
- rightProgress.done();
- } else {
- monitor.worked(25);
- monitor.internalWorked(25.0);
- monitor.isCanceled();
- }
- }
-
- /**
- * Creates a balanced binary tree of progress monitors, without calling worked. Tests
- * progress monitor creation and cleanup time, and ensures that excess progress is
- * being collected when IProgressMonitor.done() is called.
- *
- * @deprecated to suppress deprecation warnings
- *
- * @param monitor progress monitor (callers are responsible for calling done() if necessary)
- * @param loopSize total size of the recursion tree
- */
- public static void createBalancedTree(IProgressMonitor monitor, int loopSize) {
- monitor.beginTask("", 100);
- int leftBranch = loopSize / 2;
- int rightBranch = loopSize - leftBranch;
-
- if (leftBranch > 1) {
- SubProgressMonitor leftProgress = new SubProgressMonitor(monitor, 50);
- createBalancedTree(leftProgress, leftBranch);
- leftProgress.done();
- }
-
- if (rightBranch > 1) {
- SubProgressMonitor rightProgress = new SubProgressMonitor(monitor, 50);
- createBalancedTree(rightProgress, rightBranch);
- rightProgress.done();
- }
- }
-
- /**
- * The innermost loop for the looping test. We make this a static method so
- * that it can be used both in this performance test and in the correctness test.
- *
- * @deprecated to suppress deprecation warnings
- */
- public static void runTestWorked(IProgressMonitor monitor) {
- SubProgressMonitor nestedMonitor = createSubProgressChain(monitor, SubProgressTest.CHAIN_DEPTH);
- reportWorkInLoop(nestedMonitor, SubProgressTest.PROGRESS_SIZE);
- callDoneOnChain(nestedMonitor, SubProgressTest.CHAIN_DEPTH + 1);
- }
-
- /**
- * The innermost loop for the looping test. We make this a static method so
- * that it can be used both in this performance test and in the correctness test.
- *
- * @deprecated to suppress deprecation warnings
- */
- public static void runTestInternalWorked(IProgressMonitor monitor) {
- SubProgressMonitor nestedMonitor = createSubProgressChain(monitor, SubProgressTest.CHAIN_DEPTH);
- reportFloatingPointWorkInLoop(nestedMonitor, SubProgressTest.PROGRESS_SIZE);
- callDoneOnChain(nestedMonitor, SubProgressTest.CHAIN_DEPTH + 1);
- }
-
- /**
- * The innermost loop for the recursion test. We make this a static method so
- * that it can be used both in this performance test and in the correctness test.
- *
- * @deprecated to suppress deprecation warnings
- */
- public static void runTestTypicalUsage(IProgressMonitor monitor) {
- SubProgressMonitor nestedMonitor = createSubProgressChain(monitor, SubProgressTest.CHAIN_DEPTH);
- reportWorkInBalancedTree(nestedMonitor, SubProgressTest.PROGRESS_SIZE);
- callDoneOnChain(nestedMonitor, SubProgressTest.CHAIN_DEPTH + 1);
- }
-
- /**
- * <p>The innermost loop for the create tree test. We make this a static method so
- * that it can be used both in this performance test and in the correctness test.</p>
- *
- * <p>The performance test ensures that it is fast to create a lot of progress monitors.</p>
- *
- * <p>The correctness test ensures that creating and destroying SubProgressMonitors
- * is enough to report progress, even if worked(int) and worked(double) are never called</p>
- *
- * @deprecated to suppress deprecation warnings
- */
- public static void runTestCreateTree(IProgressMonitor monitor) {
- SubProgressMonitor nestedMonitor = createSubProgressChain(monitor, SubProgressTest.CHAIN_DEPTH);
- createBalancedTree(nestedMonitor, SubProgressTest.PROGRESS_SIZE);
- callDoneOnChain(nestedMonitor, SubProgressTest.CHAIN_DEPTH + 1);
- }
-
- /**
- * Creates and destroys the given number of child progress monitors under the given parent.
- *
- * @param monitor monitor to create children under. The caller must call done on this monitor
- * if necessary.
- * @param progressSize total number of children to create.
- *
- * @deprecated to suppress deprecation warnings
- */
- private static void createChildrenUnderParent(IProgressMonitor monitor, int progressSize) {
- monitor.beginTask("", progressSize);
-
- for (int count = 0; count < progressSize; count++) {
- SubProgressMonitor mon = new SubProgressMonitor(monitor, 1);
- mon.beginTask("", 100);
- mon.done();
- }
- }
-
- /**
- * Test SubProgressMonitor's created with negative a work value.
- */
- public void testNegativeWorkValues() {
- TestProgressMonitor top = new TestProgressMonitor();
- top.beginTask("", 10);
-
- SubProgressMonitor childMonitor = new SubProgressMonitor(top, IProgressMonitor.UNKNOWN); // -1
- childMonitor.beginTask("", 10);
- childMonitor.worked(5);
- Assert.assertEquals(0.0, top.getTotalWork(), 0.01d);
- childMonitor.done();
- Assert.assertEquals(0.0, top.getTotalWork(), 0.01d);
-
- top.done();
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdaptable.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdaptable.java
deleted file mode 100644
index d3c24d9..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdaptable.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import org.eclipse.core.runtime.PlatformObject;
-
-/**
- * Used by IAdapterManagerTest
- */
-public class TestAdaptable extends PlatformObject {
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdapter.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdapter.java
deleted file mode 100644
index 3af2c67..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdapter.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-/**
- * Used by IAdapterManagerTest
- */
-public class TestAdapter {
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdapterFactory.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdapterFactory.java
deleted file mode 100644
index f4b6a45..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdapterFactory.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import junit.framework.Assert;
-import org.eclipse.core.runtime.IAdapterFactory;
-
-/**
- */
-public class TestAdapterFactory extends Assert implements IAdapterFactory {
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- assertTrue("Request for wrong adapter", adaptableObject instanceof TestAdaptable);
- return new TestAdapter();
- }
-
- public Class[] getAdapterList() {
- return new Class[] {TestAdapter.class};
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdapterFactoryLoader.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdapterFactoryLoader.java
deleted file mode 100644
index 8403ded..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestAdapterFactoryLoader.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import junit.framework.Assert;
-import org.eclipse.core.runtime.*;
-import org.osgi.framework.Bundle;
-
-/**
- * The adaptor factory to test scenario described in the bug 200068: adapting to
- * a class not reachable be the default class loader.
- *
- * This is a test code so almost all sanity checks are omitted (it is working on a known
- * hard-coded set of extensions and extension points). Also, for simplicity no trackers
- * or caching is done.
- */
-public class TestAdapterFactoryLoader extends Assert implements IAdapterFactory {
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- try {
- Class[] targets = getAdapterList();
- return targets[0].newInstance();
- } catch (InstantiationException e) {
- e.printStackTrace();
- fail("Unable to load target class");
- return null;
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- fail("Unable to load target class");
- return null;
- }
- }
-
- public Class[] getAdapterList() {
- IExtensionRegistry registry = RegistryFactory.getRegistry();
- IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.core.tests.runtime.factoryLoaderTest");
- IExtension[] extensions = extPoint.getExtensions();
- if (extensions.length == 0)
- return new Class[0];
- IExtension extension = extensions[0];
- IConfigurationElement[] confElements = extension.getConfigurationElements();
- String className = confElements[0].getAttribute("name");
- IContributor contributor = extension.getContributor();
- Bundle extensionBundle = ContributorFactoryOSGi.resolve(contributor);
- try {
- return new Class[] {extensionBundle.loadClass(className)};
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- fail("Unable to load class " + className);
- return null;
- }
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestProgressMonitor.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestProgressMonitor.java
deleted file mode 100644
index b3d16e4..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestProgressMonitor.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import junit.framework.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- *
- */
-public class TestProgressMonitor implements IProgressMonitor {
-
- private double totalWork;
-
- /**
- * Records the number of times worked or internalWorked was called with
- * an argument of 0.
- */
- private int redundantWorkCalls;
-
- /**
- * Records the number of times setTaskName was called without changing the
- * existing task name.
- */
- private int redundantSetTaskCalls;
-
- /**
- * Records the number of times subTask was called without changing the
- * existing task name
- */
- private int redundantSubTaskCalls;
-
- /**
- * Stores the number of calls to the integer worked(...) method
- */
- private int intWorkedCalls;
-
- /**
- * Stores the number of calls to the double internalWorked(...) method
- */
- private int doubleWorkedCalls;
-
- /**
- * Stores the total number of calls to worked and internalWorked
- */
- private int workCalls;
-
- /**
- * Stores the total number of calls to setTaskName
- */
- private int taskNameCalls;
-
- /**
- * Stores the total number of calls to subTask
- */
- private int subTaskCalls;
-
- /**
- * Stores the total number of calls to isCanceled
- */
- private int isCanceledCalls;
-
- private int beginTaskCalls;
-
- private int doneCalls;
-
- private String taskName = null;
-
- private String subTaskName = null;
-
- private int expectedWork;
-
- private String beginTaskName = "";
-
- private boolean cancelled = false;
-
- public String getBeginTaskName() {
- return beginTaskName;
- }
-
- private static boolean equals(Object o1, Object o2) {
- if (o1 == null)
- return o2 == null;
- if (o2 == null)
- return false;
- return o1.equals(o2);
- }
-
- /**
- * Returns the number of times beginTask() was called. For a correctly written job,
- * this should equal 1 on completion.
- *
- * @return the number of calls to beginTask
- */
- public int getBeginTaskCalls() {
- return beginTaskCalls;
- }
-
- /**
- * Returns the number of times done() was called. For a correctly written job,
- * this should equal 1 on completion.
- *
- * @return the number of calls to done
- */
- public int getDoneCalls() {
- return doneCalls;
- }
-
- /**
- * Returns the number of times worked was called as a no-op.
- * That is, it counts the number of times worked() or internalWorked() had
- * ever been called with a value of 0. This should return 0 for an
- * optimally-written job.
- *
- * @return true iff redundant calls were ever made to *worked() on this
- * monitor.
- */
- public int getRedundantWorkCalls() {
- return redundantWorkCalls;
- }
-
- /**
- * Returns the number of calls to isCancelled(). Optimally-written
- * jobs may call this an unbounded number of times.
- *
- * @return the number of calls to isCancelled().
- */
- public int getIsCanceledCalls() {
- return isCanceledCalls;
- }
-
- /**
- * Returns the number of calls to subTask().
- */
- public int getSubTaskCalls() {
- return subTaskCalls;
- }
-
- /**
- * Returs the number of calls to setTaskName().
- */
- public int getTaskNameCalls() {
- return taskNameCalls;
- }
-
- /**
- * Returns the number of calls to work() and internalWorked(). For the top-level
- * progress monitor in an optimally-written job, this should be at least 100 and
- * no more than 1000. A job that reports work less often than this will seem to
- * have jumpy progress, and a job that reports work more often than this is reporting
- * progress that won't be visible to the user and is wasting time in progress monitoring
- * code.
- *
- * @return the number of calls to worked(int) or internalWorked(double)
- */
- public int getWorkCalls() {
- return workCalls;
- }
-
- /**
- * Returns the number of calls to internalWorked. For an optimally-written job,
- * this should be 0, since integer work is faster and has no chance
- * of floating-point rounding errors.
- *
- * @return the number of calls to internalWorked
- */
- public int getDoubleWorkedCalls() {
- return doubleWorkedCalls;
- }
-
- /**
- * Returns the number of calls to worked(int). For an optimally-written job,
- * this should equal getWorkCalls, since integer work is faster and has no
- * chance of floating-point rounding errors.
- *
- * @return the number of calls to worked(int)
- */
- public int getIntWorkedCalls() {
- return intWorkedCalls;
- }
-
- public int getRedundantSetTaskCalls() {
- return redundantSetTaskCalls;
- }
-
- public int getRedundantSubTaskCalls() {
- return redundantSubTaskCalls;
- }
-
- /**
- * Returns the total work reported on this monitor. For an optimally-written job,
- * this should be +/- a small epsilon to account for floating point error.
- *
- * @return the total work reported on this job
- */
- public double getTotalWork() {
- return totalWork;
- }
-
- public void beginTask(String name, int workToDo) {
- beginTaskCalls++;
- this.expectedWork = workToDo;
- this.beginTaskName = name;
- }
-
- public void done() {
- doneCalls++;
- }
-
- public void internalWorked(double work) {
- workCalls++;
- doubleWorkedCalls++;
- if (work == 0.0)
- redundantWorkCalls++;
- totalWork += work;
- }
-
- public boolean isCanceled() {
- isCanceledCalls++;
- return cancelled;
- }
-
- public void setCanceled(boolean value) {
- this.cancelled = value;
- }
-
- public void setTaskName(String name) {
- taskNameCalls++;
- if (equals(name, taskName))
- redundantSetTaskCalls++;
- taskName = name;
- }
-
- public void subTask(String name) {
- subTaskCalls++;
- if (equals(name, subTaskName))
- redundantSubTaskCalls++;
- subTaskName = name;
- }
-
- public void worked(int work) {
- workCalls++;
- intWorkedCalls++;
- if (work == 0)
- redundantWorkCalls++;
- totalWork += work;
- }
-
- /**
- * <p>Asserts that the progress reported on this monitor was optimal. That is,
- * there were no redundant method calls, and progress was reported in between
- * 100 and 1000 increments.</p>
- */
- public void assertOptimal() {
- Assert.assertEquals("The progress monitor did not reach 100%", expectedWork, getTotalWork(), 0.01d);
- Assert.assertTrue("This monitor reported progress with less than 1% accuracy", getWorkCalls() >= 100);
- Assert.assertTrue("This monitor reported progress with more than 0.1% accuracy (the job spent too much time reporting redundant progress)", getWorkCalls() <= 1000);
- Assert.assertEquals("Null work was reported on this monitor", 0, getRedundantWorkCalls());
-
- if (expectedWork >= 1000) {
- // Only check for internalWorked usage if there were enough ticks allocated on this progress
- // monitor that worked(int) could have been used
- Assert.assertEquals("internalWorked was being used instead of worked()", 0, getDoubleWorkedCalls());
- }
-
- Assert.assertEquals("Redundant calls were made to setTaskName", 0, getRedundantSetTaskCalls());
- Assert.assertEquals("Redundant calls were made to subTask", 0, getRedundantSubTaskCalls());
- Assert.assertEquals("The number of calls to done should match the number of calls to beginTask", getBeginTaskCalls(), getDoneCalls());
- Assert.assertEquals("beginTask should be called exactly once", getBeginTaskCalls(), 1);
- }
-
- public String getSubTaskName() {
- return subTaskName == null ? "" : subTaskName;
- }
-
- public String getTaskName() {
- return taskName == null ? "" : taskName;
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/URLTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/URLTest.java
deleted file mode 100644
index b24e0c3..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/URLTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class URLTest extends RuntimeTest {
-
- public static Test suite() {
- return new TestSuite(URLTest.class);
- }
-
- public URLTest(String name) {
- super(name);
- }
-
- public void testPlatformPlugin() throws IOException {
- URL url = new URL("platform:/plugin/org.eclipse.core.tests.runtime/plugin.xml");
- InputStream is = url.openStream();
- is.close();
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/compatibility/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/compatibility/AllTests.java
deleted file mode 100644
index 07bf51f..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/compatibility/AllTests.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.compatibility;
-
-import junit.framework.*;
-
-public class AllTests extends TestCase {
-
- public AllTests() {
- super(null);
- }
-
- public AllTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AllTests.class.getName());
- suite.addTest(PluginCompatibilityTests.suite());
- return suite;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/compatibility/PluginCompatibilityTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/compatibility/PluginCompatibilityTests.java
deleted file mode 100644
index f1f0e3e..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/compatibility/PluginCompatibilityTests.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.compatibility;
-
-import java.io.IOException;
-import junit.framework.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.tests.harness.BundleTestingHelper;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.osgi.framework.*;
-
-public class PluginCompatibilityTests extends TestCase {
-
- public PluginCompatibilityTests(String name) {
- super(name);
- }
-
- // see bug 59013
- public void testPluginWithNoRuntimeLibrary() throws BundleException, IOException {
- assertNull("0.0", BundleTestingHelper.getBundles(RuntimeTestsPlugin.getContext(), "bundle01", "1.0"));
- BundleTestingHelper.runWithBundles("0.1", new Runnable() {
- public void run() {
- Bundle[] installed = BundleTestingHelper.getBundles(RuntimeTestsPlugin.getContext(), "bundle01", "1.0");
- assertEquals("1.0", 1, installed.length);
- assertEquals("1.0", "bundle01", installed[0].getSymbolicName());
- assertEquals("1.1", new Version("1.0"), new Version((String) installed[0].getHeaders().get(Constants.BUNDLE_VERSION)));
- assertEquals("1.2", Bundle.RESOLVED, installed[0].getState());
- IPluginDescriptor descriptor = Platform.getPluginRegistry().getPluginDescriptor("bundle01", new PluginVersionIdentifier("1.0"));
- assertNotNull("2.0", descriptor);
- assertNotNull("2.1", descriptor.getRuntimeLibraries());
- // see bug 89845. Changed in 3.1...even bundles with no libraries have "dot"
- // on the classpath
- assertEquals("2.2", 1, descriptor.getRuntimeLibraries().length);
- assertEquals("2.3", ".", descriptor.getRuntimeLibraries()[0].getPath().toString());
- }
- }, RuntimeTestsPlugin.getContext(), new String[] {RuntimeTestsPlugin.TEST_FILES_ROOT + "compatibility/bundle01"}, null);
- }
-
- public static Test suite() {
- return new TestSuite(PluginCompatibilityTests.class);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/AllTests.java
deleted file mode 100644
index 39add21..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/AllTests.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.content;
-
-import junit.framework.*;
-
-/**
- * Runs all content type tests
- */
-public class AllTests extends TestCase {
- public AllTests() {
- super(null);
- }
-
- public AllTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AllTests.class.getName());
- suite.addTest(IContentTypeManagerTest.suite());
- suite.addTest(SpecificContextTest.suite());
- suite.addTest(ContentDescriptionTest.suite());
- suite.addTest(XMLContentDescriberTest.suite());
- suite.addTest(LazyInputStreamTest.suite());
- suite.addTest(LazyReaderTest.suite());
- suite.addTest(TestBug94498.suite());
- return suite;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/ContentDescriptionTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/ContentDescriptionTest.java
deleted file mode 100644
index c69996d..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/ContentDescriptionTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.content;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.internal.content.*;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-
-public class ContentDescriptionTest extends RuntimeTest {
- private static final String CT_VOID = PI_RUNTIME_TESTS + '.' + "void";
- private static final QualifiedName ZOO_PROPERTY = new QualifiedName(PI_RUNTIME_TESTS, "zoo");
- private static final QualifiedName BAR_PROPERTY = new QualifiedName(PI_RUNTIME_TESTS, "bar");
- private static final QualifiedName FOO_PROPERTY = new QualifiedName(PI_RUNTIME_TESTS, "foo");
- private static final QualifiedName FRED_PROPERTY = new QualifiedName(PI_RUNTIME_TESTS, "fred");
-
- public ContentDescriptionTest(String name) {
- super(name);
- }
-
- private ContentType getContentType() {
- return ((ContentTypeHandler) Platform.getContentTypeManager().getContentType(CT_VOID)).getTarget();
- }
-
- public void testAllProperties() {
- ContentDescription description = new ContentDescription(IContentDescription.ALL, getContentType());
- assertTrue("1.0", description.isRequested(FOO_PROPERTY));
- assertNull("1.1", description.getProperty(FOO_PROPERTY));
- description.setProperty(FOO_PROPERTY, "value1");
- assertEquals("1.2", "value1", description.getProperty(FOO_PROPERTY));
- description.setProperty(FOO_PROPERTY, "value1b");
- assertEquals("1.3", "value1b", description.getProperty(FOO_PROPERTY));
- assertTrue("2.0", description.isRequested(BAR_PROPERTY));
- description.setProperty(BAR_PROPERTY, "value2");
- assertEquals("2.1", "value2", description.getProperty(BAR_PROPERTY));
- description.setProperty(ZOO_PROPERTY, "value3");
- assertEquals("2.2", "value3", description.getProperty(ZOO_PROPERTY));
- description.markImmutable();
- try {
- description.setProperty(FOO_PROPERTY, "value1c");
- fail("3.0 - should have failed");
- } catch (IllegalStateException e) {
- // success - the object was marked as immutable
- }
- }
-
- public void testOneProperty() {
- ContentDescription description = new ContentDescription(new QualifiedName[] {FOO_PROPERTY}, getContentType());
- assertTrue("1.0", description.isRequested(FOO_PROPERTY));
- assertNull("1.1", description.getProperty(FOO_PROPERTY));
- description.setProperty(FOO_PROPERTY, "value1");
- assertEquals("1.2", "value1", description.getProperty(FOO_PROPERTY));
- description.setProperty(FOO_PROPERTY, "value1b");
- assertEquals("1.3", "value1b", description.getProperty(FOO_PROPERTY));
- description.setProperty(BAR_PROPERTY, "value2");
- assertTrue("2.0", !description.isRequested(BAR_PROPERTY));
- description.setProperty(BAR_PROPERTY, "value2");
- assertNull("2.1", description.getProperty(BAR_PROPERTY));
- description.markImmutable();
- try {
- description.setProperty(FOO_PROPERTY, "value1c");
- fail("3.0 - should have failed");
- } catch (IllegalStateException e) {
- // success - the object was marked as immutable
- }
- }
-
- public void testZeroProperties() {
- ContentDescription description = new ContentDescription(new QualifiedName[0], getContentType());
- assertTrue("1.0", !description.isRequested(FOO_PROPERTY));
- assertNull("1.1", description.getProperty(FOO_PROPERTY));
- description.setProperty(FOO_PROPERTY, "value1");
- assertNull("1.2", description.getProperty(FOO_PROPERTY));
- description.markImmutable();
- try {
- description.setProperty(FOO_PROPERTY, "value1b");
- fail("2.0 - should have failed");
- } catch (IllegalStateException e) {
- // success - the object was marked as immutable
- }
- }
-
- public void testMultipleProperties() {
- ContentDescription description = new ContentDescription(new QualifiedName[] {FOO_PROPERTY, BAR_PROPERTY, ZOO_PROPERTY}, getContentType());
- assertTrue("1.0", description.isRequested(FOO_PROPERTY));
- assertNull("1.1", description.getProperty(FOO_PROPERTY));
- description.setProperty(FOO_PROPERTY, "value1");
- assertEquals("1.2", "value1", description.getProperty(FOO_PROPERTY));
- description.setProperty(FOO_PROPERTY, "value1b");
- assertEquals("1.3", "value1b", description.getProperty(FOO_PROPERTY));
- description.setProperty(BAR_PROPERTY, "value2");
- assertTrue("2.0", description.isRequested(BAR_PROPERTY));
- description.setProperty(BAR_PROPERTY, "value2");
- assertEquals("2.1", "value2", description.getProperty(BAR_PROPERTY));
- assertTrue("2.2", description.isRequested(ZOO_PROPERTY));
- description.setProperty(ZOO_PROPERTY, "value3");
- assertEquals("2.3", "value3", description.getProperty(ZOO_PROPERTY));
- assertTrue("3.0", !description.isRequested(FRED_PROPERTY));
- description.setProperty(FRED_PROPERTY, "value3");
- assertNull("3.1", description.getProperty(FRED_PROPERTY));
- description.markImmutable();
- try {
- description.setProperty(FOO_PROPERTY, "value1c");
- fail("4.0 - should have failed");
- } catch (IllegalStateException e) {
- // success - the object was marked as immutable
- }
- }
-
- public static Test suite() {
- return new TestSuite(ContentDescriptionTest.class);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/IContentTypeManagerTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/IContentTypeManagerTest.java
deleted file mode 100644
index 0132ced..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/IContentTypeManagerTest.java
+++ /dev/null
@@ -1,1356 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.content;
-
-import java.io.*;
-import java.util.*;
-import junit.framework.*;
-import org.eclipse.core.internal.content.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.content.*;
-import org.eclipse.core.runtime.content.IContentTypeManager.ContentTypeChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.core.tests.harness.BundleTestingHelper;
-import org.eclipse.core.tests.harness.TestRegistryChangeListener;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-public class IContentTypeManagerTest extends RuntimeTest {
-
- private static class ContentTypeChangeTracer implements IContentTypeManager.IContentTypeChangeListener {
- private Set changed = new HashSet();
-
- public void contentTypeChanged(ContentTypeChangeEvent event) {
- changed.add(event.getContentType());
- }
-
- public Collection getChanges() {
- return changed;
- }
-
- public boolean isOnlyChange(IContentType myType) {
- return changed.size() == 1 && changed.contains(myType);
- }
-
- public void reset() {
- changed.clear();
- }
- }
-
- // XXX this is copied from CharsetDeltaJob in the resources plug-in
- private static final String FAMILY_CHARSET_DELTA = "org.eclipse.core.resources.charsetJobFamily";
-
- private final static String MINIMAL_XML = "<?xml version=\"1.0\"?><org.eclipse.core.runtime.tests.root/>";
- private final static String SAMPLE_BIN1_OFFSET = "12345";
- private final static byte[] SAMPLE_BIN1_SIGNATURE = {0x10, (byte) 0xAB, (byte) 0xCD, (byte) 0xFF};
- private final static String SAMPLE_BIN2_OFFSET = "";
- private final static byte[] SAMPLE_BIN2_SIGNATURE = {0x10, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF};
- private final static String XML_DTD_EXTERNAL_ENTITY = "<?xml version=\"1.0\"?><!DOCTYPE project SYSTEM \"org.eclipse.core.runtime.tests.some.dtd\" [<!ENTITY someentity SYSTEM \"someentity.xml\">]><org.eclipse.core.runtime.tests.root/>";
- private final static String XML_DTD_US_ASCII = "<?xml version=\"1.0\" encoding=\"US-ASCII\"?><!DOCTYPE sometype SYSTEM \"org.eclipse.core.runtime.tests.some.dtd\"><org.eclipse.core.runtime.tests.root/>";
- private final static String XML_ISO_8859_1 = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><org.eclipse.core.runtime.tests.root/>";
- private final static String XML_ISO_8859_1_SINGLE_QUOTES = "<?xml version='1.0' encoding='ISO-8859-1'?><org.eclipse.core.runtime.tests.root/>";
- private final static String XML_ROOT_ELEMENT_EXTERNAL_ENTITY = "<?xml version=\"1.0\"?><!DOCTYPE project [<!ENTITY someentity SYSTEM \"someentity.xml\">]><org.eclipse.core.runtime.tests.root-element/>";
- private final static String XML_ROOT_ELEMENT_EXTERNAL_ENTITY2 = "<?xml version=\"1.0\"?><!DOCTYPE org.eclipse.core.runtime.tests.root-element PUBLIC \"org.eclipse.core.runtime.tests.root-elementId\" \"org.eclipse.core.runtime.tests.root-element.dtd\" ><org.eclipse.core.runtime.tests.root-element/>";
- private final static String XML_ROOT_ELEMENT_ISO_8859_1 = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><org.eclipse.core.runtime.tests.root-element/>";
- private final static String XML_ROOT_ELEMENT_NO_DECL = "<org.eclipse.core.runtime.tests.root-element/>";
- private final static String XML_US_ASCII_INVALID = "<?xml version='1.0' encoding='us-ascii'?><!-- Non-ASCII chars: áéíóú --><org.eclipse.core.runtime.tests.root/>";
- private final static String XML_UTF_16 = "<?xml version=\"1.0\" encoding=\"UTF-16\"?><org.eclipse.core.runtime.tests.root/>";
- private final static String XML_UTF_16BE = "<?xml version=\"1.0\" encoding=\"UTF-16BE\"?><org.eclipse.core.runtime.tests.root/>";
- private final static String XML_UTF_16LE = "<?xml version=\"1.0\" encoding=\"UTF-16LE\"?><org.eclipse.core.runtime.tests.root/>";
- private final static String XML_UTF_8 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><org.eclipse.core.runtime.tests.root/>";
- private static final String XML_ROOT_ELEMENT_NS_MATCH1 = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><prefix:rootElement1 xmlns:prefix='urn:eclipse.core.runtime.ns1'/>";
- private static final String XML_ROOT_ELEMENT_NS_MATCH2 = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><!DOCTYPE rootElement2 SYSTEM \"org.eclipse.core.runtime.tests.nothing\"><rootElement2 xmlns='urn:eclipse.core.runtime.ns2'/>";
- private static final String XML_ROOT_ELEMENT_NS_WRONG_ELEM = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><rootElement3 xmlns='urn:eclipse.core.runtime.ns2'/>";
- private static final String XML_ROOT_ELEMENT_NS_WRONG_NS = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><prefix:rootElement1 xmlns='http://example.com/'/>";
- private static final String XML_ROOT_ELEMENT_NS_MIXUP = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><rootElement2 xmlns='urn:eclipse.core.runtime.ns1'/>";
- private static final String XML_ROOT_ELEMENT_NS_WILDCARD = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><weCouldPutAnythingHere xmlns='urn:eclipse.core.runtime.nsWild'/>";
- private final static String XML_ROOT_ELEMENT_NS_WILDCARD2 = "<?xml version=\"1.0\" encoding=\"US-ASCII\"?><!DOCTYPE Joker SYSTEM \"org.eclipse.core.runtime.tests.some.dtd3\"><Joker/>";
- private final static String XML_ROOT_ELEMENT_EMPTY_NS = "<?xml version=\"1.0\" encoding=\"US-ASCII\"?><!DOCTYPE Joker SYSTEM \"org.eclipse.core.runtime.tests.some.dtd3\"><rootElement>";
-
- public static Test suite() {
- // return new IContentTypeManagerTest("testRootElementAndDTDDescriber");
- return new TestSuite(IContentTypeManagerTest.class);
- }
-
- public IContentTypeManagerTest(String name) {
- super(name);
- }
-
- /**
- * Helps to ensure we don't get fooled by case sensitivity in file names/specs.
- */
- private String changeCase(String original) {
- StringBuffer result = new StringBuffer(original);
- for (int i = result.length() - 1; i >= 0; i--) {
- char originalChar = original.charAt(i);
- result.setCharAt(i, i % 2 == 0 ? Character.toLowerCase(originalChar) : Character.toUpperCase(originalChar));
- }
- return result.toString();
- }
-
- private boolean contains(Object[] array, Object element) {
- for (int i = 0; i < array.length; i++)
- if (array[i].equals(element))
- return true;
- return false;
- }
-
- private IContentDescription getDescriptionFor(IContentTypeMatcher finder, String contents, String encoding, String fileName, QualifiedName[] options, boolean text) throws UnsupportedEncodingException, IOException {
- return text ? finder.getDescriptionFor(getReader(contents), fileName, options) : finder.getDescriptionFor(getInputStream(contents, encoding), fileName, options);
- }
-
- public InputStream getInputStream(byte[][] contents) {
- int size = 0;
- // computes final array size
- for (int i = 0; i < contents.length; i++)
- size += contents[i].length;
- byte[] full = new byte[size];
- int fullIndex = 0;
- // concatenates all byte arrays
- for (int i = 0; i < contents.length; i++)
- for (int j = 0; j < contents[i].length; j++)
- full[fullIndex++] = contents[i][j];
- return new ByteArrayInputStream(full);
- }
-
- public InputStream getInputStream(String contents) throws UnsupportedEncodingException {
- return new ByteArrayInputStream(contents.getBytes());
- }
-
- public InputStream getInputStream(String contents, String encoding) throws UnsupportedEncodingException {
- return new ByteArrayInputStream(encoding == null ? contents.getBytes() : contents.getBytes(encoding));
- }
-
- public Reader getReader(String contents) {
- return new CharArrayReader(contents.toCharArray());
- }
-
- private boolean isText(IContentTypeManager manager, IContentType candidate) {
- IContentType text = manager.getContentType(IContentTypeManager.CT_TEXT);
- return candidate.isKindOf(text);
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- // some tests here will trigger a charset delta job (any causing ContentTypeChangeEvents to be broadcast)
- // ensure none is left running after we finish
- Job.getJobManager().join(FAMILY_CHARSET_DELTA, getMonitor());
- }
-
- /**
- * This test shows how we deal with aliases.
- */
- public void testAlias() throws IOException {
- final IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
- IContentType alias = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".alias");
- assertNotNull("0.7", alias);
- IContentType derived = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".derived-from-alias");
- assertNotNull("0.8", derived);
- IContentType target = contentTypeManager.getContentType("org.eclipse.bundle02.missing-target");
- assertNull("0.9", target);
- IContentType[] selected;
- selected = contentTypeManager.findContentTypesFor("foo.missing-target");
- assertEquals("1.1", 2, selected.length);
- assertEquals("1.2", alias, selected[0]);
- assertEquals("1.3", derived, selected[1]);
- selected = contentTypeManager.findContentTypesFor(getRandomContents(), "foo.missing-target");
- assertEquals("1.4", 2, selected.length);
- assertEquals("1.5", alias, selected[0]);
- assertEquals("1.6", derived, selected[1]);
-
- //test late addition of content type
- TestRegistryChangeListener listener = new TestRegistryChangeListener(Platform.PI_RUNTIME, ContentTypeBuilder.PT_CONTENTTYPES, null, null);
- BundleTestingHelper.runWithBundles("2", new Runnable() {
- public void run() {
- IContentType alias = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".alias");
- assertNull("2.1.1", alias);
- IContentType derived = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".derived-from-alias");
- assertNotNull("2.1.2", derived);
- IContentType target = contentTypeManager.getContentType("org.eclipse.bundle02.missing-target");
- assertNotNull("2.1.3", target);
- // checks associations
- IContentType[] selected = contentTypeManager.findContentTypesFor("foo.missing-target");
- assertEquals("2.2.1", 2, selected.length);
- assertEquals("2.2.2", target, selected[0]);
- assertEquals("2.2.3", derived, selected[1]);
- try {
- selected = contentTypeManager.findContentTypesFor(getRandomContents(), "foo.missing-target");
- } catch (IOException e) {
- fail("2.2.4", e);
- }
- assertEquals("2.2.5", 2, selected.length);
- assertEquals("2.2.6", target, selected[0]);
- assertEquals("2.2.7", derived, selected[1]);
- }
- }, RuntimeTestsPlugin.getContext(), new String[] {RuntimeTestsPlugin.TEST_FILES_ROOT + "content/bundle02"}, listener);
- }
-
- public void testAssociationInheritance() throws CoreException {
- IContentTypeManager manager = Platform.getContentTypeManager();
- IContentTypeMatcher finder = manager.getMatcher(new LocalSelectionPolicy(), null);
- IContentType text = manager.getContentType(Platform.PI_RUNTIME + ".text");
- IContentType assoc1 = manager.getContentType(PI_RUNTIME_TESTS + ".assoc1");
- IContentType assoc2 = manager.getContentType(PI_RUNTIME_TESTS + ".assoc2");
-
- // associate a user-defined file spec
- text.addFileSpec("txt_useradded", IContentType.FILE_EXTENSION_SPEC);
- assoc1.addFileSpec("txt_assoc1useradded", IContentType.FILE_EXTENSION_SPEC);
- assoc2.addFileSpec("txt_assoc2useradded", IContentType.FILE_EXTENSION_SPEC);
-
- // test associations
- assertTrue("1.1", assoc1.isAssociatedWith(changeCase("text.txt")));
- assertTrue("1.2", assoc1.isAssociatedWith(changeCase("text.txt_useradded")));
- assertTrue("1.3", assoc1.isAssociatedWith(changeCase("text.txt_pluginadded")));
- assertTrue("1.4", assoc1.isAssociatedWith(changeCase("text.txt_assoc1pluginadded")));
- assertTrue("1.5", assoc1.isAssociatedWith(changeCase("text.txt_assoc1useradded")));
-
- assertTrue("2.1", !assoc2.isAssociatedWith(changeCase("text.txt")));
- assertTrue("2.2", !assoc2.isAssociatedWith(changeCase("text.txt_useradded")));
- assertTrue("2.3", !assoc2.isAssociatedWith(changeCase("text.txt_pluginadded")));
- assertTrue("2.4", assoc2.isAssociatedWith(changeCase("text.txt_assoc2pluginadded")));
- assertTrue("2.5", assoc2.isAssociatedWith(changeCase("text.txt_assoc2builtin")));
- assertTrue("2.6", assoc2.isAssociatedWith(changeCase("text.txt_assoc2useradded")));
-
- IContentType[] selected;
- // text built-in associations
- selected = finder.findContentTypesFor(changeCase("text.txt"));
- assertEquals("3.0", 2, selected.length);
- assertEquals("3.1", assoc1, selected[1]);
- assertEquals("3.2", text, selected[0]);
-
- // text user-added associations
- selected = finder.findContentTypesFor(changeCase("text.txt_useradded"));
- assertEquals("4.0", 2, selected.length);
- assertEquals("4.1", assoc1, selected[1]);
- assertEquals("4.2", text, selected[0]);
-
- // text provider-added associations
- selected = finder.findContentTypesFor(changeCase("text.txt_pluginadded"));
- assertEquals("5.0", 2, selected.length);
- assertEquals("5.1", assoc1, selected[1]);
- assertEquals("5.2", text, selected[0]);
-
- selected = finder.findContentTypesFor(changeCase("text.txt_assoc1pluginadded"));
- assertEquals("6.0", 1, selected.length);
- assertEquals("6.1", assoc1, selected[0]);
-
- selected = finder.findContentTypesFor(changeCase("text.txt_assoc1useradded"));
- assertEquals("7.0", 1, selected.length);
- assertEquals("7.1", assoc1, selected[0]);
-
- selected = finder.findContentTypesFor(changeCase("text.txt_assoc2pluginadded"));
- assertEquals("8.0", 1, selected.length);
- assertEquals("8.1", assoc2, selected[0]);
-
- selected = finder.findContentTypesFor(changeCase("text.txt_assoc2useradded"));
- assertEquals("9.0", 1, selected.length);
- assertEquals("9.1", assoc2, selected[0]);
-
- selected = finder.findContentTypesFor(changeCase("text.txt_assoc2builtin"));
- assertEquals("10.0", 1, selected.length);
- assertEquals("10.1", assoc2, selected[0]);
- }
-
- public void testAssociations() throws CoreException {
- IContentType text = Platform.getContentTypeManager().getContentType(Platform.PI_RUNTIME + ".text");
-
- // associate a user-defined file spec
- text.addFileSpec("txt_useradded", IContentType.FILE_EXTENSION_SPEC);
-
- // test associations
- assertTrue("0.1", text.isAssociatedWith(changeCase("text.txt")));
- assertTrue("0.2", text.isAssociatedWith(changeCase("text.txt_useradded")));
- assertTrue("0.3", text.isAssociatedWith(changeCase("text.txt_pluginadded")));
-
- // check provider defined settings
- String[] providerDefinedExtensions = text.getFileSpecs(IContentType.FILE_EXTENSION_SPEC | IContentType.IGNORE_USER_DEFINED);
- assertTrue("1.0", contains(providerDefinedExtensions, "txt"));
- assertTrue("1.1", !contains(providerDefinedExtensions, "txt_useradded"));
- assertTrue("1.2", contains(providerDefinedExtensions, "txt_pluginadded"));
-
- // check user defined settings
- String[] textUserDefinedExtensions = text.getFileSpecs(IContentType.FILE_EXTENSION_SPEC | IContentType.IGNORE_PRE_DEFINED);
- assertTrue("2.0", !contains(textUserDefinedExtensions, "txt"));
- assertTrue("2.1", contains(textUserDefinedExtensions, "txt_useradded"));
- assertTrue("2.2", !contains(textUserDefinedExtensions, "txt_pluginadded"));
-
- // removing pre-defined file specs should not do anything
- text.removeFileSpec("txt", IContentType.FILE_EXTENSION_SPEC);
- assertTrue("3.0", contains(text.getFileSpecs(IContentType.FILE_EXTENSION_SPEC | IContentType.IGNORE_USER_DEFINED), "txt"));
- assertTrue("3.1", text.isAssociatedWith(changeCase("text.txt")));
- assertTrue("3.2", text.isAssociatedWith(changeCase("text.txt_useradded")));
- assertTrue("3.3", text.isAssociatedWith(changeCase("text.txt_pluginadded")));
-
- // removing user file specs is the normal case and has to work as expected
- text.removeFileSpec("txt_useradded", IContentType.FILE_EXTENSION_SPEC);
- assertTrue("4.0", !contains(text.getFileSpecs(IContentType.FILE_EXTENSION_SPEC | IContentType.IGNORE_PRE_DEFINED), "ini"));
- assertTrue("4.1", text.isAssociatedWith(changeCase("text.txt")));
- assertTrue("4.2", !text.isAssociatedWith(changeCase("text.txt_useradded")));
- assertTrue("4.3", text.isAssociatedWith(changeCase("text.txt_pluginadded")));
- }
-
- public void testBinaryTypes() throws IOException {
- IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
- IContentType sampleBinary1 = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".sample-binary1");
- IContentType sampleBinary2 = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".sample-binary2");
- InputStream contents;
-
- contents = getInputStream(new byte[][] {SAMPLE_BIN1_OFFSET.getBytes(), SAMPLE_BIN1_SIGNATURE, " extra contents".getBytes()});
- IContentDescription description = contentTypeManager.getDescriptionFor(contents, null, IContentDescription.ALL);
- assertNotNull("6.0", description);
- assertEquals("6.1", sampleBinary1, description.getContentType());
-
- contents = getInputStream(new byte[][] {SAMPLE_BIN2_OFFSET.getBytes(), SAMPLE_BIN2_SIGNATURE, " extra contents".getBytes()});
- description = contentTypeManager.getDescriptionFor(contents, null, IContentDescription.ALL);
- assertNotNull("7.0", description);
- assertEquals("7.1", sampleBinary2, description.getContentType());
-
- // make sure we ignore that content type when contents are text
- // (see bug 100032)
- // first check if our test environment is sane
- IContentType[] selected = contentTypeManager.findContentTypesFor("test.samplebin2");
- assertEquals("8.1", 1, selected.length);
- assertEquals("8.2", sampleBinary2.getId(), selected[0].getId());
- // (we used to blow up here)
- description = contentTypeManager.getDescriptionFor(getReader(getRandomString()), "test.samplebin2", IContentDescription.ALL);
- assertNull("8.3",description);
- }
-
- public void testByteOrderMark() throws UnsupportedEncodingException, IOException {
- IContentType text = Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT);
- QualifiedName[] options = new QualifiedName[] {IContentDescription.BYTE_ORDER_MARK};
- IContentDescription description;
- // tests with UTF-8 BOM
- String UTF8_BOM = new String(IContentDescription.BOM_UTF_8, "ISO-8859-1");
- description = text.getDescriptionFor(new ByteArrayInputStream((UTF8_BOM + MINIMAL_XML).getBytes("ISO-8859-1")), options);
- assertNotNull("1.0", description.getProperty(IContentDescription.BYTE_ORDER_MARK));
- assertEquals("1.1", IContentDescription.BOM_UTF_8, description.getProperty(IContentDescription.BYTE_ORDER_MARK));
- // tests with UTF-16 Little Endian BOM
- String UTF16_LE_BOM = new String(IContentDescription.BOM_UTF_16LE, "ISO-8859-1");
- description = text.getDescriptionFor(new ByteArrayInputStream((UTF16_LE_BOM + MINIMAL_XML).getBytes("ISO-8859-1")), options);
- assertNotNull("2.0", description.getProperty(IContentDescription.BYTE_ORDER_MARK));
- assertEquals("2.1", IContentDescription.BOM_UTF_16LE, description.getProperty(IContentDescription.BYTE_ORDER_MARK));
- // tests with UTF-16 Big Endian BOM
- String UTF16_BE_BOM = new String(IContentDescription.BOM_UTF_16BE, "ISO-8859-1");
- description = text.getDescriptionFor(new ByteArrayInputStream((UTF16_BE_BOM + MINIMAL_XML).getBytes("ISO-8859-1")), options);
- assertNotNull("3.0", description.getProperty(IContentDescription.BYTE_ORDER_MARK));
- assertEquals("3.1", IContentDescription.BOM_UTF_16BE, description.getProperty(IContentDescription.BYTE_ORDER_MARK));
- // test with no BOM
- description = text.getDescriptionFor(new ByteArrayInputStream(MINIMAL_XML.getBytes("ISO-8859-1")), options);
- assertNull("4.0", description.getProperty(IContentDescription.BYTE_ORDER_MARK));
-
- // tests for partial BOM
- // first byte of UTF-16 Big Endian + minimal xml
- String UTF16_BE_BOM_1byte = new String(new byte[] {(byte) 0xFE}, "ISO-8859-1");
- description = text.getDescriptionFor(new ByteArrayInputStream((UTF16_BE_BOM_1byte + MINIMAL_XML).getBytes("ISO-8859-1")), options);
- assertNull("5.0", description.getProperty(IContentDescription.BYTE_ORDER_MARK));
- // first byte of UTF-16 Big Endian only (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=199252)
- description = text.getDescriptionFor(new ByteArrayInputStream((UTF16_BE_BOM_1byte).getBytes("ISO-8859-1")), options);
- assertNull("5.1", description.getProperty(IContentDescription.BYTE_ORDER_MARK));
-
- // first byte of UTF-16 Little Endian + minimal xml
- String UTF16_LE_BOM_1byte = new String(new byte[] {(byte) 0xFF}, "ISO-8859-1");
- description = text.getDescriptionFor(new ByteArrayInputStream((UTF16_LE_BOM_1byte + MINIMAL_XML).getBytes("ISO-8859-1")), options);
- assertNull("6.0", description.getProperty(IContentDescription.BYTE_ORDER_MARK));
- // first byte of UTF-16 Little Endian only
- description = text.getDescriptionFor(new ByteArrayInputStream((UTF16_LE_BOM_1byte).getBytes("ISO-8859-1")), options);
- assertNull("6.1", description.getProperty(IContentDescription.BYTE_ORDER_MARK));
-
- // first byte of UTF-8 + minimal xml
- String UTF8_BOM_1byte = new String(new byte[] {(byte) 0xEF}, "ISO-8859-1");
- description = text.getDescriptionFor(new ByteArrayInputStream((UTF8_BOM_1byte + MINIMAL_XML).getBytes("ISO-8859-1")), options);
- assertNull("7.0", description.getProperty(IContentDescription.BYTE_ORDER_MARK));
- // first byte of UTF-8 only
- description = text.getDescriptionFor(new ByteArrayInputStream((UTF8_BOM_1byte).getBytes("ISO-8859-1")), options);
- assertNull("7.1", description.getProperty(IContentDescription.BYTE_ORDER_MARK));
-
- // two first bytes of UTF-8 + minimal xml
- String UTF8_BOM_2bytes = new String(new byte[] {(byte) 0xEF, (byte) 0xBB}, "ISO-8859-1");
- description = text.getDescriptionFor(new ByteArrayInputStream((UTF8_BOM_2bytes + MINIMAL_XML).getBytes("ISO-8859-1")), options);
- assertNull("8.0", description.getProperty(IContentDescription.BYTE_ORDER_MARK));
- // two first bytes of UTF-8 only
- description = text.getDescriptionFor(new ByteArrayInputStream((UTF8_BOM_2bytes).getBytes("ISO-8859-1")), options);
- assertNull("8.1", description.getProperty(IContentDescription.BYTE_ORDER_MARK));
- }
-
- /**
- * See bug 90218.
- */
- public void testContentAndNameMatching() throws IOException /* not really */{
- IContentTypeManager manager = Platform.getContentTypeManager();
-
- byte[][] contents0 = {{0x0A, 0x0B, 0x0E, 0x10}};
- byte[][] contents1 = {{0x0A, 0x0B, 0x0C, 0x10}};
- byte[][] contents2 = {{0x0A, 0x0B, 0x0D, 0x10}};
- byte[][] invalidContents = {{0, 0, 0, 0}};
-
- // base matches *.mybinary files starting with 0x0a 0x0b
- IContentType base = manager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".binary_base");
- // derived1 matches *.mybinary and specifically foo.mybinary files starting with 0x0a 0x0b 0xc
- IContentType derived1 = manager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".binary_derived1");
- // derived2 matches *.mybinary (inherits filespec from base) files starting with 0x0a 0x0b 0xd
- IContentType derived2 = manager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".binary_derived2");
-
- IContentType[] selected;
-
- selected = manager.findContentTypesFor(getInputStream(contents0), "anything.mybinary");
- assertEquals("1.0", 3, selected.length);
- // all we know is the first one is the base type (only one with a VALID match)
- assertEquals("1.1", base, selected[0]);
-
- selected = manager.findContentTypesFor(getInputStream(contents0), "foo.mybinary");
- // we know also that the second one will be derived1, because it has a full name matching
- assertEquals("2.0", 3, selected.length);
- assertEquals("2.1", base, selected[0]);
- assertEquals("2.2", derived1, selected[1]);
-
- selected = manager.findContentTypesFor(getInputStream(contents1), "foo.mybinary");
- // derived1 will be first because both base and derived1 have a strong content matching, so more specific wins
- assertEquals("3.0", 3, selected.length);
- assertEquals("3.1", derived1, selected[0]);
- assertEquals("3.2", base, selected[1]);
-
- selected = manager.findContentTypesFor(getInputStream(contents2), "foo.mybinary");
- // same as 3.* - derived1 is last because content matching is weak, althoug name matching is strong
- assertEquals("4.0", 3, selected.length);
- assertEquals("4.1", derived2, selected[0]);
- assertEquals("4.2", base, selected[1]);
-
- selected = manager.findContentTypesFor(getInputStream(invalidContents), "foo.mybinary");
- // all types have weak content matching only - derived1 has strong name matching
- assertEquals("5.0", 3, selected.length);
- assertEquals("5.1", derived1, selected[0]);
- assertEquals("5.2", base, selected[1]);
-
- selected = manager.findContentTypesFor(getInputStream(invalidContents), "anything.mybinary");
- // all types have weak content/name matching only - most general wins
- assertEquals("6.0", 3, selected.length);
- assertEquals("6.1", base, selected[0]);
- }
-
- /*
- * Tests both text and byte stream-based getDescriptionFor methods.
- */
- public void testContentDescription() throws IOException, CoreException {
- IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
- IContentTypeMatcher finder = contentTypeManager.getMatcher(new LocalSelectionPolicy(), null);
-
- IContentType xmlType = contentTypeManager.getContentType(Platform.PI_RUNTIME + ".xml");
- IContentType mytext = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + '.' + "mytext");
- IContentType mytext1 = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + '.' + "mytext1");
- IContentType mytext2 = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + '.' + "mytext2");
-
- boolean text = false;
-
- for (int i = 0; i < 2; i++, text = !text) {
- String sufix = text ? "-text" : "-binary";
- IContentDescription description;
-
- description = getDescriptionFor(finder, MINIMAL_XML, "UTF-8", "foo.xml", IContentDescription.ALL, text);
- assertNotNull("1.0" + sufix, description);
- assertEquals("1.1" + sufix, xmlType, description.getContentType());
- assertSame("1.2", xmlType.getDefaultDescription(), description);
-
- description = getDescriptionFor(finder, MINIMAL_XML, "UTF-8", "foo.xml", new QualifiedName[] {IContentDescription.CHARSET}, text);
- assertNotNull("2.0" + sufix, description);
- assertEquals("2.1" + sufix, xmlType, description.getContentType());
- // the default charset should have been filled by the content type manager
- assertEquals("2.2" + sufix, "UTF-8", description.getProperty(IContentDescription.CHARSET));
- assertSame("2.3", xmlType.getDefaultDescription(), description);
-
- description = getDescriptionFor(finder, XML_ISO_8859_1, "ISO-8859-1", "foo.xml", new QualifiedName[] {IContentDescription.CHARSET}, text);
- assertNotNull("2.3a" + sufix, description);
- assertEquals("2.3b" + sufix, xmlType, description.getContentType());
- assertEquals("2.3c" + sufix, "ISO-8859-1", description.getProperty(IContentDescription.CHARSET));
- assertNotSame("2.3d", xmlType.getDefaultDescription(), description);
-
- // ensure we handle single quotes properly (bug 65443)
- description = getDescriptionFor(finder, XML_ISO_8859_1_SINGLE_QUOTES, "ISO-8859-1", "foo.xml", new QualifiedName[] {IContentDescription.CHARSET}, text);
- assertNotNull("2.3e" + sufix, description);
- assertEquals("2.3f" + sufix, xmlType, description.getContentType());
- assertEquals("2.3g" + sufix, "ISO-8859-1", description.getProperty(IContentDescription.CHARSET));
- assertNotSame("2.3h", xmlType.getDefaultDescription(), description);
-
- description = getDescriptionFor(finder, XML_UTF_16, "UTF-16", "foo.xml", new QualifiedName[] {IContentDescription.CHARSET, IContentDescription.BYTE_ORDER_MARK}, text);
- assertNotNull("2.4a" + sufix, description);
- assertEquals("2.4b" + sufix, xmlType, description.getContentType());
- assertEquals("2.4c" + sufix, "UTF-16", description.getProperty(IContentDescription.CHARSET));
- assertTrue("2.4d" + sufix, text || IContentDescription.BOM_UTF_16BE == description.getProperty(IContentDescription.BYTE_ORDER_MARK));
- assertNotSame("2.4e", xmlType.getDefaultDescription(), description);
-
- description = getDescriptionFor(finder, XML_UTF_16BE, "UTF-8", "foo.xml", new QualifiedName[] {IContentDescription.CHARSET}, text);
- assertNotNull("2.5a" + sufix, description);
- assertEquals("2.5b" + sufix, xmlType, description.getContentType());
- assertEquals("2.5c" + sufix, "UTF-16BE", description.getProperty(IContentDescription.CHARSET));
- assertNotSame("2.5d", xmlType.getDefaultDescription(), description);
-
- description = getDescriptionFor(finder, XML_UTF_16LE, "UTF-8", "foo.xml", new QualifiedName[] {IContentDescription.CHARSET}, text);
- assertNotNull("2.6a" + sufix, description);
- assertEquals("2.6b" + sufix, xmlType, description.getContentType());
- // the default charset should have been filled by the content type manager
- assertEquals("2.6c" + sufix, "UTF-16LE", description.getProperty(IContentDescription.CHARSET));
- assertNotSame("2.6d", xmlType.getDefaultDescription(), description);
-
- description = getDescriptionFor(finder, MINIMAL_XML, "UTF-8", "foo.xml", IContentDescription.ALL, text);
- assertNotNull("4.0" + sufix, description);
- assertEquals("4.1" + sufix, xmlType, description.getContentType());
- assertEquals("4.2" + sufix, "UTF-8", description.getProperty(IContentDescription.CHARSET));
- assertNotNull("5.0" + sufix, mytext);
- assertEquals("5.0b" + sufix, "BAR", mytext.getDefaultCharset());
- assertSame("5.0c", xmlType.getDefaultDescription(), description);
-
- description = getDescriptionFor(finder, "some contents", null, "abc.tzt", IContentDescription.ALL, text);
- assertNotNull("5.1" + sufix, description);
- assertEquals("5.2" + sufix, mytext, description.getContentType());
- assertEquals("5.3" + sufix, "BAR", description.getProperty(IContentDescription.CHARSET));
- assertSame("5.4", mytext.getDefaultDescription(), description);
- // now plays with setting a non-default default charset
- mytext.setDefaultCharset("FOO");
-
- description = getDescriptionFor(finder, "some contents", null, "abc.tzt", IContentDescription.ALL, text);
- assertNotNull("5.5" + sufix, description);
- assertEquals("5.6" + sufix, mytext, description.getContentType());
- assertEquals("5.7" + sufix, "FOO", description.getProperty(IContentDescription.CHARSET));
- assertSame("5.8", mytext.getDefaultDescription(), description);
- mytext.setDefaultCharset(null);
-
- description = getDescriptionFor(finder, "some contents", null, "abc.tzt", IContentDescription.ALL, text);
- assertNotNull("5.10" + sufix, description);
- assertEquals("5.11" + sufix, mytext, description.getContentType());
- assertEquals("5.12" + sufix, "BAR", description.getProperty(IContentDescription.CHARSET));
- assertSame("5.13", mytext.getDefaultDescription(), description);
- }
- assertNotNull("6.0", mytext1);
- assertEquals("6.1", "BAR", mytext1.getDefaultCharset());
- assertNotNull("6.2", mytext2);
- assertEquals("6.3", null, mytext2.getDefaultCharset());
-
- }
-
- /**
- * @see IContentTypeMatcher#findContentTypeFor
- */
- public void testContentDetection() throws IOException {
- IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
- IContentTypeMatcher finder;
-
- IContentType inappropriate = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".sample-binary1");
- IContentType appropriate = contentTypeManager.getContentType(Platform.PI_RUNTIME + ".xml");
- IContentType appropriateSpecific1 = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".xml-based-different-extension");
- IContentType appropriateSpecific1LowPriority = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".xml-based-different-extension-low-priority");
- IContentType appropriateSpecific2 = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".xml-based-specific-name");
-
- // if only inappropriate is provided, none will be selected
- finder = contentTypeManager.getMatcher(new SubsetSelectionPolicy(new IContentType[] {inappropriate}), null);
- assertNull("1.0", finder.findContentTypeFor(getInputStream(MINIMAL_XML), null));
-
- // if inappropriate and appropriate are provided, appropriate will be selected
- finder = contentTypeManager.getMatcher(new SubsetSelectionPolicy(new IContentType[] {inappropriate, appropriate}), null);
- assertEquals("2.0", appropriate, finder.findContentTypeFor(getInputStream(MINIMAL_XML), null));
-
- // if inappropriate, appropriate and a more specific appropriate type are provided, the specific type will be selected
- finder = contentTypeManager.getMatcher(new SubsetSelectionPolicy(new IContentType[] {inappropriate, appropriate, appropriateSpecific1}), null);
- assertEquals("3.0", appropriateSpecific1, finder.findContentTypeFor(getInputStream(MINIMAL_XML), null));
- finder = contentTypeManager.getMatcher(new SubsetSelectionPolicy(new IContentType[] {inappropriate, appropriate, appropriateSpecific2}), null);
- assertEquals("3.1", appropriateSpecific2, finder.findContentTypeFor(getInputStream(MINIMAL_XML), null));
-
- // if all are provided, the more specific types will appear before the more generic types
- finder = contentTypeManager.getMatcher(new SubsetSelectionPolicy(new IContentType[] {inappropriate, appropriate, appropriateSpecific1, appropriateSpecific2}), null);
- IContentType[] selected = finder.findContentTypesFor(getInputStream(MINIMAL_XML), null);
- assertEquals("4.0", 3, selected.length);
- assertTrue("4.1", appropriateSpecific1.equals(selected[0]) || appropriateSpecific1.equals(selected[1]));
- assertTrue("4.2", appropriateSpecific2.equals(selected[0]) || appropriateSpecific2.equals(selected[1]));
- assertTrue("4.3", appropriate.equals(selected[2]));
-
- // if appropriate and a more specific appropriate type (but with low priority) are provided, the specific type will be selected
- finder = contentTypeManager.getMatcher(new SubsetSelectionPolicy(new IContentType[] {appropriate, appropriateSpecific1LowPriority}), null);
- assertEquals("5.0", appropriateSpecific1LowPriority, finder.findContentTypeFor(getInputStream(MINIMAL_XML), null));
-
- // if appropriate and two specific appropriate types (but one with lower priority) are provided, the specific type with higher priority will be selected
- finder = contentTypeManager.getMatcher(new SubsetSelectionPolicy(new IContentType[] {appropriate, appropriateSpecific1, appropriateSpecific1LowPriority}), null);
- assertEquals("5.1", appropriateSpecific1, finder.findContentTypeFor(getInputStream(MINIMAL_XML), null));
- }
-
- public void testDefaultProperties() throws IOException /* never actually thrown */{
- IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
-
- IContentType mytext = contentTypeManager.getContentType(PI_RUNTIME_TESTS + '.' + "mytext");
- IContentType mytext1 = contentTypeManager.getContentType(PI_RUNTIME_TESTS + '.' + "mytext1");
- IContentType mytext2 = contentTypeManager.getContentType(PI_RUNTIME_TESTS + '.' + "mytext2");
- assertNotNull("0.1", mytext);
- assertNotNull("0.2", mytext1);
- assertNotNull("0.3", mytext2);
-
- QualifiedName charset = IContentDescription.CHARSET;
- QualifiedName localCharset = new QualifiedName(PI_RUNTIME_TESTS, "charset");
- QualifiedName property1 = new QualifiedName(PI_RUNTIME_TESTS, "property1");
- QualifiedName property2 = new QualifiedName(PI_RUNTIME_TESTS, "property2");
- QualifiedName property3 = new QualifiedName(PI_RUNTIME_TESTS, "property3");
- QualifiedName property4 = new QualifiedName(PI_RUNTIME_TESTS, "property4");
-
- IContentDescription description;
- IContentTypeMatcher finder = contentTypeManager.getMatcher(new LocalSelectionPolicy(), null);
-
- description = getDescriptionFor(finder, "some contents", null, "abc.tzt", IContentDescription.ALL, true);
- assertNotNull("1.0", description);
- assertEquals("1.1", mytext, description.getContentType());
- assertEquals("1.2", "value1", description.getProperty(property1));
- assertNull("1.3", description.getProperty(property2));
- assertEquals("1.4", "value3", description.getProperty(property3));
- assertEquals("1.5", "BAR", description.getProperty(charset));
-
- description = getDescriptionFor(finder, "some contents", null, "abc.tzt1", IContentDescription.ALL, true);
- assertNotNull("2.0", description);
- assertEquals("2.1", mytext1, description.getContentType());
- assertEquals("2.2", "value1", description.getProperty(property1));
- assertEquals("2.3", "value2", description.getProperty(property2));
- assertNull("2.4", description.getProperty(property3));
- assertEquals("2.5", "value4", description.getProperty(property4));
- assertEquals("2.6", "BAR", description.getProperty(charset));
-
- description = getDescriptionFor(finder, "some contents", null, "abc.tzt2", IContentDescription.ALL, true);
- assertNotNull("3.0", description);
- assertEquals("3.1", mytext2, description.getContentType());
- assertNull("3.2", description.getProperty(property1));
- assertNull("3.3", description.getProperty(property2));
- assertNull("3.4", description.getProperty(property3));
- assertNull("3.5", description.getProperty(property4));
- assertNull("3.6", description.getProperty(charset));
- assertEquals("3.7", "mytext2", description.getProperty(localCharset));
- }
-
- /**
- * The fooBar content type is associated with the "foo.bar" file name and
- * the "bar" file extension (what is bogus, anyway). This test ensures it
- * does not appear twice in the list of content types associated with the
- * "foo.bar" file name.
- */
- public void testDoubleAssociation() {
- IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
-
- IContentType fooBarType = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + '.' + "fooBar");
- assertNotNull("1.0", fooBarType);
- IContentType subFooBarType = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + '.' + "subFooBar");
- assertNotNull("1.1", subFooBarType);
- // ensure we don't get fooBar twice
- IContentTypeMatcher finder = contentTypeManager.getMatcher(new LocalSelectionPolicy(), null);
- IContentType[] fooBarAssociated = finder.findContentTypesFor(changeCase("foo.bar"));
- assertEquals("2.1", 2, fooBarAssociated.length);
- assertTrue("2.2", contains(fooBarAssociated, fooBarType));
- assertTrue("2.3", contains(fooBarAssociated, subFooBarType));
- }
-
- /**
- * Obtains a reference to a known content type, then installs a bundle that contributes a content type,
- * and makes sure a new obtained reference to the same content type is not identical (shows
- * that the content type catalog has been discarded and rebuilt). Then uninstalls that bundle
- * and checks again the same thing (because the content type catalog should be rebuilt whenever
- * content types are dynamicaly added/removed).
- */
- public void testDynamicChanges() {
- final IContentType[] text = new IContentType[4];
- final IContentTypeManager manager = Platform.getContentTypeManager();
- text[0] = manager.getContentType(IContentTypeManager.CT_TEXT);
- assertNotNull("1.0", text[0]);
- text[1] = manager.getContentType(IContentTypeManager.CT_TEXT);
- assertNotNull("1.1", text[1]);
- text[0] = ((ContentTypeHandler) text[0]).getTarget();
- text[1] = ((ContentTypeHandler) text[1]).getTarget();
- assertEquals("2.0", text[0], text[1]);
- assertTrue("2.1", text[0] == text[1]);
- // make arbitrary dynamic changes to the contentTypes extension point
- TestRegistryChangeListener listener = new TestRegistryChangeListener(Platform.PI_RUNTIME, ContentTypeBuilder.PT_CONTENTTYPES, null, null);
- BundleTestingHelper.runWithBundles("3", new Runnable() {
- public void run() {
- IContentType missing = manager.getContentType("org.eclipse.bundle01.missing");
- assertNotNull("3.1", missing);
- // ensure the content type instances are different
- text[2] = manager.getContentType(IContentTypeManager.CT_TEXT);
- assertNotNull("3.2", text[2]);
- text[2] = ((ContentTypeHandler) text[2]).getTarget();
- assertEquals("3.3", text[0], text[2]);
- assertTrue("3.4", text[0] != text[2]);
- }
- }, RuntimeTestsPlugin.getContext(), new String[] {RuntimeTestsPlugin.TEST_FILES_ROOT + "content/bundle01"}, listener);
- assertNull("4.0", manager.getContentType("org.eclipse.bundle01.missing"));
- // ensure the content type instances are all different
- text[3] = manager.getContentType(IContentTypeManager.CT_TEXT);
- assertNotNull("5.0", text[3]);
- text[3] = ((ContentTypeHandler) text[3]).getTarget();
- assertEquals("5.1", text[0], text[3]);
- assertEquals("5.2", text[2], text[3]);
- assertTrue("5.3", text[0] != text[3]);
- assertTrue("5.4", text[2] != text[3]);
- }
-
- public void testEvents() {
- IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
- IContentType myType = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".myContent");
- assertNotNull("0.9", myType);
-
- ContentTypeChangeTracer tracer;
-
- tracer = new ContentTypeChangeTracer();
- contentTypeManager.addContentTypeChangeListener(tracer);
-
- // add a file spec and check event
- try {
- myType.addFileSpec("another.file.name", IContentType.FILE_NAME_SPEC);
- } catch (CoreException e) {
- fail("1.0", e);
- }
- assertTrue("1.1", tracer.isOnlyChange(myType));
-
- // remove a non-existing file spec - should not cause an event to be fired
- tracer.reset();
- try {
- myType.removeFileSpec("another.file.name", IContentType.FILE_EXTENSION_SPEC);
- } catch (CoreException e) {
- fail("2.0", e);
- }
- assertTrue("2.1", !tracer.isOnlyChange(myType));
-
- // add a file spec again and check no event is generated
- tracer.reset();
- try {
- myType.addFileSpec("another.file.name", IContentType.FILE_NAME_SPEC);
- } catch (CoreException e) {
- fail("3.0", e);
- }
- assertTrue("3.1", !tracer.isOnlyChange(myType));
-
- // remove a file spec and check event
- tracer.reset();
- try {
- myType.removeFileSpec("another.file.name", IContentType.FILE_NAME_SPEC);
- } catch (CoreException e) {
- fail("4.0", e);
- }
- assertTrue("4.1", tracer.isOnlyChange(myType));
-
- // change the default charset and check event
- tracer.reset();
- try {
- myType.setDefaultCharset("FOO");
- } catch (CoreException e) {
- fail("5.0", e);
- }
- assertTrue("5.1", tracer.isOnlyChange(myType));
-
- // set the default charset to the same - no event should be generated
- tracer.reset();
- try {
- myType.setDefaultCharset("FOO");
- } catch (CoreException e) {
- fail("6.0", e);
- }
- assertTrue("6.1", !tracer.isOnlyChange(myType));
-
- try {
- myType.setDefaultCharset("ABC");
- } catch (CoreException e1) {
- fail("7.0", e1);
- }
- }
-
- public void testFileSpecConflicts() {
- IContentTypeManager manager = Platform.getContentTypeManager();
- // when not submitting contents, for related types, most general type prevails
- IContentType conflict1a = manager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".base_conflict1");
- IContentType conflict1b = manager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".sub_conflict1");
- assertNotNull("1.0", conflict1a);
- assertNotNull("1.1", conflict1b);
- IContentType preferredConflict1 = manager.findContentTypeFor("test.conflict1");
- assertNotNull("1.2", preferredConflict1);
- assertEquals("1.3", conflict1a, preferredConflict1);
-
- IContentType conflict2base = manager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".base_conflict2");
- IContentType conflict2sub = manager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".sub_conflict2");
- assertNotNull("2.0", conflict2base);
- assertNotNull("2.1", conflict2sub);
- // when submitting contents, for related types, descendant comes first
- IContentType[] selectedConflict2;
- try {
- selectedConflict2 = manager.findContentTypesFor(getRandomContents(), "test.conflict2");
- assertEquals("2.2", 2, selectedConflict2.length);
- assertEquals("2.3", selectedConflict2[0], conflict2base);
- assertEquals("2.4", selectedConflict2[1], conflict2sub);
- } catch (IOException e) {
- fail("2.5", e);
- }
-
- IContentType conflict3base = manager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".base_conflict3");
- IContentType conflict3sub = manager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".sub_conflict3");
- IContentType conflict3unrelated = manager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".unrelated_conflict3");
- assertNotNull("3.0.1", conflict3base);
- assertNotNull("3.0.2", conflict3sub);
- assertNotNull("3.0.3", conflict3unrelated);
-
- // Two unrelated types (sub_conflict3 and unrelated conflict3) are in conflict.
- // Order will be based on depth (more general first since they don't have describers)
-
- IContentType[] selectedConflict3;
- try {
- selectedConflict3 = manager.findContentTypesFor(getRandomContents(), "test.conflict3");
- assertEquals("4.0", 2, selectedConflict3.length);
- assertEquals("4.1", selectedConflict3[0], conflict3unrelated);
- assertEquals("4.2", selectedConflict3[1], conflict3sub);
- } catch (IOException e) {
- fail("4.3", e);
- }
- }
-
- public void testFindContentType() throws UnsupportedEncodingException, IOException {
- IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
- IContentTypeMatcher finder = contentTypeManager.getMatcher(new LocalSelectionPolicy(), null);
-
- IContentType textContentType = contentTypeManager.getContentType(Platform.PI_RUNTIME + '.' + "text");
- IContentType xmlContentType = contentTypeManager.getContentType(Platform.PI_RUNTIME + ".xml");
-
- IContentType single;
-
- single = finder.findContentTypeFor(getInputStream("Just a test"), changeCase("file.txt"));
- assertNotNull("1.0", single);
- assertEquals("1.1", textContentType, single);
-
- single = finder.findContentTypeFor(getInputStream(XML_UTF_8, "UTF-8"), changeCase("foo.xml"));
- assertNotNull("2.0", single);
- assertEquals("2.1", xmlContentType, single);
-
- IContentType[] multiple = finder.findContentTypesFor(getInputStream(XML_UTF_8, "UTF-8"), null);
- assertTrue("3.0", contains(multiple, xmlContentType));
- }
-
- public void testInvalidMarkup() {
- final IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
- IContentTypeMatcher finder = contentTypeManager.getMatcher(new LocalSelectionPolicy(), null);
- assertEquals("1.0", 0, finder.findContentTypesFor("invalid.missing.identifier").length);
- assertEquals("2.0", 0, finder.findContentTypesFor("invalid.missing.name").length);
- assertNull("3.0", contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + '.' + "invalid-missing-name"));
- TestRegistryChangeListener listener = new TestRegistryChangeListener(Platform.PI_RUNTIME, ContentTypeBuilder.PT_CONTENTTYPES, null, null);
- BundleTestingHelper.runWithBundles("1", new Runnable() {
- public void run() {
- // ensure the invalid content types are not available
- assertEquals("1.2", 0, contentTypeManager.findContentTypesFor("invalid.missing.identifier").length);
- assertEquals("1.3", 0, contentTypeManager.findContentTypesFor("invalid.missing.name").length);
- assertNull("1.4", contentTypeManager.getContentType("org.eclipse.bundle03.invalid-missing-name"));
- // this content type has good markup, but invalid describer class
- IContentType invalidDescriber = contentTypeManager.getContentType("org.eclipse.bundle03.invalid-describer");
- assertNotNull("1.5", invalidDescriber);
- // name based matching should work fine
- assertEquals("1.6", invalidDescriber, contentTypeManager.findContentTypeFor("invalid.describer"));
- try {
- // the describer class is invalid, content matchong should fail
- assertNull("1.7", contentTypeManager.findContentTypeFor(getRandomContents(), "invalid.describer"));
- } catch (IOException e) {
- fail("1.8", e);
- }
- }
- }, RuntimeTestsPlugin.getContext(), new String[] {RuntimeTestsPlugin.TEST_FILES_ROOT + "content/bundle03"}, listener);
- }
-
- /**
- * Bugs 67841 and 62443
- */
- public void testIOException() {
- ContentTypeManager manager = ContentTypeManager.getInstance();
- IContentType xml = manager.getContentType(Platform.PI_RUNTIME + ".xml");
- IContentType rootElement = manager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".root-element");
- IContentType[] selected = null;
- try {
- selected = manager.findContentTypesFor(getInputStream(XML_US_ASCII_INVALID, "ISO-8859-1"), "test.xml");
- } catch (IOException ioe) {
- // a SAXException is usually caught (and silently ignored) in XMLRootElementDescriber in these cases
- fail("1.0", ioe);
- }
- assertTrue("1.1", contains(selected, xml));
- assertTrue("1.2", contains(selected, rootElement));
-
- // induce regular IOExceptions... these should be thrown to clients
- class FakeIOException extends IOException {
- /**
- * All serializable objects should have a stable serialVersionUID
- */
- private static final long serialVersionUID = 1L;
-
- public String getMessage() {
- return "This exception was thrown for testing purposes";
- }
- }
- try {
- selected = manager.findContentTypesFor(new InputStream() {
-
- public int available() throws IOException {
- // trick the client into reading the file
- return Integer.MAX_VALUE;
- }
-
- public int read() throws IOException {
- throw new FakeIOException();
- }
-
- public int read(byte[] b, int off, int len) throws IOException {
- throw new FakeIOException();
- }
- }, "test.xml");
- // an exception will happen when reading the stream... should be thrown to the caller
- fail("2.0");
- } catch (FakeIOException fioe) {
- // sucess
- } catch (IOException ioe) {
- // this should never happen, but just in case...
- fail("2.1");
- }
- }
-
- public void testIsKindOf() {
- IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
- IContentType textContentType = contentTypeManager.getContentType(Platform.PI_RUNTIME + '.' + "text");
- IContentType xmlContentType = contentTypeManager.getContentType(Platform.PI_RUNTIME + ".xml");
- IContentType xmlBasedDifferentExtensionContentType = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + '.' + "xml-based-different-extension");
- IContentType xmlBasedSpecificNameContentType = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + '.' + "xml-based-specific-name");
- IContentType binaryContentType = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + '.' + "sample-binary1");
- assertTrue("1.0", textContentType.isKindOf(textContentType));
- assertTrue("2.0", xmlContentType.isKindOf(textContentType));
- assertTrue("2.1", !textContentType.isKindOf(xmlContentType));
- assertTrue("2.2", xmlContentType.isKindOf(xmlContentType));
- assertTrue("3.0", xmlBasedDifferentExtensionContentType.isKindOf(textContentType));
- assertTrue("3.1", xmlBasedDifferentExtensionContentType.isKindOf(xmlContentType));
- assertTrue("4.0", !xmlBasedDifferentExtensionContentType.isKindOf(xmlBasedSpecificNameContentType));
- assertTrue("5.0", !binaryContentType.isKindOf(textContentType));
- }
-
- public void testListParsing() {
- String[] list;
- list = Util.parseItems(null);
- assertEquals("0.0", 0, list.length);
- list = Util.parseItems("");
- assertEquals("1.0", 1, list.length);
- assertEquals("1.1", "", list[0]);
- list = Util.parseItems("foo");
- assertEquals("2.0", 1, list.length);
- assertEquals("2.1", "foo", list[0]);
- list = Util.parseItems(",");
- assertEquals("3.0", 2, list.length);
- assertEquals("3.1", "", list[0]);
- assertEquals("3.2", "", list[1]);
- list = Util.parseItems(",foo,bar");
- assertEquals("4.0", 3, list.length);
- assertEquals("4.1", "", list[0]);
- assertEquals("4.2", "foo", list[1]);
- assertEquals("4.3", "bar", list[2]);
- list = Util.parseItems("foo,bar,");
- assertEquals("5.0", 3, list.length);
- assertEquals("5.1", "foo", list[0]);
- assertEquals("5.2", "bar", list[1]);
- assertEquals("5.3", "", list[2]);
- list = Util.parseItems("foo,,bar");
- assertEquals("6.0", 3, list.length);
- assertEquals("6.1", "foo", list[0]);
- assertEquals("6.2", "", list[1]);
- assertEquals("6.3", "bar", list[2]);
- list = Util.parseItems("foo,,,bar");
- assertEquals("7.0", 4, list.length);
- assertEquals("7.1", "foo", list[0]);
- assertEquals("7.2", "", list[1]);
- assertEquals("7.3", "", list[2]);
- assertEquals("7.4", "bar", list[3]);
- list = Util.parseItems(",,foo,bar");
- assertEquals("8.0", 4, list.length);
- assertEquals("8.1", "", list[0]);
- assertEquals("8.2", "", list[1]);
- assertEquals("8.3", "foo", list[2]);
- assertEquals("8.4", "bar", list[3]);
- list = Util.parseItems("foo,bar,,");
- assertEquals("9.0", 4, list.length);
- assertEquals("9.1", "foo", list[0]);
- assertEquals("9.2", "bar", list[1]);
- assertEquals("9.3", "", list[2]);
- assertEquals("9.4", "", list[3]);
- list = Util.parseItems(",,,");
- assertEquals("10.0", 4, list.length);
- assertEquals("10.1", "", list[0]);
- assertEquals("10.2", "", list[1]);
- assertEquals("10.3", "", list[2]);
- assertEquals("10.4", "", list[3]);
- }
-
- public void testMyContentDescriber() throws UnsupportedEncodingException, IOException {
- IContentTypeManager manager = Platform.getContentTypeManager();
- IContentType myContent = manager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + '.' + "myContent");
- assertNotNull("0.5", myContent);
- assertEquals("0.6", myContent, manager.findContentTypeFor("myContent.mc1"));
- assertEquals("0.7", myContent, manager.findContentTypeFor("myContent.mc2"));
- assertEquals("0.8", myContent, manager.findContentTypeFor("foo.myContent1"));
- assertEquals("0.9", myContent, manager.findContentTypeFor("bar.myContent2"));
- IContentDescription description = manager.getDescriptionFor(getInputStream(MyContentDescriber.SIGNATURE, "US-ASCII"), "myContent.mc1", IContentDescription.ALL);
- assertNotNull("1.0", description);
- assertEquals("1.1", myContent, description.getContentType());
- assertNotSame("1.2", myContent.getDefaultDescription(), description);
- for (int i = 0; i < MyContentDescriber.MY_OPTIONS.length; i++)
- assertEquals("2." + i, MyContentDescriber.MY_OPTION_VALUES[i], description.getProperty(MyContentDescriber.MY_OPTIONS[i]));
- }
-
- public void testNoExtensionAssociation() throws CoreException {
- //TODO use a IContentTypeMatcher instead
- final IContentTypeManager manager = Platform.getContentTypeManager();
-
- IContentType[] selected = manager.findContentTypesFor("file_with_no_extension");
- assertEquals("0.1", 0, selected.length);
-
- TestRegistryChangeListener listener = new TestRegistryChangeListener(Platform.PI_RUNTIME, ContentTypeBuilder.PT_CONTENTTYPES, null, null);
- BundleTestingHelper.runWithBundles("1", new Runnable() {
- public void run() {
- final String namespace = "org.eclipse.bundle04";
-
- IContentType empty1 = manager.getContentType(namespace + ".empty_extension1");
- IContentType empty2 = manager.getContentType(namespace + ".empty_extension2");
- IContentType empty3 = manager.getContentType(namespace + ".empty_extension3");
- IContentType empty4 = manager.getContentType(namespace + ".empty_extension4");
- IContentType nonEmpty = manager.getContentType(namespace + ".non_empty_extension");
-
- assertNotNull("1.1.1", empty1);
- assertNotNull("1.1.2", empty2);
- assertNotNull("1.1.3", empty3);
- assertNotNull("1.1.4", empty4);
- assertNotNull("1.1.5", nonEmpty);
-
- IContentType[] selected = manager.findContentTypesFor("file_with_no_extension");
- assertEquals("1.2.0", 4, selected.length);
- assertTrue("1.2.1", contains(selected, empty1));
- assertTrue("1.2.2", contains(selected, empty2));
- assertTrue("1.2.3", contains(selected, empty3));
- assertTrue("1.2.4", contains(selected, empty4));
-
- selected = manager.findContentTypesFor("file_with_extension.non-empty");
- assertEquals("1.2.5", 1, selected.length);
- assertTrue("1.2.6", contains(selected, nonEmpty));
-
- try {
- nonEmpty.addFileSpec("", IContentType.FILE_EXTENSION_SPEC);
- } catch (CoreException e) {
- fail("1.3.0", e);
- }
- try {
- selected = manager.findContentTypesFor("file_with_no_extension");
- assertEquals("1.3.1", 5, selected.length);
- assertTrue("1.3.2", contains(selected, nonEmpty));
- } finally {
- try {
- nonEmpty.removeFileSpec("", IContentType.FILE_EXTENSION_SPEC);
- } catch (CoreException e) {
- fail("1.3.3", e);
- }
- }
- selected = manager.findContentTypesFor("file_with_no_extension");
- assertEquals("1.4.0", 4, selected.length);
- assertTrue("1.4.1", !contains(selected, nonEmpty));
- }
- }, getContext(), new String[] {RuntimeTestsPlugin.TEST_FILES_ROOT + "content/bundle04"}, listener);
- }
-
- public void testOrderWithEmptyFiles() throws IOException {
- IContentTypeManager manager = Platform.getContentTypeManager();
- IContentTypeMatcher finder = manager.getMatcher(new LocalSelectionPolicy(), null);
-
- IContentType xml = manager.getContentType(Platform.PI_RUNTIME + ".xml");
- manager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".root-element");
- manager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".dtd");
- // for an empty file, the most generic content type should be returned
- IContentType selected = finder.findContentTypeFor(getInputStream(""), "foo.xml");
- assertEquals("1.0", xml, selected);
- // it should be equivalent to omitting the contents
- assertEquals("1.1", xml, finder.findContentTypeFor("foo.xml"));
- }
-
- /**
- * This test shows how we deal with orphan file associations (associations
- * whose content types are missing).
- */
- public void testOrphanContentType() {
- final IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
- IContentType orphan = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".orphan");
- assertNull("0.8", orphan);
- IContentType missing = contentTypeManager.getContentType("org.eclipse.bundle01.missing");
- assertNull("0.9", missing);
- assertEquals("1.1", 0, contentTypeManager.findContentTypesFor("foo.orphan").length);
- assertEquals("1.2", 0, contentTypeManager.findContentTypesFor("orphan.orphan").length);
- assertEquals("1.3", 0, contentTypeManager.findContentTypesFor("foo.orphan2").length);
-
- //test late addition of content type - orphan2 should become visible
- TestRegistryChangeListener listener = new TestRegistryChangeListener(Platform.PI_RUNTIME, ContentTypeBuilder.PT_CONTENTTYPES, null, null);
-
- BundleTestingHelper.runWithBundles("2", new Runnable() {
- public void run() {
- IContentType orphan = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".orphan");
- assertNotNull("2.1", orphan);
- IContentType missing = contentTypeManager.getContentType("org.eclipse.bundle01.missing");
- assertNotNull("2.2", missing);
- // checks orphan's associations
- assertEquals("2.3", 1, contentTypeManager.findContentTypesFor("foo.orphan").length);
- assertEquals("2.4", orphan, contentTypeManager.findContentTypesFor("foo.orphan")[0]);
- assertEquals("2.5", 1, contentTypeManager.findContentTypesFor("orphan.orphan").length);
- assertEquals("2.6", orphan, contentTypeManager.findContentTypesFor("foo.orphan")[0]);
- // check whether an orphan association was added to the dynamically added bundle
- assertEquals("2.7", 1, contentTypeManager.findContentTypesFor("foo.orphan2").length);
- assertEquals("2.8", missing, contentTypeManager.findContentTypesFor("foo.orphan2")[0]);
- }
- }, RuntimeTestsPlugin.getContext(), new String[] {RuntimeTestsPlugin.TEST_FILES_ROOT + "content/bundle01"}, listener);
- }
-
- /**
- * Bug 68894
- */
- public void testPreferences() throws CoreException, BackingStoreException {
- ContentTypeManager manager = ContentTypeManager.getInstance();
- IContentType text = manager.getContentType(IContentTypeManager.CT_TEXT);
- Preferences textPrefs = new InstanceScope().getNode(ContentTypeManager.CONTENT_TYPE_PREF_NODE).node(text.getId());
- assertNotNull("0.1", text);
-
- // ensure the "default charset" preference is being properly used
- assertNull("1.0", text.getDefaultCharset());
- assertNull("1.1", textPrefs.get(ContentType.PREF_DEFAULT_CHARSET, null));
- text.setDefaultCharset("UTF-8");
- assertEquals("1.2", "UTF-8", textPrefs.get(ContentType.PREF_DEFAULT_CHARSET, null));
- text.setDefaultCharset(null);
- assertNull("1.3", textPrefs.get(ContentType.PREF_DEFAULT_CHARSET, null));
-
- // ensure the file spec preferences are being properly used
- // some sanity checking
- assertFalse("2.01", text.isAssociatedWith("xyz.foo"));
- assertFalse("2.01", text.isAssociatedWith("xyz.bar"));
- assertFalse("2.03", text.isAssociatedWith("foo.ext"));
- assertFalse("2.04", text.isAssociatedWith("bar.ext"));
- // play with file name associations first...
- assertNull("2.0a", textPrefs.get(ContentType.PREF_FILE_NAMES, null));
- assertNull("2.0b", textPrefs.get(ContentType.PREF_FILE_EXTENSIONS, null));
- text.addFileSpec("foo.ext", IContentType.FILE_NAME_SPEC);
- assertTrue("2.1", text.isAssociatedWith("foo.ext"));
- assertEquals("2.2", "foo.ext", textPrefs.get(ContentType.PREF_FILE_NAMES, null));
- text.addFileSpec("bar.ext", IContentType.FILE_NAME_SPEC);
- assertTrue("2.3", text.isAssociatedWith("bar.ext"));
- assertEquals("2.4", "foo.ext,bar.ext", textPrefs.get(ContentType.PREF_FILE_NAMES, null));
- // ... and then with file extensions
- text.addFileSpec("foo", IContentType.FILE_EXTENSION_SPEC);
- assertTrue("2.5", text.isAssociatedWith("xyz.foo"));
- assertEquals("2.6", "foo", textPrefs.get(ContentType.PREF_FILE_EXTENSIONS, null));
- text.addFileSpec("bar", IContentType.FILE_EXTENSION_SPEC);
- assertTrue("2.7", text.isAssociatedWith("xyz.bar"));
- assertEquals("2.4", "foo,bar", textPrefs.get(ContentType.PREF_FILE_EXTENSIONS, null));
- // remove all associations made
- text.removeFileSpec("foo.ext", IContentType.FILE_NAME_SPEC);
- text.removeFileSpec("bar.ext", IContentType.FILE_NAME_SPEC);
- text.removeFileSpec("foo", IContentType.FILE_EXTENSION_SPEC);
- text.removeFileSpec("bar", IContentType.FILE_EXTENSION_SPEC);
- // ensure all is as before
- assertFalse("3.1", text.isAssociatedWith("xyz.foo"));
- assertFalse("3.2", text.isAssociatedWith("xyz.bar"));
- assertFalse("3.3", text.isAssociatedWith("foo.ext"));
- assertFalse("3.4", text.isAssociatedWith("bar.ext"));
-
- // ensure the serialization format is correct
- try {
- text.addFileSpec("foo.bar", IContentType.FILE_NAME_SPEC);
- textPrefs.sync();
- assertEquals("4.0", "foo.bar", textPrefs.get(ContentType.PREF_FILE_NAMES, null));
- } finally {
- // clean-up
- text.removeFileSpec("foo.bar", IContentType.FILE_NAME_SPEC);
- }
- }
-
- public void testRegistry() {
- IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
- IContentTypeMatcher finder = contentTypeManager.getMatcher(new LocalSelectionPolicy(), null);
-
- IContentType textContentType = contentTypeManager.getContentType(Platform.PI_RUNTIME + '.' + "text");
- assertNotNull("1.0", textContentType);
- assertTrue("1.1", isText(contentTypeManager, textContentType));
- assertNotNull("1.2", ((ContentTypeHandler) textContentType).getTarget().getDescriber());
-
- IContentType xmlContentType = contentTypeManager.getContentType(Platform.PI_RUNTIME + ".xml");
- assertNotNull("2.0", xmlContentType);
- assertTrue("2.1", isText(contentTypeManager, xmlContentType));
- assertEquals("2.2", textContentType, xmlContentType.getBaseType());
- IContentDescriber xmlDescriber = ((ContentTypeHandler) xmlContentType).getTarget().getDescriber();
- assertNotNull("2.3", xmlDescriber);
- assertTrue("2.4", xmlDescriber instanceof XMLContentDescriber);
-
- IContentType xmlBasedDifferentExtensionContentType = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + '.' + "xml-based-different-extension");
- assertNotNull("3.0", xmlBasedDifferentExtensionContentType);
- assertTrue("3.1", isText(contentTypeManager, xmlBasedDifferentExtensionContentType));
- assertEquals("3.2", xmlContentType, xmlBasedDifferentExtensionContentType.getBaseType());
-
- IContentType xmlBasedSpecificNameContentType = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + '.' + "xml-based-specific-name");
- assertNotNull("4.0", xmlBasedSpecificNameContentType);
- assertTrue("4.1", isText(contentTypeManager, xmlBasedSpecificNameContentType));
- assertEquals("4.2", xmlContentType, xmlBasedSpecificNameContentType.getBaseType());
-
- IContentType[] xmlTypes = finder.findContentTypesFor(changeCase("foo.xml"));
- assertTrue("5.1", contains(xmlTypes, xmlContentType));
-
- IContentType binaryContentType = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + '.' + "sample-binary1");
- assertNotNull("6.0", binaryContentType);
- assertTrue("6.1", !isText(contentTypeManager, binaryContentType));
- assertNull("6.2", binaryContentType.getBaseType());
-
- IContentType[] binaryTypes = finder.findContentTypesFor(changeCase("foo.samplebin1"));
- assertEquals("7.0", 1, binaryTypes.length);
- assertEquals("7.1", binaryContentType, binaryTypes[0]);
-
- IContentType myText = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".mytext");
- assertNotNull("8.0", myText);
- assertEquals("8.1", "BAR", myText.getDefaultCharset());
-
- IContentType[] fooBarTypes = finder.findContentTypesFor(changeCase("foo.bar"));
- assertEquals("9.0", 2, fooBarTypes.length);
-
- IContentType fooBar = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".fooBar");
- assertNotNull("9.1", fooBar);
- IContentType subFooBar = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".subFooBar");
- assertNotNull("9.2", subFooBar);
- assertTrue("9.3", contains(fooBarTypes, fooBar));
- assertTrue("9.4", contains(fooBarTypes, subFooBar));
- }
-
- public void testRootElementAndDTDDescriber() throws IOException {
- IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
- IContentType rootElement = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".root-element");
- IContentType dtdElement = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".dtd");
- IContentType nsRootElement = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".ns-root-element");
- IContentType nsWildcard = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".ns-wildcard");
- IContentType emptyNsRootElement = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".empty-ns-root-element");
- IContentType xmlType = contentTypeManager.getContentType(Platform.PI_RUNTIME + ".xml");
-
- IContentType[] contentTypes = contentTypeManager.findContentTypesFor(getInputStream(XML_ROOT_ELEMENT_ISO_8859_1, "ISO-8859-1"), "fake.xml");
- assertTrue("1.0", contentTypes.length > 0);
- assertEquals("1.1", rootElement, contentTypes[0]);
-
- // bugs 64053 and 63298
- contentTypes = contentTypeManager.findContentTypesFor(getInputStream(XML_ROOT_ELEMENT_EXTERNAL_ENTITY, "UTF-8"), "fake.xml");
- assertTrue("2.0", contentTypes.length > 0);
- assertEquals("2.1", rootElement, contentTypes[0]);
-
- // bug 63625
- contentTypes = contentTypeManager.findContentTypesFor(getInputStream(XML_ROOT_ELEMENT_EXTERNAL_ENTITY2, "UTF-8"), "fake.xml");
- assertTrue("3.0", contentTypes.length > 0);
- assertEquals("3.1", rootElement, contentTypes[0]);
-
- // bug 135575
- contentTypes = contentTypeManager.findContentTypesFor(getInputStream(XML_ROOT_ELEMENT_NS_MATCH1, "UTF-8"), "fake.xml");
- assertTrue("4.0", contentTypes.length > 0);
- assertEquals("4.1", nsRootElement, contentTypes[0]);
- contentTypes = contentTypeManager.findContentTypesFor(getInputStream(XML_ROOT_ELEMENT_NS_MATCH2, "UTF-8"), "fake.xml");
- assertTrue("4.2", contentTypes.length > 0);
- assertEquals("4.3", nsRootElement, contentTypes[0]);
- contentTypes = contentTypeManager.findContentTypesFor(getInputStream(XML_ROOT_ELEMENT_NS_WRONG_ELEM, "UTF-8"), "fake.xml");
- assertTrue("4.4", contentTypes.length > 0);
- assertEquals("4.5", xmlType, contentTypes[0]);
- contentTypes = contentTypeManager.findContentTypesFor(getInputStream(XML_ROOT_ELEMENT_NS_WRONG_NS, "UTF-8"), "fake.xml");
- assertTrue("4.6", contentTypes.length > 0);
- assertEquals("4.7", xmlType, contentTypes[0]);
- contentTypes = contentTypeManager.findContentTypesFor(getInputStream(XML_ROOT_ELEMENT_NS_MIXUP, "UTF-8"), "fake.xml");
- assertTrue("4.8", contentTypes.length > 0);
- assertEquals("4.9", xmlType, contentTypes[0]);
- contentTypes = contentTypeManager.findContentTypesFor(getInputStream(XML_ROOT_ELEMENT_NS_WILDCARD, "UTF-8"), "fake.xml");
- assertTrue("4.10", contentTypes.length > 0);
- assertEquals("4.11", nsWildcard, contentTypes[0]);
- contentTypes = contentTypeManager.findContentTypesFor(getInputStream(XML_ROOT_ELEMENT_NS_WILDCARD2, "UTF-8"), "fake.xml");
- assertTrue("4.12", contentTypes.length > 0);
- assertEquals("4.13", nsWildcard, contentTypes[0]);
- contentTypes = contentTypeManager.findContentTypesFor(getInputStream(XML_ROOT_ELEMENT_EMPTY_NS, "UTF-8"), "fake.xml");
- assertTrue("4.14", contentTypes.length > 0);
- assertEquals("4.15", emptyNsRootElement, contentTypes[0]);
-
- contentTypes = contentTypeManager.findContentTypesFor(getInputStream(XML_DTD_US_ASCII, "US-ASCII"), "fake.xml");
- assertTrue("5.0", contentTypes.length > 0);
- assertEquals("5.1", dtdElement, contentTypes[0]);
- contentTypes = contentTypeManager.findContentTypesFor(getInputStream(XML_DTD_EXTERNAL_ENTITY, "UTF-8"), "fake.xml");
- assertTrue("5.4", contentTypes.length > 0);
- assertEquals("5.5", dtdElement, contentTypes[0]);
-
- // bug 67975
- IContentDescription description = contentTypeManager.getDescriptionFor(getInputStream(new byte[][] {IContentDescription.BOM_UTF_16BE, XML_ROOT_ELEMENT_NO_DECL.getBytes("UTF-16BE")}), "fake.xml", IContentDescription.ALL);
- assertTrue("6.0", description != null);
- assertEquals("6.1", rootElement, description.getContentType());
- assertEquals("6.2", IContentDescription.BOM_UTF_16BE, description.getProperty(IContentDescription.BYTE_ORDER_MARK));
-
- description = contentTypeManager.getDescriptionFor(getInputStream(new byte[][] {IContentDescription.BOM_UTF_16LE, XML_ROOT_ELEMENT_NO_DECL.getBytes("UTF-16LE")}), "fake.xml", IContentDescription.ALL);
- assertTrue("7.0", description != null);
- assertEquals("7.1", rootElement, description.getContentType());
- assertEquals("7.2", IContentDescription.BOM_UTF_16LE, description.getProperty(IContentDescription.BYTE_ORDER_MARK));
-
- // due to bug 67048, the test below fails with Crimson parser (does not handle UTF-8 BOMs)
- // description = contentTypeManager.getDescriptionFor(getInputStream(new byte[][] {IContentDescription.BOM_UTF_8,XML_ROOT_ELEMENT_NO_DECL.getBytes("UTF-8")}), "fake.xml", IContentDescription.ALL);
- // assertTrue("7.0", description != null);
- // assertEquals("7.1", rootElement, description.getContentType());
- // assertEquals("7.2", IContentDescription.BOM_UTF_8, description.getProperty(IContentDescription.BYTE_ORDER_MARK));
-
- // bug 84354
- contentTypes = contentTypeManager.findContentTypesFor(getInputStream(XML_ROOT_ELEMENT_NO_DECL, "UTF-8"), "test.txt");
- assertTrue("8.0", contentTypes.length > 0);
- assertEquals("8.1", contentTypeManager.getContentType(IContentTypeManager.CT_TEXT), contentTypes[0]);
- }
-
- /**
- * Bug 66976
- */
- public void testSignatureBeyondBufferLimit() throws IOException {
- int bufferLimit = ContentTypeManager.BLOCK_SIZE * 4;
- // create a long XML comment as prefix
- StringBuffer comment = new StringBuffer("<!--");
- for (int i = 0; i < bufferLimit; i++)
- comment.append('*');
- comment.append("-->");
- IContentTypeManager manager = Platform.getContentTypeManager();
- IContentType rootElement = manager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".root-element");
- IContentType selected = manager.findContentTypeFor(getInputStream(comment + XML_ROOT_ELEMENT_NO_DECL, "US-ASCII"), "fake.xml");
- assertNotNull("1.0", selected);
- assertEquals("1.1", rootElement, selected);
- }
-
- /**
- * See also: bug 72796.
- */
- public void testUserDefinedAssociations() {
- IContentTypeManager manager = Platform.getContentTypeManager();
- IContentType text = manager.getContentType((Platform.PI_RUNTIME + ".text"));
-
- assertNull("0.1", manager.findContentTypeFor("test.mytext"));
- // associate a user-defined file spec
- try {
- text.addFileSpec("mytext", IContentType.FILE_EXTENSION_SPEC);
- } catch (CoreException e) {
- fail("1.0", e);
- }
- boolean assertionFailed = false;
- try {
- IContentType result = manager.findContentTypeFor("test.mytext");
- assertNotNull("1.1", result);
- assertEquals("1.2", text, result);
- } catch (AssertionFailedError afe) {
- assertionFailed = true;
- throw afe;
- } finally {
- try {
- text.removeFileSpec("mytext", IContentType.FILE_EXTENSION_SPEC);
- } catch (CoreException e) {
- if (!assertionFailed)
- fail(" 2.0", e);
- }
- }
- IContentType result = manager.findContentTypeFor("test.mytext");
- assertNull("3.0", result);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/LazyInputStreamTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/LazyInputStreamTest.java
deleted file mode 100644
index a42e6e6..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/LazyInputStreamTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.content;
-
-import java.io.*;
-import junit.framework.*;
-import org.eclipse.core.internal.content.LazyInputStream;
-
-public class LazyInputStreamTest extends TestCase {
-
- /**
- * Opens up protected methods from LazyInputStream.
- */
- private static class OpenLazyInputStream extends LazyInputStream {
-
- public OpenLazyInputStream(InputStream in, int blockCapacity) {
- super(in, blockCapacity);
- }
-
- public int getBlockCount() {
- return super.getBlockCount();
- }
-
- public int getBufferSize() {
- return super.getBufferSize();
- }
-
- public int getMark() {
- return super.getMark();
- }
-
- public int getOffset() {
- return super.getOffset();
- }
- }
-
- private final static String DATA = "012345678901234567890123456789";
-
- private final static int[] VARIOUS_INTS = {0xFF, 0xFE, 0xA0, 0x7F, 0x70, 0x10, 0x00};
-
- public LazyInputStreamTest(String name) {
- super(name);
- }
-
- public void testReadSingleByte() throws UnsupportedEncodingException, IOException {
- ByteArrayInputStream underlying = new ByteArrayInputStream(DATA.getBytes());
- OpenLazyInputStream stream = new OpenLazyInputStream(underlying, 7);
- assertEquals("1.0", '0', stream.read());
- assertEquals("1.1", '1', stream.read());
- stream.skip(10);
- assertEquals("1.2", '2', stream.read());
- assertEquals("1.3", 13, stream.getOffset());
- }
-
- public void testReadBlock() throws UnsupportedEncodingException, IOException {
- ByteArrayInputStream underlying = new ByteArrayInputStream(DATA.getBytes());
- OpenLazyInputStream stream = new OpenLazyInputStream(underlying, 7);
- stream.skip(4);
- byte[] buffer = new byte[7];
- int read = stream.read(buffer);
- assertEquals("1.0", buffer.length, read);
- assertEquals("1.1", DATA.substring(4, 4 + buffer.length), new String(buffer));
- assertEquals("1.2", 11, stream.getOffset());
- read = stream.read(buffer, 3, 4);
- assertEquals("2.0", 4, read);
- assertEquals("2.1", DATA.substring(11, 11 + read), new String(buffer, 3, read));
- assertEquals("2.2", 15, stream.getOffset());
- stream.mark(0);
- buffer = new byte[100];
- read = stream.read(buffer);
- assertEquals("3.0", DATA.length() - 15, read);
- assertEquals("3.1", DATA.substring(15, 15 + read), new String(buffer, 0, read));
- assertEquals("3.2", 0, stream.available());
- stream.reset();
- assertEquals("4.0", 15, stream.getOffset());
- read = stream.read(buffer, 10, 14);
- assertEquals("4.1", 29, stream.getOffset());
- assertEquals("4.2", 1, stream.available());
- assertEquals("4.3", 14, read);
- assertEquals("4.4", DATA.substring(15, 15 + read), new String(buffer, 10, read));
- read = stream.read(buffer);
- assertEquals("5.0", 30, stream.getOffset());
- assertEquals("5.1", 0, stream.available());
- assertEquals("5.2", 1, read);
- assertEquals("5.3", (byte) DATA.charAt(29), buffer[0]);
- read = stream.read(buffer);
- assertEquals("6.0", 30, stream.getOffset());
- assertEquals("6.1", 0, stream.available());
- assertEquals("6.2", -1, read);
- }
-
- public void testMarkAndReset() throws UnsupportedEncodingException, IOException {
- ByteArrayInputStream underlying = new ByteArrayInputStream(DATA.getBytes());
- OpenLazyInputStream stream = new OpenLazyInputStream(underlying, 7);
- assertEquals("0.1", 30, stream.available());
- stream.skip(13);
- assertEquals("0.2", 17, stream.available());
- stream.mark(0);
- assertEquals("2.0", 13, stream.getMark());
- assertEquals("2.1", '3', stream.read());
- assertEquals("2.2", '4', stream.read());
- assertEquals("2.3", 15, stream.getOffset());
- assertEquals("2.4", 15, stream.available());
- stream.reset();
- assertEquals("2.5", 17, stream.available());
- assertEquals("2.6", 13, stream.getOffset());
- stream.reset();
- assertEquals("2.7", 17, stream.available());
- assertEquals("2.8", 13, stream.getOffset());
- stream.rewind();
- assertEquals("3.0", 0, stream.getOffset());
- }
-
- public void testContentHasEOF() throws IOException {
- byte[] changedData = DATA.getBytes();
- changedData[0] = (byte) 0xFF;
- ByteArrayInputStream underlying = new ByteArrayInputStream(changedData);
- OpenLazyInputStream stream = new OpenLazyInputStream(underlying, 7);
- int c = stream.read();
- assertTrue("1.0", -1 != c);
- assertEquals("2.0", 0xFF, c);
- }
-
- public void testVariedContent() throws IOException {
- byte[] contents = new byte[VARIOUS_INTS.length];
- for (int i = 0; i < contents.length; i++)
- contents[i] = (byte) VARIOUS_INTS[i];
- ByteArrayInputStream underlying = new ByteArrayInputStream(contents);
- OpenLazyInputStream stream = new OpenLazyInputStream(underlying, 7);
- for (int i = 0; i < VARIOUS_INTS.length; i++)
- assertEquals("1.0." + i, VARIOUS_INTS[i], stream.read());
- }
-
- public static Test suite() {
- return new TestSuite(LazyInputStreamTest.class);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/LazyReaderTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/LazyReaderTest.java
deleted file mode 100644
index 861b39a..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/LazyReaderTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.content;
-
-import java.io.*;
-import junit.framework.*;
-import org.eclipse.core.internal.content.LazyReader;
-
-public class LazyReaderTest extends TestCase {
-
- /**
- * Opens up protected methods from LazyInputStream.
- */
- private static class OpenLazyReader extends LazyReader {
-
- public OpenLazyReader(Reader in, int blockCapacity) {
- super(in, blockCapacity);
- }
-
- public int getBlockCount() {
- return super.getBlockCount();
- }
-
- public int getBufferSize() {
- return super.getBufferSize();
- }
-
- public int getMark() {
- return super.getMark();
- }
-
- public int getOffset() {
- return super.getOffset();
- }
- }
-
- private final static String DATA = "012345678901234567890123456789";
-
- public LazyReaderTest(String name) {
- super(name);
- }
-
- public void testReadSingleChar() throws UnsupportedEncodingException, IOException {
- CharArrayReader underlying = new CharArrayReader(DATA.toCharArray());
- OpenLazyReader stream = new OpenLazyReader(underlying, 7);
- assertEquals("1.0", '0', stream.read());
- assertEquals("1.1", '1', stream.read());
- stream.skip(10);
- assertEquals("1.2", '2', stream.read());
- assertEquals("1.3", 13, stream.getOffset());
- }
-
- public void testReadBlock() throws UnsupportedEncodingException, IOException {
- CharArrayReader underlying = new CharArrayReader(DATA.toCharArray());
- OpenLazyReader stream = new OpenLazyReader(underlying, 7);
- stream.skip(4);
- char[] buffer = new char[7];
- int read = stream.read(buffer);
- assertEquals("1.0", buffer.length, read);
- assertEquals("1.1", DATA.substring(4, 4 + buffer.length), new String(buffer));
- assertEquals("1.2", 11, stream.getOffset());
- read = stream.read(buffer, 3, 4);
- assertEquals("2.0", 4, read);
- assertEquals("2.1", DATA.substring(11, 11 + read), new String(buffer, 3, read));
- assertEquals("2.2", 15, stream.getOffset());
- stream.mark(0);
- buffer = new char[100];
- read = stream.read(buffer);
- assertEquals("3.0", DATA.length() - 15, read);
- assertEquals("3.1", DATA.substring(15, 15 + read), new String(buffer, 0, read));
- assertFalse("3.2", stream.ready());
- stream.reset();
- assertEquals("4.0", 15, stream.getOffset());
- read = stream.read(buffer, 10, 14);
- assertEquals("4.1", 29, stream.getOffset());
- assertTrue("4.2", stream.ready());
- assertEquals("4.3", 14, read);
- assertEquals("4.4", DATA.substring(15, 15 + read), new String(buffer, 10, read));
- read = stream.read(buffer);
- assertEquals("5.0", 30, stream.getOffset());
- assertFalse("5.1", stream.ready());
- assertEquals("5.2", 1, read);
- assertEquals("5.3", (byte) DATA.charAt(29), buffer[0]);
- read = stream.read(buffer);
- assertEquals("6.0", 30, stream.getOffset());
- assertFalse("6.1", stream.ready());
- assertEquals("6.2", -1, read);
- }
-
- public void testMarkAndReset() throws UnsupportedEncodingException, IOException {
- CharArrayReader underlying = new CharArrayReader(DATA.toCharArray());
- OpenLazyReader stream = new OpenLazyReader(underlying, 7);
- assertTrue("0.1", stream.ready());
- stream.skip(13);
- assertTrue("0.2", stream.ready());
- stream.mark(0);
- assertEquals("2.0", 13, stream.getMark());
- assertEquals("2.1", '3', stream.read());
- assertEquals("2.2", '4', stream.read());
- assertEquals("2.3", 15, stream.getOffset());
- assertTrue("2.4", stream.ready());
- stream.reset();
- assertTrue("2.5", stream.ready());
- assertEquals("2.6", 13, stream.getOffset());
- assertEquals("2.7", 17, stream.skip(1000));
- assertFalse("2.8", stream.ready());
- stream.reset();
- assertTrue("2.9", stream.ready());
- assertEquals("2.10", 13, stream.getOffset());
- stream.reset();
- assertTrue("2.11", stream.ready());
- assertEquals("2.12", 13, stream.getOffset());
- stream.rewind();
- assertEquals("3.0", 0, stream.getOffset());
- }
-
- public static Test suite() {
- return new TestSuite(LazyReaderTest.class);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/LocalSelectionPolicy.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/LocalSelectionPolicy.java
deleted file mode 100644
index 7b4cff5..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/LocalSelectionPolicy.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.content;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.content.IContentTypeManager.ISelectionPolicy;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-
-/**
- * Selection policy that filters out any content types that do not
- * belong to the runtime plug-in or this test plug-in.
- */
-public class LocalSelectionPolicy implements ISelectionPolicy {
- public IContentType[] select(IContentType[] candidates, boolean fileName, boolean content) {
- List result = new ArrayList(candidates.length);
- for (int i = 0; i < candidates.length; i++) {
- String namespace = getNamespace(candidates[i].getId());
- if (namespace.equals(RuntimeTest.PI_RUNTIME_TESTS) || namespace.equals(Platform.PI_RUNTIME))
- result.add(candidates[i]);
- }
- return (IContentType[]) result.toArray(new IContentType[result.size()]);
- }
-
- private static String getNamespace(String id) {
- int lastDot = id.lastIndexOf('.');
- if (lastDot <= 1)
- throw new IllegalArgumentException("lastDot ==" + lastDot);
- return id.substring(0, lastDot);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/MyContentDescriber.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/MyContentDescriber.java
deleted file mode 100644
index 10d8ded..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/MyContentDescriber.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.content;
-
-import java.io.IOException;
-import java.io.InputStream;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.IContentDescriber;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-
-public class MyContentDescriber implements IContentDescriber {
- public static final Object[] MY_OPTION_VALUES = {"FOO", null, "BAR"};
- public static final String SIGNATURE = "MY_CONTENTS";
-
- public static final QualifiedName[] MY_OPTIONS = {new QualifiedName(RuntimeTest.PI_RUNTIME_TESTS, "my_option_1"), new QualifiedName(RuntimeTest.PI_RUNTIME_TESTS, "my_option_2"), new QualifiedName(RuntimeTest.PI_RUNTIME_TESTS, "my_option_3")};
-
- public MyContentDescriber() {
- super();
- }
-
- public int describe(InputStream contents, IContentDescription description) throws IOException {
- byte[] signature = SIGNATURE.getBytes("US-ASCII");
- byte[] buffer = new byte[signature.length];
- if (contents.read(buffer) != buffer.length)
- return INVALID;
- for (int i = 0; i < signature.length; i++)
- if (signature[i] != buffer[i])
- return INVALID;
- if (description == null)
- return VALID;
- for (int i = 0; i < MY_OPTIONS.length; i++)
- setIfRequested(description, i);
- return VALID;
- }
-
- public QualifiedName[] getSupportedOptions() {
- return MY_OPTIONS;
- }
-
- private void setIfRequested(IContentDescription description, int option) {
- if (description.isRequested(MY_OPTIONS[option]))
- description.setProperty(MY_OPTIONS[option], MY_OPTION_VALUES[option]);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/NaySayerContentDescriber.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/NaySayerContentDescriber.java
deleted file mode 100644
index 8c1569d..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/NaySayerContentDescriber.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.content;
-
-import java.io.*;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.ITextContentDescriber;
-
-/**
- * A content describer that always rejects its input.
- * It is used in the tests, when a content type definition created
- * for name-based content type matching should not interfere with tests
- * that do content-based content type matching.
- */
-public class NaySayerContentDescriber implements ITextContentDescriber {
-
- public int describe(InputStream contents, IContentDescription description) throws IOException {
- for (int i = 0;contents.read() != -1 && i < 2048; i++) {
- // read some data so performance tests are more reallistic
- }
- return INVALID;
- }
-
- public int describe(Reader contents, IContentDescription description) throws IOException {
- for (int i = 0;contents.read() != -1 && i < 2048; i++) {
- // read some data so performance tests are more reallistic
- }
- return INVALID;
- }
-
- public QualifiedName[] getSupportedOptions() {
- return IContentDescription.ALL;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/SpecificContextTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/SpecificContextTest.java
deleted file mode 100644
index 7c30dd5..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/SpecificContextTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.content;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.internal.content.ContentTypeManager;
-import org.eclipse.core.internal.preferences.EclipsePreferences;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.content.*;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-
-/**
- * Tests content type matcher with a non-default context for user preferences.
- */
-public class SpecificContextTest extends RuntimeTest {
-
- /**
- * A minimal scope implementation.
- */
- private class SingleNodeScope implements IScopeContext {
- private IEclipsePreferences node;
-
- SingleNodeScope() {
- this.node = new EclipsePreferences();
- }
-
- public IPath getLocation() {
- return null;
- }
-
- public String getName() {
- return "";
- }
-
- public IEclipsePreferences getNode(String qualifier) {
- assertEquals(ContentTypeManager.CONTENT_TYPE_PREF_NODE, qualifier);
- return this.node;
- }
- }
-
- public static Test suite() {
- return new TestSuite(SpecificContextTest.class);
- }
-
- public SpecificContextTest(String name) {
- super(name);
- }
-
- public void testContentTypeLookup() {
- IContentTypeManager global = Platform.getContentTypeManager();
- final SingleNodeScope scope = new SingleNodeScope();
- IContentTypeMatcher local = global.getMatcher(new LocalSelectionPolicy(), scope);
- IContentType textContentType = global.getContentType(Platform.PI_RUNTIME + '.' + "text");
- try {
- // added "<test case name>.global" to the text content type as a global file spec
- textContentType.addFileSpec(getName() + ".global", IContentType.FILE_NAME_SPEC);
- } catch (CoreException e) {
- fail("0.1", e);
- }
- try {
- // added "<test case name>.local" to the text content type as a local (scope-specific) file spec
- textContentType.getSettings(scope).addFileSpec(getName() + ".local", IContentType.FILE_NAME_SPEC);
- } catch (CoreException e) {
- fail("0.2", e);
- }
- // make ensure associations are properly recognized when doing content type lookup
- assertEquals("1.0", textContentType, global.findContentTypeFor(getName() + ".global"));
- assertEquals("1.1", null, local.findContentTypeFor(getName() + ".global"));
- assertEquals("2.0", textContentType, local.findContentTypeFor(getName() + ".local"));
- assertEquals("2.1", null, global.findContentTypeFor(getName() + ".local"));
-
- try {
- textContentType.removeFileSpec(getName() + ".global", IContentType.FILE_NAME_SPEC);
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- public void testIsAssociatedWith() {
- IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
- final SingleNodeScope scope = new SingleNodeScope();
- IContentType textContentType = contentTypeManager.getContentType(Platform.PI_RUNTIME + '.' + "text");
- IContentTypeSettings localSettings = null;
- try {
- localSettings = textContentType.getSettings(scope);
- } catch (CoreException e) {
- fail("0.1", e);
- }
- // haven't added association yet
- assertTrue("1.0", !textContentType.isAssociatedWith("hello.foo", scope));
- assertTrue("1.1", !textContentType.isAssociatedWith("hello.foo"));
- try {
- // associate at the scope level
- localSettings.addFileSpec("foo", IContentType.FILE_EXTENSION_SPEC);
- } catch (CoreException e) {
- fail("1.5", e);
- }
- try {
- localSettings = textContentType.getSettings(scope);
- } catch (CoreException e) {
- fail("2.1", e);
- }
- // scope-specific settings should contain the filespec we just added
- String[] fileSpecs = localSettings.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
- assertEquals("2.2", 1, fileSpecs.length);
- assertEquals("2.3", "foo", fileSpecs[0]);
- // now it is associated at the scope level...
- assertTrue("2.5", textContentType.isAssociatedWith("hello.foo", scope));
- // ...but not at the global level
- assertTrue("2.6", !textContentType.isAssociatedWith("hello.foo"));
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/SubsetSelectionPolicy.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/SubsetSelectionPolicy.java
deleted file mode 100644
index 2f83930..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/SubsetSelectionPolicy.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.content;
-
-import java.util.*;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.content.IContentTypeManager.ISelectionPolicy;
-
-public class SubsetSelectionPolicy implements ISelectionPolicy {
- private Set subset;
-
- public SubsetSelectionPolicy(IContentType[] subset) {
- this.subset = new HashSet(Arrays.asList(subset));
- }
-
- public IContentType[] select(IContentType[] candidates, boolean fileName, boolean content) {
- List result = new ArrayList(candidates.length);
- for (int i = 0; i < candidates.length; i++)
- if (subset.contains(candidates[i]))
- result.add(candidates[i]);
- return (IContentType[]) result.toArray(new IContentType[result.size()]);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/TestBug94498.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/TestBug94498.java
deleted file mode 100644
index faa17c2..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/TestBug94498.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.content;
-
-import junit.framework.Test;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-import org.eclipse.core.tests.session.WorkspaceSessionTestSuite;
-
-public class TestBug94498 extends RuntimeTest {
-
- private static final String FILE_NAME = "foo.bar.zoo";
-
- public static Test suite() {
- return new WorkspaceSessionTestSuite(PI_RUNTIME_TESTS, TestBug94498.class);
- }
-
- public TestBug94498(String name) {
- super(name);
- }
-
- public void test1() {
- IContentType text = Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT);
- assertNotNull("1.0", text);
- try {
- text.addFileSpec(FILE_NAME, IContentType.FILE_NAME_SPEC);
- } catch (CoreException e) {
- fail("1.9", e);
- }
- String[] fileSpecs = text.getFileSpecs(IContentType.FILE_NAME_SPEC | IContentType.IGNORE_PRE_DEFINED);
- assertEquals("2.0", 1, fileSpecs.length);
- assertEquals("2.1", FILE_NAME, fileSpecs[0]);
- }
-
- public void test2() {
- IContentType text = Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT);
- assertNotNull("1.0", text);
- String[] fileSpecs = text.getFileSpecs(IContentType.FILE_NAME_SPEC | IContentType.IGNORE_PRE_DEFINED);
- assertEquals("2.0", 1, fileSpecs.length);
- assertEquals("2.1", FILE_NAME, fileSpecs[0]);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/XMLContentDescriberTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/XMLContentDescriberTest.java
deleted file mode 100644
index ace545b..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/XMLContentDescriberTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.content;
-
-import java.io.ByteArrayInputStream;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-
-/**
- * Ensures the XMLContentDescriber is able to handle encodings properly.
- */
-public class XMLContentDescriberTest extends RuntimeTest {
- private final static String ENCODED_TEXT = "\u1000\u20001\u3000\u4000\u5000\u6000\u7000\u8000\u9000\uA000";
- private final static String ENCODING = "UTF16";
- private final static String XML_WITH_ENCODED_DATA = "<?xml version=\"1.0\" encoding=\"" + ENCODING + "\"?><root attribute=\"" + ENCODED_TEXT + "\">";
-
- public XMLContentDescriberTest() {
- super();
- }
-
- public XMLContentDescriberTest(String name) {
- super(name);
- }
-
- public void testEncodedContents() throws Exception {
- IContentDescription description = Platform.getContentTypeManager().getDescriptionFor(new ByteArrayInputStream(XML_WITH_ENCODED_DATA.getBytes(ENCODING)), "fake.xml", new QualifiedName[] {IContentDescription.CHARSET});
- assertNotNull("1.0", description);
- assertEquals("1.1", Platform.PI_RUNTIME + ".xml", description.getContentType().getId());
- assertEquals("1.2", ENCODING, description.getProperty(IContentDescription.CHARSET));
- }
-
- public static Test suite() {
- return new TestSuite(XMLContentDescriberTest.class);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AbstractJobManagerTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AbstractJobManagerTest.java
deleted file mode 100644
index 8e9fc57..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AbstractJobManagerTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import org.eclipse.core.internal.jobs.JobManager;
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- * Base class for tests using IJobManager
- */
-public class AbstractJobManagerTest extends AbstractJobTest {
- protected IJobManager manager;
- private FussyProgressProvider progressProvider;
-
- public AbstractJobManagerTest() {
- super();
- }
-
- public AbstractJobManagerTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- manager = Job.getJobManager();
- progressProvider = new FussyProgressProvider();
- manager.setProgressProvider(progressProvider);
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- progressProvider.sanityCheck();
- manager.setProgressProvider(null);
- }
-
- /**
- * Ensure job completes within the given time.
- * @param job
- * @param waitTime time in milliseconds
- */
- protected void waitForCompletion(Job job, int waitTime) {
- int i = 0;
- int tickLength = 10;
- int ticks = waitTime / tickLength;
- while (job.getState() != Job.NONE) {
- sleep(tickLength);
- //sanity test to avoid hanging tests
- if (i++ > ticks) {
- dumpState();
- assertTrue("Timeout waiting for job to complete", false);
- }
- }
- }
-
- /**
- * Ensure given job completes within a second.
- */
- protected void waitForCompletion(Job job) {
- waitForCompletion(job, 1000);
- }
-
- /**
- * Extra debugging for bug 109898
- */
- protected void dumpState() {
- System.out.println("**** BEGIN DUMP JOB MANAGER INFORMATION ****");
- Job[] jobs = Job.getJobManager().find(null);
- for (int j = 0; j < jobs.length; j++)
- System.out.println("" + jobs[j] + " state: " + JobManager.printState(jobs[j].getState()));
- System.out.println("**** END DUMP JOB MANAGER INFORMATION ****");
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AbstractJobTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AbstractJobTest.java
deleted file mode 100644
index 107012f..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AbstractJobTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import java.io.*;
-import junit.framework.TestCase;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * Common superclass for all tests of the org.eclipse.core.runtime.jobs API. Provides
- * convenience methods useful for testing jobs.
- */
-public class AbstractJobTest extends TestCase {
- public AbstractJobTest() {
- super("");
- }
-
- public AbstractJobTest(String name) {
- super(name);
- }
-
- /**
- * Fails the test due to the given exception.
- * @param message
- * @param e
- */
- public void fail(String message, Exception e) {
- // If the exception is a CoreException with a multistatus
- // then print out the multistatus so we can see all the info.
- if (e instanceof CoreException) {
- IStatus status = ((CoreException) e).getStatus();
- if (status.getChildren().length > 0) {
- write(status, 0);
- }
- }
- fail(message + ": " + e);
- }
-
- protected void indent(OutputStream output, int indent) {
- for (int i = 0; i < indent; i++)
- try {
- output.write("\t".getBytes());
- } catch (IOException e) {
- //ignore
- }
- }
-
- protected void sleep(long duration) {
- try {
- Thread.sleep(duration);
- } catch (InterruptedException e) {
- //ignore
- }
- }
-
- protected void write(IStatus status, int indent) {
- PrintStream output = System.out;
- indent(output, indent);
- output.println("Severity: " + status.getSeverity());
-
- indent(output, indent);
- output.println("Plugin ID: " + status.getPlugin());
-
- indent(output, indent);
- output.println("Code: " + status.getCode());
-
- indent(output, indent);
- output.println("Message: " + status.getMessage());
-
- if (status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- write(children[i], indent + 1);
- }
- }
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AllTests.java
deleted file mode 100644
index 9960f5e..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AllTests.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import junit.framework.*;
-
-/**
- * Runs all job tests
- */
-public class AllTests extends TestCase {
- public AllTests() {
- super(null);
- }
-
- public AllTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AllTests.class.getName());
- suite.addTestSuite(IJobManagerTest.class);
- suite.addTestSuite(JobQueueTest.class);
- suite.addTestSuite(OrderedLockTest.class);
- suite.addTestSuite(BeginEndRuleTest.class);
- suite.addTestSuite(JobTest.class);
- suite.addTestSuite(DeadlockDetectionTest.class);
- suite.addTestSuite(Bug_129551.class);
- return suite;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AsynchExecThread.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AsynchExecThread.java
deleted file mode 100644
index ac8467d..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AsynchExecThread.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-//import junit.framework.Assert;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.tests.harness.TestBarrier;
-
-/**
- * A runnable class that executes the given job and calls done when it is finished
- */
-public class AsynchExecThread extends Thread {
- private IProgressMonitor current;
- private Job job;
- private int ticks;
- private int tickLength;
- private String jobName;
- private int[] status;
- private int index;
-
- public AsynchExecThread(IProgressMonitor current, Job job, int ticks, int tickLength, String jobName, int[] status, int index) {
- this.current = current;
- this.job = job;
- this.ticks = ticks;
- this.tickLength = tickLength;
- this.jobName = jobName;
- this.status = status;
- this.index = index;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Runnable#run()
- */
- public void run() {
- //wait until the main testing method allows this thread to run
- TestBarrier.waitForStatus(status, index, TestBarrier.STATUS_WAIT_FOR_RUN);
-
- //set the current thread as the execution thread
- job.setThread(Thread.currentThread());
-
- status[index] = TestBarrier.STATUS_RUNNING;
-
- //wait until this job is allowed to run by the tester
- TestBarrier.waitForStatus(status, index, TestBarrier.STATUS_WAIT_FOR_DONE);
-
- //must have positive work
- current.beginTask(jobName, ticks <= 0 ? 1 : ticks);
- try {
-
- for (int i = 0; i < ticks; i++) {
- current.subTask("Tick: " + i);
- if (current.isCanceled()) {
- status[index] = TestBarrier.STATUS_DONE;
- job.done(Status.CANCEL_STATUS);
- }
- try {
- //Thread.yield();
- Thread.sleep(tickLength);
- } catch (InterruptedException e) {
- }
- current.worked(1);
- }
- if (ticks <= 0)
- current.worked(1);
- } finally {
- status[index] = TestBarrier.STATUS_DONE;
- current.done();
- job.done(Status.OK_STATUS);
- }
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AsynchTestJob.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AsynchTestJob.java
deleted file mode 100644
index be086ba..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AsynchTestJob.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.tests.harness.TestBarrier;
-
-/**
- * A job that executes asynchronously on a separate thread
- */
-class AsynchTestJob extends Job {
- private int[] status;
- private int index;
-
- public AsynchTestJob(String name, int[] status, int index) {
- super(name);
- this.status = status;
- this.index = index;
- }
-
- public IStatus run(IProgressMonitor monitor) {
- status[index] = TestBarrier.STATUS_RUNNING;
- AsynchExecThread t = new AsynchExecThread(monitor, this, 100, 10, getName(), status, index);
- TestBarrier.waitForStatus(status, index, TestBarrier.STATUS_START);
- t.start();
- status[index] = TestBarrier.STATUS_WAIT_FOR_START;
- return Job.ASYNC_FINISH;
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/BeginEndRuleTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/BeginEndRuleTest.java
deleted file mode 100644
index 140c6f7..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/BeginEndRuleTest.java
+++ /dev/null
@@ -1,600 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.tests.harness.*;
-
-/**
- * Tests API methods IJobManager.beginRule and IJobManager.endRule
- */
-public class BeginEndRuleTest extends AbstractJobManagerTest {
-
- /**
- * This runnable will try to end the given rule in the Job Manager
- */
- private class RuleEnder implements Runnable {
- private ISchedulingRule rule;
- private int[] status;
-
- public RuleEnder(ISchedulingRule rule, int[] status) {
- this.rule = rule;
- this.status = status;
- }
-
- public void run() {
- try {
- status[0] = TestBarrier.STATUS_RUNNING;
- manager.endRule(rule);
- fail("Ending Rule");
-
- } catch (RuntimeException e) {
- //should fail
- }
-
- }
- }
-
- public static TestSuite suite() {
- return new TestSuite(BeginEndRuleTest.class);
- // TestSuite suite = new TestSuite();
- // suite.addTest(new BeginEndRuleTest("testComplexRuleStarting"));
- // return suite;
- }
-
- public BeginEndRuleTest() {
- super();
- }
-
- public BeginEndRuleTest(String name) {
- super(name);
- }
-
- public void testComplexRuleStarting() {
- //test how the manager reacts when several different threads try to begin conflicting rules
- final int NUM_THREADS = 3;
- //array to communicate with the launched threads
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START};
- //number of times to start each rule
- int NUM_REPEATS = 10;
-
- Job[] jobs = new Job[NUM_THREADS];
- jobs[0] = new JobRuleRunner("ComplexJob1", new PathRule("/testComplexRuleStarting"), status, 0, NUM_REPEATS, true);
- jobs[1] = new JobRuleRunner("ComplexJob2", new PathRule("/testComplexRuleStarting/B"), status, 1, NUM_REPEATS, true);
- jobs[2] = new JobRuleRunner("ComplexJob3", new PathRule("/testComplexRuleStarting/B/C"), status, 2, NUM_REPEATS, true);
-
- //schedule the jobs
- for (int i = 0; i < jobs.length; i++)
- jobs[i].schedule();
-
- //wait until all the jobs start
- for (int i = 0; i < jobs.length; i++)
- TestBarrier.waitForStatus(status, i, TestBarrier.STATUS_START);
-
- //all jobs should be running
- //the status flag should be set to START
- for (int i = 0; i < status.length; i++) {
- assertEquals("1." + i, Job.RUNNING, jobs[i].getState());
- assertEquals("2." + i, TestBarrier.STATUS_START, status[i]);
- }
-
- //the order that the jobs will be executed
- int[] order = {0, 1, 2};
-
- for (int j = 0; j < NUM_REPEATS; j++) {
- //let the first job in the order run
- status[order[0]] = TestBarrier.STATUS_WAIT_FOR_RUN;
- //wait until the first job in the order reads the flag
- TestBarrier.waitForStatus(status, order[0], TestBarrier.STATUS_RUNNING);
-
- //let all subsequent jobs run (they will be blocked)
- //before starting next job, wait until previous job is blocked by JobManager
- for (int i = 1; i < order.length; i++) {
- status[order[i]] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, order[i], TestBarrier.STATUS_BLOCKED);
- }
-
- //the first job should be running, the remaining jobs should be waiting
- assertEquals("3.0", TestBarrier.STATUS_RUNNING, status[order[0]]);
- assertEquals("3.0", TestBarrier.STATUS_BLOCKED, status[order[1]]);
- assertEquals("3.0", TestBarrier.STATUS_BLOCKED, status[order[2]]);
-
- //let the first job finish
- status[order[0]] = TestBarrier.STATUS_WAIT_FOR_DONE;
- TestBarrier.waitForStatus(status, order[0], TestBarrier.STATUS_DONE);
-
- //the remaining jobs will now compete for execution (order NOT guaranteed)
- //let them both start and wait until they complete
- int doneCount = 0;
- while (doneCount < 2) {
- if (status[order[1]] == TestBarrier.STATUS_RUNNING) {
- status[order[1]] = TestBarrier.STATUS_WAIT_FOR_DONE;
- TestBarrier.waitForStatus(status, order[1], TestBarrier.STATUS_DONE);
- doneCount++;
- }
- if (status[order[2]] == TestBarrier.STATUS_RUNNING) {
- status[order[2]] = TestBarrier.STATUS_WAIT_FOR_DONE;
- TestBarrier.waitForStatus(status, order[2], TestBarrier.STATUS_DONE);
- doneCount++;
- }
- }
- //change the order of the jobs, nothing should change in the execution
- int temp = order[0];
- order[0] = order[2];
- order[2] = order[1];
- order[1] = temp;
- }
-
- //wait until all jobs are done
- for (int i = 0; i < order.length; i++) {
- waitForEnd(jobs[order[i]]);
- }
-
- for (int i = 0; i < jobs.length; i++) {
- //check that the final status of all jobs is correct
- assertEquals("9." + i, TestBarrier.STATUS_DONE, status[i]);
- assertEquals("10." + i, Job.NONE, jobs[i].getState());
- assertEquals("11." + i, IStatus.OK, jobs[i].getResult().getSeverity());
- }
- }
-
- public void testSimpleRuleStarting() {
- //start two jobs, each of which will begin and end a rule several times
- //while one job starts a rule, the second job's call to begin rule should block that thread
- //until the first job calls end rule
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START};
- //number of repetitions of beginning and ending the rule
- final int NUM_REPEATS = 10;
- Job[] jobs = new Job[2];
- jobs[0] = new JobRuleRunner("SimpleJob1", new PathRule("/testSimpleRuleStarting"), status, 0, NUM_REPEATS, false);
- jobs[1] = new JobRuleRunner("SimpleJob2", new PathRule("/testSimpleRuleStarting/B"), status, 1, NUM_REPEATS, false);
-
- //schedule both jobs to start their execution
- jobs[0].schedule();
- jobs[1].schedule();
-
- //make sure both jobs are running and their respective run methods have been invoked
- //waitForStart(jobs[1]);
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_START);
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_START);
-
- assertEquals("2.0", Job.RUNNING, jobs[0].getState());
- assertEquals("2.1", Job.RUNNING, jobs[1].getState());
- assertEquals("2.2", TestBarrier.STATUS_START, status[0]);
- assertEquals("2.3", TestBarrier.STATUS_START, status[1]);
-
- //the order of execution of the jobs (by their index in the status array)
- int first = 0;
- int second = 1;
-
- //now both jobs are waiting for the STATUS_WAIT_FOR_RUN flag
- for (int j = 0; j < NUM_REPEATS; j++) {
- //let the first job start executing
- status[first] = TestBarrier.STATUS_WAIT_FOR_RUN;
-
- //wait for the first job to read the flag
- TestBarrier.waitForStatus(status, first, TestBarrier.STATUS_RUNNING);
-
- //let the second job start, its thread will be blocked by the beginRule method
- status[second] = TestBarrier.STATUS_WAIT_FOR_RUN;
-
- //only the first job should be running
- //the other job should be blocked by the beginRule method
- assertEquals("3.1", TestBarrier.STATUS_RUNNING, status[first]);
- assertEquals("3.2", TestBarrier.STATUS_WAIT_FOR_RUN, status[second]);
-
- //let the first job finish execution and call endRule
- //the second thread will then become unblocked
- status[first] = TestBarrier.STATUS_WAIT_FOR_DONE;
-
- //wait until the first job is done
- TestBarrier.waitForStatus(status, first, TestBarrier.STATUS_DONE);
-
- //now wait until the second job begins execution
- TestBarrier.waitForStatus(status, second, TestBarrier.STATUS_RUNNING);
-
- //the first job is done, the second job is executing
- assertEquals("4.1", TestBarrier.STATUS_DONE, status[first]);
- assertEquals("4.2", TestBarrier.STATUS_RUNNING, status[second]);
-
- //let the second job finish execution
- status[second] = TestBarrier.STATUS_WAIT_FOR_DONE;
-
- //wait until the second job is finished
- TestBarrier.waitForStatus(status, second, TestBarrier.STATUS_DONE);
-
- //both jobs are done now
- assertEquals("5.1", TestBarrier.STATUS_DONE, status[first]);
- assertEquals("5.2", TestBarrier.STATUS_DONE, status[second]);
-
- //flip the order of execution of the jobs
- int temp = first;
- first = second;
- second = temp;
- }
-
- //wait until both jobs are done
- waitForEnd(jobs[second]);
- waitForEnd(jobs[first]);
-
- //check that the final status of both jobs is correct
- assertEquals("6.1", TestBarrier.STATUS_DONE, status[0]);
- assertEquals("6.2", TestBarrier.STATUS_DONE, status[1]);
- assertEquals("6.3", Job.NONE, jobs[0].getState());
- assertEquals("6.4", Job.NONE, jobs[1].getState());
- assertEquals("6.5", IStatus.OK, jobs[0].getResult().getSeverity());
- assertEquals("6.6", IStatus.OK, jobs[1].getResult().getSeverity());
- }
-
- public void testComplexRuleContainment() {
- ISchedulingRule rules[] = new ISchedulingRule[4];
-
- rules[0] = new PathRule("/testComplexRuleContainment");
- rules[1] = new PathRule("/testComplexRuleContainment/B");
- rules[2] = new PathRule("/testComplexRuleContainment/B/C");
- rules[3] = new PathRule("/testComplexRuleContainment/D");
-
- //adding multiple rules in correct order
- int RULE_REPEATS = 10;
- try {
- for (int i = 0; i < rules.length - 1; i++) {
- for (int j = 0; j < RULE_REPEATS; j++) {
- manager.beginRule(rules[i], null);
- }
- }
- for (int i = rules.length - 1; i > 0; i--) {
- for (int j = 0; j < RULE_REPEATS; j++) {
- manager.endRule(rules[i - 1]);
- }
- }
- } catch (RuntimeException e) {
- fail("4.0");
- }
-
- //adding rules in proper order, then adding a rule from a bypassed branch
- //trying to end previous rules should not work
- for (int i = 0; i < rules.length; i++) {
- manager.beginRule(rules[i], null);
- }
- try {
- manager.endRule(rules[2]);
- fail("4.1");
- } catch (RuntimeException e) {
- //should fail
- try {
- manager.endRule(rules[1]);
- fail("4.2");
- } catch (RuntimeException e1) {
- //should fail
- try {
- manager.endRule(rules[0]);
- fail("4.3");
- } catch (RuntimeException e2) {
- //should fail
- }
- }
- }
- for (int i = rules.length; i > 0; i--) {
- manager.endRule(rules[i - 1]);
- }
- }
-
- public void _testEndNullRule() {
- //see bug #43460
- //end null IScheduleRule without begin
- try {
- manager.endRule(null);
- fail("1.1");
- } catch (RuntimeException e) {
- //should fail
- }
- }
-
- public void testFailureCase() {
- ISchedulingRule rule1 = new IdentityRule();
- ISchedulingRule rule2 = new IdentityRule();
-
- //end without begin
- try {
- manager.endRule(rule1);
- fail("1.0");
- } catch (RuntimeException e) {
- //should fail
- }
- //simple mismatched begin/end
- manager.beginRule(rule1, null);
- try {
- manager.endRule(rule2);
- fail("1.2");
- } catch (RuntimeException e) {
- //should fail
- }
- //should still be able to end the original rule
- manager.endRule(rule1);
-
- //mismatched begin/end, ending a null rule
- manager.beginRule(rule1, null);
- try {
- manager.endRule(null);
- fail("1.3");
- } catch (RuntimeException e) {
- //should fail
- }
- //should still be able to end the original rule
- manager.endRule(rule1);
- }
-
- /**
- * Tests create a job with one scheduling rule, and then attempting
- * to acquire an unrelated rule from within that job.
- */
- public void testFailedNestRuleInJob() {
- final ISchedulingRule rule1 = new PathRule("/testFailedNestRuleInJob/A/");
- final ISchedulingRule rule2 = new PathRule("/testFailedNestRuleInJob/B/");
- final Exception[] exception = new Exception[1];
- Job job = new Job("testFailedNestRuleInJob") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- try {
- manager.beginRule(rule2, monitor);
- } finally {
- manager.endRule(rule2);
- }
- } catch (RuntimeException e) {
- exception[0] = e;
- }
- return Status.OK_STATUS;
- }
- };
- job.setRule(rule1);
- job.schedule();
- waitForEnd(job);
- assertTrue("1.0", exception[0] != null);
- assertTrue("1.1", exception[0].getMessage().indexOf("does not match outer scope rule") > 0);
- }
-
- public void testNestedCase() {
- ISchedulingRule rule1 = new PathRule("/testNestedCase");
- ISchedulingRule rule2 = new PathRule("/testNestedCase/B");
-
- //ending an outer rule before an inner one
- manager.beginRule(rule1, null);
- manager.beginRule(rule2, null);
- try {
- manager.endRule(rule1);
- fail("2.0");
- } catch (RuntimeException e) {
- //should fail
- }
- manager.endRule(rule2);
- manager.endRule(rule1);
-
- //ending a rule that is not open
- manager.beginRule(rule1, null);
- manager.beginRule(rule2, null);
- try {
- manager.endRule(null);
- fail("2.1");
- } catch (RuntimeException e) {
- //should fail
- }
- manager.endRule(rule2);
- manager.endRule(rule1);
-
- //adding rules starting with null rule
- try {
- manager.beginRule(null, null);
- manager.beginRule(rule1, null);
- manager.endRule(rule1);
- manager.beginRule(rule2, null);
- manager.endRule(rule2);
- manager.endRule(null);
- } catch (RuntimeException e) {
- //should not fail
- fail("2.2");
- }
-
- //adding numerous instances of the same rule
- int NUM_ADDITIONS = 100;
- try {
- for (int i = 0; i < NUM_ADDITIONS; i++) {
- manager.beginRule(rule1, null);
- }
- for (int i = 0; i < NUM_ADDITIONS; i++) {
- manager.endRule(rule1);
- }
- } catch (RuntimeException e) {
- //should not fail
- fail("2.3");
- }
-
- //adding numerous instances of the null rule
- try {
- for (int i = 0; i < NUM_ADDITIONS; i++) {
- manager.beginRule(null, null);
- }
- manager.beginRule(rule1, null);
- manager.endRule(rule1);
- for (int i = 0; i < NUM_ADDITIONS; i++) {
- manager.endRule(null);
- }
- } catch (RuntimeException e) {
- //should not fail
- fail("2.4");
- }
- }
-
- /**
- * Tests a failure where canceling an attempt to beginRule resulted in implicit jobs
- * being recycled before they were finished.
- */
- public void testBug44299() {
- ISchedulingRule rule = new IdentityRule();
- FussyProgressMonitor monitor = new FussyProgressMonitor();
- manager.beginRule(rule, monitor);
- int[] status = new int[1];
- SimpleRuleRunner runner = new SimpleRuleRunner(rule, status, monitor);
- new Thread(runner).start();
-
- //wait for the job to start
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_RUNNING);
- //give the job a chance to enter the wait loop
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- //ignore
- }
- //cancel the monitor
- monitor.setCanceled(true);
-
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_DONE);
- if (runner.exception != null)
- fail("1.0", runner.exception);
-
- //finally clear the rule
- manager.endRule(rule);
- }
-
- public void testRuleContainment() {
- ISchedulingRule rules[] = new ISchedulingRule[4];
-
- rules[0] = new PathRule("/testRuleContainment");
- rules[1] = new PathRule("/testRuleContainment/B");
- rules[2] = new PathRule("/testRuleContainment/B/C");
- rules[3] = new PathRule("/testRuleContainment/D");
-
- //simple addition of rules in incorrect containment order
- manager.beginRule(rules[1], null);
- try {
- manager.beginRule(rules[0], null);
- fail("3.0");
- } catch (RuntimeException e) {
- //should fail
- } finally {
- //still need to end the rule
- manager.endRule(rules[0]);
- }
- manager.endRule(rules[1]);
-
- //adding rules in proper order, then adding a rule from different hierarchy
- manager.beginRule(rules[1], null);
- manager.beginRule(rules[2], null);
- try {
- manager.beginRule(rules[3], null);
- fail("3.2");
- } catch (RuntimeException e) {
- //should fail
- } finally {
- manager.endRule(rules[3]);
- }
- //should still be able to end the rules
- manager.endRule(rules[2]);
- manager.endRule(rules[1]);
- }
-
- public void testSimpleOtherThreadAccess() {
- //ending a rule started on this thread from another thread
- ISchedulingRule rule1 = new IdentityRule();
- int[] status = {TestBarrier.STATUS_START};
- Thread endingThread = new Thread(new RuleEnder(rule1, status));
- manager.beginRule(rule1, null);
-
- endingThread.start();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_RUNNING);
-
- try {
- endingThread.join();
- } catch (InterruptedException e) {
- //ignore
- }
- //the thread should be dead now
- assertTrue("1.0", !endingThread.isAlive());
-
- //should be able to end the rule from this thread
- manager.endRule(rule1);
-
- //starting several rules on this thread, and trying to end them from other threads
- ISchedulingRule rules[] = new ISchedulingRule[3];
-
- rules[0] = new PathRule("/testSimpleOtherThreadAccess");
- rules[1] = new PathRule("/testSimpleOtherThreadAccess/B");
- rules[2] = new PathRule("/testSimpleOtherThreadAccess/C");
-
- //end the rules right after starting them
- for (int i = 0; i < rules.length; i++) {
- manager.beginRule(rules[i], null);
- status[0] = TestBarrier.STATUS_START;
- Thread t = new Thread(new RuleEnder(rules[i], status));
- t.start();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_RUNNING);
- try {
- t.join();
- } catch (InterruptedException e1) {
- //ignore
- }
- //the thread should be dead now
- assertTrue("2." + i, !t.isAlive());
- }
-
- //try to end the rules when they are all started
- for (int i = 0; i < rules.length; i++) {
- status[0] = TestBarrier.STATUS_START;
- Thread t = new Thread(new RuleEnder(rules[i], status));
- t.start();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_RUNNING);
- try {
- t.join();
- } catch (InterruptedException e1) {
- //ignore
- }
- //the thread should be dead now
- assertTrue("3." + i, !t.isAlive());
- }
-
- //try to end the rules after manager.endRule() has been called
- for (int i = rules.length; i > 0; i--) {
- manager.endRule(rules[i - 1]);
- status[0] = TestBarrier.STATUS_START;
- Thread t = new Thread(new RuleEnder(rules[i - 1], status));
- t.start();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_RUNNING);
- try {
- t.join();
- } catch (InterruptedException e1) {
- //ignore
- }
- //the thread should be dead now
- assertTrue("4." + i, !t.isAlive());
- }
- }
-
- /**
- * A job is running. Wait until it is finished.
- */
- private void waitForEnd(Job job) {
- int i = 0;
- while (job.getState() != Job.NONE) {
- Thread.yield();
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- //ignore
- }
- Thread.yield();
- //sanity test to avoid hanging tests
- assertTrue("Timeout waiting for job to end", i++ < 100);
- }
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/Bug_129551.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/Bug_129551.java
deleted file mode 100644
index 3e7a2a4..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/Bug_129551.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.tests.harness.TestBarrier;
-import org.eclipse.core.tests.harness.TestJob;
-
-/**
- * Regression test for bug 129551. A job changes to the ABOUT_TO_RUN
- * state, and then another job tries to run and is queued behind it. Before
- * the job starts, it is put to sleep. When the bug existed, putting the job
- * to sleep would cause any blocked jobs behind the job to be lost.
- */
-public class Bug_129551 extends AbstractJobManagerTest {
- final boolean[] shouldSleep = new boolean[] {true};
- TestBarrier barrier = new TestBarrier();
- RuntimeException[] failure = new RuntimeException[1];
-
- class BugJob extends TestJob {
- public BugJob() {
- super("Bug_129551", 1, 1);
- }
-
- public boolean shouldRun() {
- //skip everything if the test is already done
- if (!shouldSleep[0])
- return true;
- barrier.setStatus(TestBarrier.STATUS_RUNNING);
- //wait for blocking jobs to queue up
- barrier.waitForStatus(TestBarrier.STATUS_START);
- //put the job to sleep
- try {
- this.sleep();
- } catch (RuntimeException e) {
- failure[0] = e;
- }
- barrier.setStatus(TestBarrier.STATUS_DONE);
- return true;
- }
- }
-
- public static TestSuite suite() {
- return new TestSuite(Bug_129551.class);
- }
-
- public Bug_129551() {
- super();
- }
-
- public Bug_129551(String name) {
- super(name);
- }
- protected void setUp() throws Exception {
- super.setUp();
- //don't use fussy progress monitor, because in this case we kill
- // a job before it has started running
- manager.setProgressProvider(null);
- }
-
- public void testBug() {
- ISchedulingRule rule = new IdentityRule();
- BugJob job = new BugJob();
- job.setRule(rule);
- TestJob other = new TestJob("bug_129551_other", 1, 1);
- other.setRule(rule);
- job.schedule();
- other.schedule();
- //wait until the first job is about to run
- barrier.waitForStatus(TestBarrier.STATUS_RUNNING);
- //wait to ensure the other job is blocked
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- fail("4.99", e);
- }
- //let the first job go
- barrier.setStatus(TestBarrier.STATUS_START);
- barrier.waitForStatus(TestBarrier.STATUS_DONE);
-
- //check for failure
- if (failure[0] != null)
- fail(failure[0].getMessage());
- //tell the job not to sleep this time around
- shouldSleep[0] = false;
- job.wakeUp();
- waitForCompletion(job);
- waitForCompletion(other);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/Bug_211799.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/Bug_211799.java
deleted file mode 100644
index 72baadb..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/Bug_211799.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import java.util.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- * Regression test for bug 211799
- */
-public class Bug_211799 extends AbstractJobManagerTest {
-
- public class BugJob extends Job {
- private long id;
-
- public BugJob(long id) {
- super("Test Job"); //$NON-NLS-1$
- this.id = id;
- setRule(rule);
- setPriority(Job.DECORATE);
- }
-
- public Long getId() {
- return new Long(this.id);
- }
-
- protected IStatus run(IProgressMonitor monitor) {
- synchronized (list) {
- Long val = (Long) list.getFirst();
- if (val.longValue() != id)
- failure = new RuntimeException("We broke, running should have been: " + val.longValue());
- list.remove(new Long(id));
- }
-
- synchronized (runList) {
- runList.add(new Long(id));
- }
-
- return Status.OK_STATUS;
- }
- }
- static final ISchedulingRule rule = new IdentityRule();
- long counter = 0;
- Exception failure = null;
- final int JOBS_TO_SCHEDULE = 500;
- LinkedList list = new LinkedList();
-
- List runList = new ArrayList(JOBS_TO_SCHEDULE);
-
- public void testBug() {
- for (int i = 0; i < JOBS_TO_SCHEDULE; i++) {
- synchronized (list) {
- counter++;
- list.addLast(new Long(counter));
- new BugJob(counter).schedule(0L);
- }
- }
-
- // Wait until all the jobs are done
- while (true) {
- synchronized (runList) {
- if (runList.size() == JOBS_TO_SCHEDULE) {
- break;
- }
- }
- }
- if (failure != null)
- fail("1.0", failure);
-
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/DeadlockDetectionTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/DeadlockDetectionTest.java
deleted file mode 100644
index be4907e..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/DeadlockDetectionTest.java
+++ /dev/null
@@ -1,1226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import java.util.*;
-
-import junit.framework.*;
-
-import org.eclipse.core.internal.jobs.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.core.tests.harness.*;
-
-/**
- * Tests implementation of ILock objects
- */
-public class DeadlockDetectionTest extends TestCase {
- private final IJobManager manager = Job.getJobManager();
- public DeadlockDetectionTest() {
- super(null);
- }
-
- public DeadlockDetectionTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(DeadlockDetectionTest.class);
-// TestSuite suite = new TestSuite();
-// suite.addTest(new DeadlockDetectionTest("testImplicitRules"));
-// return suite;
- }
-
- /**
- * Creates n runnables on the given lock and adds them to the given list.
- */
- private void createRunnables(ILock[] locks, int n, ArrayList allRunnables, boolean cond) {
- for (int i = 0; i < n; i++) {
- allRunnables.add(new RandomTestRunnable(locks, "# " + (allRunnables.size() + 1), cond));
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- //ignore
- }
- }
- }
-
- private LockManager getLockManager() {
- return ((JobManager)manager).getLockManager();
- }
-
- /**
- * Asks all threads to stop executing
- */
- private void kill(ArrayList allRunnables) {
- for (Iterator it = allRunnables.iterator(); it.hasNext();) {
- RandomTestRunnable r = (RandomTestRunnable) it.next();
- r.kill();
- }
- }
-
- /**
- * Test that deadlock between locks is detected and resolved.
- * Test with 6 threads competing for 3 locks from a set of 6.
- */
- public void testComplex() {
- ArrayList allRunnables = new ArrayList();
- LockManager lockManager = new LockManager();
- OrderedLock lock1 = lockManager.newLock();
- OrderedLock lock2 = lockManager.newLock();
- OrderedLock lock3 = lockManager.newLock();
- OrderedLock lock4 = lockManager.newLock();
- OrderedLock lock5 = lockManager.newLock();
- OrderedLock lock6 = lockManager.newLock();
- createRunnables(new ILock[] {lock1, lock2, lock3}, 1, allRunnables, true);
- createRunnables(new ILock[] {lock2, lock3, lock4}, 1, allRunnables, true);
- createRunnables(new ILock[] {lock3, lock4, lock5}, 1, allRunnables, true);
- createRunnables(new ILock[] {lock4, lock5, lock6}, 1, allRunnables, true);
- createRunnables(new ILock[] {lock5, lock6, lock1}, 1, allRunnables, true);
- createRunnables(new ILock[] {lock6, lock1, lock2}, 1, allRunnables, true);
- start(allRunnables);
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- //ignore
- }
- kill(allRunnables);
-
- for (int i = 0; i < allRunnables.size(); i++) {
- try {
- ((Thread) allRunnables.get(i)).join(100000);
- } catch (InterruptedException e1) {
- //ignore
- }
- assertTrue("1." + i, !((Thread) allRunnables.get(i)).isAlive());
- }
- //the underlying array has to be empty
- assertTrue("Locks not removed from graph.", lockManager.isEmpty());
- }
-
- /**
- * Test simplest deadlock case (2 threads, 2 locks).
- */
- public void testSimpleDeadlock() {
- ArrayList allRunnables = new ArrayList();
- LockManager localManager = new LockManager();
- OrderedLock lock1 = localManager.newLock();
- OrderedLock lock2 = localManager.newLock();
-
- createRunnables(new ILock[] {lock1, lock2}, 1, allRunnables, false);
- createRunnables(new ILock[] {lock2, lock1}, 1, allRunnables, false);
-
- start(allRunnables);
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- //ignore
- }
- kill(allRunnables);
-
- for (int i = 0; i < allRunnables.size(); i++) {
- try {
- ((Thread) allRunnables.get(i)).join(100000);
- } catch (InterruptedException e1) {
- //ignore
- }
- assertTrue("1." + i, !((Thread) allRunnables.get(i)).isAlive());
- }
- //the underlying array has to be empty
- assertTrue("Locks not removed from graph.", localManager.isEmpty());
- }
-
- /**
- * Test a more complicated scenario with 3 threads and 3 locks.
- */
- public void testThreeLocks() {
- ArrayList allRunnables = new ArrayList();
- LockManager lockManager = new LockManager();
- OrderedLock lock1 = lockManager.newLock();
- OrderedLock lock2 = lockManager.newLock();
- OrderedLock lock3 = lockManager.newLock();
-
- createRunnables(new ILock[] {lock1, lock2}, 1, allRunnables, false);
- createRunnables(new ILock[] {lock2, lock3}, 1, allRunnables, false);
- createRunnables(new ILock[] {lock3, lock1}, 1, allRunnables, false);
-
- start(allRunnables);
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- //ignore
- }
- kill(allRunnables);
-
- for (int i = 0; i < allRunnables.size(); i++) {
- try {
- ((Thread) allRunnables.get(i)).join(100000);
- } catch (InterruptedException e1) {
- //ignore
- }
- assertTrue("1." + i, !((Thread) allRunnables.get(i)).isAlive());
- }
- //the underlying array has to be empty
- assertTrue("Locks not removed from graph.", lockManager.isEmpty());
- }
-
- /**
- * Test simple deadlock with 2 threads trying to get 1 rule and 1 lock.
- */
- public void testRuleLockInteraction() {
- final ILock lock = manager.newLock();
- final ISchedulingRule rule = new IdentityRule();
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START};
-
- Thread first = new Thread("Test1") {
- public void run() {
- lock.acquire();
- status[0] = TestBarrier.STATUS_START;
- assertTrue("1.0", getLockManager().isLockOwner());
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
- manager.beginRule(rule, null);
- assertTrue("2.0", getLockManager().isLockOwner());
- manager.endRule(rule);
- lock.release();
- status[0] = TestBarrier.STATUS_DONE;
- }
- };
-
- Thread second = new Thread("Test2") {
- public void run() {
- manager.beginRule(rule, null);
- status[1] = TestBarrier.STATUS_START;
- assertTrue("1.0", getLockManager().isLockOwner());
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_RUNNING);
- lock.acquire();
- assertTrue("2.0", getLockManager().isLockOwner());
- lock.release();
- manager.endRule(rule);
- status[1] = TestBarrier.STATUS_DONE;
- }
- };
-
- first.start();
- second.start();
-
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_START);
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_START);
-
- status[0] = TestBarrier.STATUS_RUNNING;
- status[1] = TestBarrier.STATUS_RUNNING;
-
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_DONE);
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_DONE);
- waitForThreadDeath(first);
- waitForThreadDeath(second);
- assertTrue("3.0", !first.isAlive());
- assertTrue("4.0", !second.isAlive());
- //the underlying array has to be empty
- assertTrue("Jobs not removed from graph.", getLockManager().isEmpty());
- }
-
- /**
- * Test the interaction between jobs with rules and the acquisition of locks.
- */
- public void testJobRuleLockInteraction() {
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START};
- final ISchedulingRule rule1 = new IdentityRule();
- final ISchedulingRule rule2 = new IdentityRule();
- final ILock lock = manager.newLock();
-
- Job first = new Job("Test1") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- assertTrue("1.0", getLockManager().isLockOwner());
- monitor.beginTask("Testing", 1);
- status[0] = TestBarrier.STATUS_START;
- lock.acquire();
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
- assertTrue("2.0", getLockManager().isLockOwner());
- lock.release();
- monitor.worked(1);
- status[0] = TestBarrier.STATUS_DONE;
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- Job second = new Job("Test2") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- assertTrue("1.0", getLockManager().isLockOwner());
- monitor.beginTask("Testing", 1);
- status[1] = TestBarrier.STATUS_START;
- lock.acquire();
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_RUNNING);
- assertTrue("2.0", getLockManager().isLockOwner());
- lock.release();
- monitor.worked(1);
- status[1] = TestBarrier.STATUS_DONE;
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- first.setRule(rule1);
- second.setRule(rule2);
- first.schedule();
- second.schedule();
-
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_START);
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_START);
-
- status[0] = TestBarrier.STATUS_RUNNING;
- status[1] = TestBarrier.STATUS_RUNNING;
-
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_DONE);
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_DONE);
- waitForCompletion(first);
- waitForCompletion(second);
-
- assertEquals("3.0", Job.NONE, first.getState());
- assertEquals("3.1", Status.OK_STATUS, first.getResult());
- assertEquals("4.0", Job.NONE, second.getState());
- assertEquals("4.1", Status.OK_STATUS, second.getResult());
- //the underlying array has to be empty
- assertTrue("Jobs not removed from graph.", getLockManager().isEmpty());
- }
-
- /**
- * Regression test for bug 46894. Stale entries left over in graph.
- */
- public void testRuleHierarchyWaitReplace() {
- final int NUM_JOBS = 3;
- final int[] status = new int[NUM_JOBS];
- Arrays.fill(status, TestBarrier.STATUS_WAIT_FOR_START);
- final ISchedulingRule[] rules = {new PathRule("/testRuleHierarchyWaitReplace"), new PathRule("/testRuleHierarchyWaitReplace/B"), new PathRule("/testRuleHierarchyWaitReplace/C")};
- final ILock[] locks = {manager.newLock(), manager.newLock()};
- Job[] jobs = new Job[NUM_JOBS];
-
- jobs[0] = new Job("Test 0") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- manager.beginRule(rules[0], null);
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
- manager.endRule(rules[0]);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- jobs[1] = new Job("Test 1") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- locks[0].acquire();
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_START);
- manager.beginRule(rules[1], new TestBlockingMonitor(status, 1));
- status[1] = TestBarrier.STATUS_WAIT_FOR_RUN;
- locks[1].acquire();
- locks[1].release();
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_RUNNING);
- manager.endRule(rules[1]);
- locks[0].release();
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- jobs[2] = new Job("Test 2") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- locks[1].acquire();
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_START);
- manager.beginRule(rules[2], new TestBlockingMonitor(status, 2));
- status[2] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_RUNNING);
- manager.endRule(rules[2]);
- locks[1].release();
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- for (int i = 0; i < jobs.length; i++) {
- jobs[i].schedule();
- }
- //wait until the first job starts
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_WAIT_FOR_RUN);
- //now let the second job start
- status[1] = TestBarrier.STATUS_START;
- //wait until it blocks on the beginRule call
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_BLOCKED);
-
- //let the third job start, and wait until it too blocks
- status[2] = TestBarrier.STATUS_START;
- //wait until it blocks on the beginRule call
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_BLOCKED);
-
- //end the first job
- status[0] = TestBarrier.STATUS_RUNNING;
-
- //wait until the second job gets the rule
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_WAIT_FOR_RUN);
- //let the job finish
- status[1] = TestBarrier.STATUS_RUNNING;
-
- //now wait until the third job gets the rule
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_WAIT_FOR_RUN);
- //let the job finish
- status[2] = TestBarrier.STATUS_RUNNING;
-
- for (int i = 0; i < jobs.length; i++) {
- waitForCompletion(jobs[i]);
- }
-
- for (int i = 0; i < jobs.length; i++) {
- assertEquals("10." + i, Job.NONE, jobs[i].getState());
- assertEquals("10." + i, Status.OK_STATUS, jobs[i].getResult());
- }
- //the underlying graph has to be empty
- assertTrue("Jobs not removed from graph.", getLockManager().isEmpty());
- }
-
- /**
- * Regression test for bug 46894. Deadlock was not detected (before).
- */
- public void testDetectDeadlock() {
- final int NUM_JOBS = 3;
- final int[] status = new int[NUM_JOBS];
- Arrays.fill(status, TestBarrier.STATUS_WAIT_FOR_START);
- final ISchedulingRule[] rules = {new PathRule("/testDetectDeadlock"), new PathRule("/testDetectDeadlock/B"), new PathRule("/testDetectDeadlock/C")};
- final ILock lock = manager.newLock();
- Job[] jobs = new Job[NUM_JOBS];
-
- jobs[0] = new Job("Test 0") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- manager.beginRule(rules[1], null);
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
- manager.endRule(rules[1]);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- jobs[1] = new Job("Test 1") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- lock.acquire();
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_START);
- manager.beginRule(rules[0], new TestBlockingMonitor(status, 1));
- status[1] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_RUNNING);
- manager.endRule(rules[0]);
- lock.release();
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- jobs[2] = new Job("Test 2") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_START);
- manager.beginRule(rules[2], null);
- status[2] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_RUNNING);
- lock.acquire();
- lock.release();
- manager.endRule(rules[2]);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- for (int i = 0; i < jobs.length; i++) {
- jobs[i].schedule();
- }
- //wait until the first job starts
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_WAIT_FOR_RUN);
- //now let the third job start
- status[2] = TestBarrier.STATUS_START;
- //wait until it gets the rule
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_WAIT_FOR_RUN);
-
- //let the second job start
- status[1] = TestBarrier.STATUS_START;
- //wait until it blocks on the beginRule call
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_BLOCKED);
-
- //let the third job try for the lock
- status[2] = TestBarrier.STATUS_RUNNING;
- //end the first job
- status[0] = TestBarrier.STATUS_RUNNING;
-
- //wait until the second job gets the rule
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_WAIT_FOR_RUN);
- //let the job finish
- status[1] = TestBarrier.STATUS_RUNNING;
- //wait until all jobs are done
- for (int i = 0; i < jobs.length; i++) {
- waitForCompletion(jobs[i]);
- }
-
- for (int i = 0; i < jobs.length; i++) {
- assertEquals("10." + i, Job.NONE, jobs[i].getState());
- assertEquals("10." + i, Status.OK_STATUS, jobs[i].getResult());
- }
- //the underlying graph has to be empty
- assertTrue("Jobs not removed from graph.", getLockManager().isEmpty());
- }
-
- /**
- * Test that when 3 columns and 1 row are empty, they are correctly removed from the graph.
- */
- public void testMultipleColumnRemoval() {
- final int NUM_JOBS = 3;
- final int[] status = new int[NUM_JOBS];
- Arrays.fill(status, TestBarrier.STATUS_WAIT_FOR_START);
- final ISchedulingRule[] rules = {new PathRule("/testMultipleColumnRemoval"), new PathRule("/testMultipleColumnRemoval/B"), new PathRule("/testMultipleColumnRemoval/C")};
- final IProgressMonitor first = new TestBlockingMonitor(status, 1);
- final IProgressMonitor second = new TestBlockingMonitor(status, 2);
- Job[] jobs = new Job[NUM_JOBS];
-
- jobs[0] = new Job("Test 0") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- manager.beginRule(rules[0], null);
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
- manager.endRule(rules[0]);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- jobs[1] = new Job("Test 1") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_START);
- manager.beginRule(rules[1], first);
- monitor.worked(1);
- } finally {
- status[1] = TestBarrier.STATUS_DONE;
- manager.endRule(rules[1]);
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- jobs[2] = new Job("Test 2") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_START);
- manager.beginRule(rules[2], second);
- monitor.worked(1);
- } finally {
- status[2] = TestBarrier.STATUS_DONE;
- manager.endRule(rules[2]);
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
- //schedule all the jobs
- for (int i = 0; i < jobs.length; i++) {
- jobs[i].schedule();
- }
- //wait until the first job starts
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_WAIT_FOR_RUN);
- //now let the other two jobs start
- status[1] = TestBarrier.STATUS_START;
- status[2] = TestBarrier.STATUS_START;
- //wait until both are blocked on the beginRule call
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_BLOCKED);
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_BLOCKED);
-
- //cancel the blocked jobs
- first.setCanceled(true);
- second.setCanceled(true);
-
- //wait until both jobs are done
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_DONE);
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_DONE);
-
- //end the first job
- status[0] = TestBarrier.STATUS_RUNNING;
- //wait until all jobs are done
- for (int i = 0; i < jobs.length; i++) {
- waitForCompletion(jobs[i]);
- }
-
- //the underlying graph has to be empty
- assertTrue("Jobs not removed from graph.", getLockManager().isEmpty());
- }
-
- /**
- * Test that the graph is cleared after a thread stops waiting for a rule.
- */
- public void testBeginRuleCancelAfterWait() {
- final ISchedulingRule rule1 = new PathRule("/testBeginRuleCancelAfterWait");
- final ISchedulingRule rule2 = new PathRule("/testBeginRuleCancelAfterWait/B");
-
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START};
- final IProgressMonitor canceller = new FussyProgressMonitor();
-
- Job ruleOwner = new Job("Test1") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- status[0] = TestBarrier.STATUS_START;
- manager.beginRule(rule1, null);
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
- manager.endRule(rule1);
- monitor.worked(1);
- } finally {
- monitor.done();
- status[0] = TestBarrier.STATUS_DONE;
- }
- return Status.OK_STATUS;
- }
- };
-
- Job ruleWait = new Job("Test2") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- status[1] = TestBarrier.STATUS_RUNNING;
- manager.beginRule(rule2, canceller);
- monitor.worked(1);
- } finally {
- manager.endRule(rule2);
- monitor.done();
- status[1] = TestBarrier.STATUS_DONE;
- }
- return Status.OK_STATUS;
- }
- };
-
- ruleOwner.schedule();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_START);
-
- //schedule a job that is going to begin a conflicting rule and then cancel the wait
- ruleWait.schedule();
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- //ignore
- }
- //cancel the wait for the rule
- canceller.setCanceled(true);
- //wait until the job completes
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_DONE);
-
- //let the first job finish
- status[0] = TestBarrier.STATUS_RUNNING;
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_DONE);
- waitForCompletion(ruleOwner);
- //the underlying graph should now be empty
- assertTrue("Canceled rule not removed from graph.", getLockManager().isEmpty());
- }
-
- /**
- * Test that implicit rules do not create extraneous entries
- */
- public void testImplicitRules() {
- final int NUM_JOBS = 4;
- final int[] status = new int[NUM_JOBS];
- Arrays.fill(status, TestBarrier.STATUS_WAIT_FOR_START);
- final ISchedulingRule[] rules = {new PathRule("/testImplicitRules"), new PathRule("/testImplicitRules/B"), new PathRule("/testImplicitRules/C"), new PathRule("/testImplicitRules/B/D")};
- Job[] jobs = new Job[NUM_JOBS];
-
- jobs[0] = new Job("Test 0") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- manager.beginRule(rules[3], null);
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
- manager.endRule(rules[3]);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- jobs[1] = new Job("Test 1") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- manager.beginRule(rules[2], null);
- status[1] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_RUNNING);
- manager.endRule(rules[2]);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- jobs[2] = new Job("Test 2") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_START);
- manager.beginRule(rules[0], new TestBlockingMonitor(status, 2));
- status[2] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_RUNNING);
- manager.endRule(rules[0]);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- jobs[3] = new Job("Test 3") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- TestBarrier.waitForStatus(status, 3, TestBarrier.STATUS_START);
- manager.beginRule(rules[1], new TestBlockingMonitor(status, 3));
- status[3] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 3, TestBarrier.STATUS_RUNNING);
- manager.endRule(rules[1]);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- for (int i = 0; i < jobs.length; i++) {
- jobs[i].schedule();
- }
- //wait until the first 2 jobs start
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_WAIT_FOR_RUN);
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_WAIT_FOR_RUN);
- //now let the third job start
- status[2] = TestBarrier.STATUS_START;
- //wait until it blocks on the beginRule call
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_BLOCKED);
-
- //let the fourth job start
- status[3] = TestBarrier.STATUS_START;
- //wait until it blocks on the beginRule call
- TestBarrier.waitForStatus(status, 3, TestBarrier.STATUS_BLOCKED);
-
- //end the first 2 jobs
- status[0] = TestBarrier.STATUS_RUNNING;
- status[1] = TestBarrier.STATUS_RUNNING;
-
- //the third and fourth jobs will now compete in non-deterministic order
- int runningCount = 0;
- long waitStart = System.currentTimeMillis();
- while (runningCount < 2) {
- if (status[2] == TestBarrier.STATUS_WAIT_FOR_RUN) {
- //the third job got the rule - let it finish
- runningCount++;
- status[2] = TestBarrier.STATUS_RUNNING;
- }
- if (status[3] == TestBarrier.STATUS_WAIT_FOR_RUN) {
- //the fourth job got the rule - let it finish
- runningCount++;
- status[3] = TestBarrier.STATUS_RUNNING;
- }
- //timeout if the two jobs don't start within a reasonable time
- long elapsed = System.currentTimeMillis()-waitStart;
- assertTrue("Timeout waiting for job to end: " + elapsed, elapsed < 30000);
- }
- //wait until all jobs are done
- for (int i = 0; i < jobs.length; i++)
- waitForCompletion(jobs[i]);
-
- for (int i = 0; i < jobs.length; i++) {
- assertEquals("10." + i, Job.NONE, jobs[i].getState());
- assertEquals("10." + i, Status.OK_STATUS, jobs[i].getResult());
- }
- //the underlying graph has to be empty
- assertTrue("Jobs not removed from graph.", getLockManager().isEmpty());
- }
-
- /**
- * Regression test for bug 46894. Stale rules left over in graph.
- */
- public void _testRuleHierarchyLockInteraction() {
- final int NUM_JOBS = 5;
- final int[] status = new int[NUM_JOBS];
- Arrays.fill(status, TestBarrier.STATUS_WAIT_FOR_START);
- final ISchedulingRule[] rules = {new PathRule("/A"), new PathRule("/A/B"), new PathRule("/A/C")};
- Job[] jobs = new Job[NUM_JOBS];
-
- jobs[0] = new Job("Test 0") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- manager.beginRule(rules[1], null);
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
- manager.endRule(rules[1]);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- jobs[1] = new Job("Test 1") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_START);
- manager.beginRule(rules[2], null);
- status[1] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_RUNNING);
- manager.endRule(rules[2]);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- jobs[2] = new Job("Test 2") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_START);
- manager.beginRule(rules[0], new TestBlockingMonitor(status, 2));
- status[2] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_RUNNING);
- manager.endRule(rules[0]);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- jobs[3] = new Job("Test 3") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- TestBarrier.waitForStatus(status, 3, TestBarrier.STATUS_START);
- manager.beginRule(rules[2], new TestBlockingMonitor(status, 3));
- status[3] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 3, TestBarrier.STATUS_RUNNING);
- manager.endRule(rules[2]);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- jobs[4] = new Job("Test 4") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- TestBarrier.waitForStatus(status, 4, TestBarrier.STATUS_START);
- manager.beginRule(rules[2], new TestBlockingMonitor(status, 4));
- status[4] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 4, TestBarrier.STATUS_RUNNING);
- manager.endRule(rules[2]);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- for (int i = 0; i < jobs.length; i++) {
- jobs[i].schedule();
- }
- //wait until the first job starts
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_WAIT_FOR_RUN);
- //now let the second job start
- status[1] = TestBarrier.STATUS_START;
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_WAIT_FOR_RUN);
-
- //let the third job register the wait
- status[2] = TestBarrier.STATUS_START;
- //wait until the job is blocked on the scheduling rule
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_BLOCKED);
-
- //let the fourth job register the wait
- status[3] = TestBarrier.STATUS_START;
- //wait until the job is blocked on the scheduling rule
- TestBarrier.waitForStatus(status, 3, TestBarrier.STATUS_BLOCKED);
-
- //end the first job, and the second job
- status[0] = TestBarrier.STATUS_RUNNING;
- status[1] = TestBarrier.STATUS_RUNNING;
-
- //wait until the third job gets the rule
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_WAIT_FOR_RUN);
-
- //let the fifth job start its wait
- status[4] = TestBarrier.STATUS_START;
- TestBarrier.waitForStatus(status, 4, TestBarrier.STATUS_BLOCKED);
-
- //let the third job finish
- status[2] = TestBarrier.STATUS_RUNNING;
-
- //wait until the fourth job gets the rule
- TestBarrier.waitForStatus(status, 3, TestBarrier.STATUS_WAIT_FOR_RUN);
- //let the fourth job end
- status[3] = TestBarrier.STATUS_RUNNING;
-
- //wait until the fifth job gets the rule
- TestBarrier.waitForStatus(status, 4, TestBarrier.STATUS_WAIT_FOR_RUN);
- //let the fifth job end
- status[4] = TestBarrier.STATUS_RUNNING;
-
- for (int i = 0; i < jobs.length; i++) {
- waitForCompletion(jobs[i]);
- }
-
- for (int i = 0; i < jobs.length; i++) {
- assertEquals("10." + i, Job.NONE, jobs[i].getState());
- assertEquals("10." + i, Status.OK_STATUS, jobs[i].getResult());
- }
- //the underlying graph has to be empty
- assertTrue("Jobs not removed from graph.", getLockManager().isEmpty());
- }
-
- /**
- * Test that the deadlock detector resolves deadlock correctly.
- * 60 threads are competing for 6 locks (need to acquire 3 locks at the same time).
- */
- public void testVeryComplex() {
- ArrayList allRunnables = new ArrayList();
- LockManager lockManager = new LockManager();
- OrderedLock lock1 = lockManager.newLock();
- OrderedLock lock2 = lockManager.newLock();
- OrderedLock lock3 = lockManager.newLock();
- OrderedLock lock4 = lockManager.newLock();
- OrderedLock lock5 = lockManager.newLock();
- OrderedLock lock6 = lockManager.newLock();
- createRunnables(new ILock[] {lock1, lock2, lock3}, 10, allRunnables, true);
- createRunnables(new ILock[] {lock2, lock3, lock4}, 10, allRunnables, true);
- createRunnables(new ILock[] {lock3, lock4, lock5}, 10, allRunnables, true);
- createRunnables(new ILock[] {lock4, lock5, lock6}, 10, allRunnables, true);
- createRunnables(new ILock[] {lock5, lock6, lock1}, 10, allRunnables, true);
- createRunnables(new ILock[] {lock6, lock1, lock2}, 10, allRunnables, true);
- start(allRunnables);
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- //ignore
- }
- kill(allRunnables);
-
- for (int i = 0; i < allRunnables.size(); i++) {
- try {
- ((Thread) allRunnables.get(i)).join(100000);
- } catch (InterruptedException e1) {
- //ignore
- }
- assertTrue("1." + i, !((Thread) allRunnables.get(i)).isAlive());
- }
- //the underlying array has to be empty
- assertTrue("Locks not removed from graph.", lockManager.isEmpty());
- }
-
- /**
- * Spin until the given job completes
- */
- private void waitForCompletion(Job job) {
- int i = 0;
- while (job.getState() != Job.NONE) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- //ignore
- }
- assertTrue("Timeout waiting for job to end:" + job, ++i < 100);
- }
- }
-
- /**
- * Spin until the given thread dies
- */
- private void waitForThreadDeath(Thread thread) {
- int i = 0;
- while (thread.isAlive()) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- //ignore
- }
- assertTrue("Timeout waiting for job to end.", ++i < 100);
- }
- }
-
- /**
- * Test a complex scenario of interaction between rules and locks.
- * 15 jobs are competing for 5 rules and 5 locks.
- * Each job must acquire 1 rule and 2 locks in random order.
- */
- public void _testComplexRuleLockInteraction() {
- final int NUM_LOCKS = 5;
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START};
- final ISchedulingRule[] rules = {new PathRule("/A"), new PathRule("/A/B"), new PathRule("/A/C"), new PathRule("/A/B/D"), new PathRule("/A/C/E")};
- final ILock[] locks = {manager.newLock(), manager.newLock(), manager.newLock(), manager.newLock(), manager.newLock()};
- Job[] jobs = new Job[NUM_LOCKS * 3];
- final Random random = new Random();
-
- for (int i = 0; i < jobs.length; i++) {
- jobs[i] = new Job("Test" + i) {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", IProgressMonitor.UNKNOWN);
- while (status[0] != TestBarrier.STATUS_DONE) {
- int indexRule = random.nextInt(NUM_LOCKS);
- int indexLock = random.nextInt(NUM_LOCKS);
- int secondIndex = random.nextInt(NUM_LOCKS);
- if ((indexRule % 2) == 0) {
- manager.beginRule(rules[indexRule], null);
- locks[indexLock].acquire();
- locks[secondIndex].acquire();
- assertTrue(indexRule + ".0", getLockManager().isLockOwner());
- locks[secondIndex].release();
- locks[indexLock].release();
- manager.endRule(rules[indexRule]);
- } else {
- locks[indexLock].acquire();
- manager.beginRule(rules[indexRule], null);
- locks[secondIndex].acquire();
- assertTrue(indexLock + ".0", getLockManager().isLockOwner());
- locks[secondIndex].release();
- manager.endRule(rules[indexRule]);
- locks[indexLock].release();
- }
- monitor.worked(1);
- }
- } catch (RuntimeException e) {
- e.printStackTrace();
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
- jobs[i].schedule();
- }
-
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- //ignore
- }
-
- status[0] = TestBarrier.STATUS_DONE;
-
- for (int i = 0; i < jobs.length; i++) {
- int j = 0;
- while (jobs[i].getState() != Job.NONE) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e1) {
- //ignore
- }
- //sanity check to avoid hanging tests
- assertTrue("Timeout waiting for jobs to finish.", ++j < 1000);
- }
- }
-
- for (int i = 0; i < jobs.length; i++) {
- assertEquals("10." + i, Job.NONE, jobs[i].getState());
- assertEquals("10." + i, Status.OK_STATUS, jobs[i].getResult());
- }
- //the underlying array has to be empty
- assertTrue("Jobs not removed from graph.", getLockManager().isEmpty());
- }
-
- /**
- * Test that when a job with a rule is canceled, no stale entries are left in the graph.
- */
- public void _testJobRuleCancellation() {
- final ISchedulingRule rule = new IdentityRule();
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START};
-
- Job first = new Job("Test1") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- assertTrue("1.0", getLockManager().isLockOwner());
- status[0] = TestBarrier.STATUS_START;
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
- monitor.worked(1);
- } finally {
- monitor.done();
- status[0] = TestBarrier.STATUS_DONE;
- }
- return Status.OK_STATUS;
- }
- };
-
- Job second = new Job("Test2") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- assertTrue("2.0", getLockManager().isLockOwner());
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- first.setRule(rule);
- second.setRule(rule);
-
- first.schedule();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_START);
-
- //schedule a job with the same rule and then cancel it
- second.schedule();
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- //ignore
- }
- second.cancel();
- status[0] = TestBarrier.STATUS_RUNNING;
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_DONE);
- waitForCompletion(first);
- //the underlying graph should now be empty
- assertTrue("Canceled job not removed from graph.", getLockManager().isEmpty());
- }
-
- /**
- * Test that a lock which was acquired several times and then suspended to resolve deadlock
- * is set correctly to the proper depth when it is re-acquired by the thread that used to own it.
- */
- public void _testLockMultipleAcquireThenSuspend() {
- final ISchedulingRule rule = new IdentityRule();
- final ILock lock = manager.newLock();
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START};
-
- Job first = new Job("Test1") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- manager.beginRule(rule, null);
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_START);
- lock.acquire();
- lock.release();
- manager.endRule(rule);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
-
- Job second = new Job("Test2") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- lock.acquire();
- lock.acquire();
- lock.acquire();
- lock.acquire();
- status[1] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_START);
- manager.beginRule(rule, null);
- manager.endRule(rule);
- lock.release();
- status[1] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_RUNNING);
- lock.release();
- lock.release();
- lock.release();
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
- //schedule the jobs
- first.schedule();
- second.schedule();
- //wait until one gets a rule, and the other acquires a lock
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_WAIT_FOR_RUN);
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_WAIT_FOR_RUN);
-
- //let the deadlock happen
- status[0] = TestBarrier.STATUS_START;
- status[1] = TestBarrier.STATUS_START;
-
- //wait until it is resolved and the second job releases the lock once
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_WAIT_FOR_RUN);
-
- //the underlying graph should not be empty yet
- assertTrue("Held lock removed from graph.", !getLockManager().isEmpty());
-
- //wait until the jobs are done
- status[1] = TestBarrier.STATUS_RUNNING;
- waitForCompletion(first);
- waitForCompletion(second);
- //the underlying graph should now be empty
- assertTrue("Jobs not removed from graph.", getLockManager().isEmpty());
- }
-
- private void start(ArrayList allRunnables) {
- for (Iterator it = allRunnables.iterator(); it.hasNext();) {
- RandomTestRunnable r = (RandomTestRunnable) it.next();
- r.start();
- }
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/FamilyTestJob.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/FamilyTestJob.java
deleted file mode 100644
index 55c948f..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/FamilyTestJob.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import org.eclipse.core.tests.harness.TestJob;
-
-/**
- * A test job that belongs to a particular family.
- */
-class FamilyTestJob extends TestJob {
- private int familyType = TestJobFamily.TYPE_NONE;
-
- public FamilyTestJob(String name, int type) {
- super(name);
- familyType = type;
- }
-
- public FamilyTestJob(String name, int ticks, int tickLength, int type) {
- super(name, ticks, tickLength);
- familyType = type;
- }
-
- public boolean belongsTo(Object family) {
- return ((family instanceof TestJobFamily) && (((TestJobFamily) family).getType() == familyType));
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/FussyProgressProvider.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/FussyProgressProvider.java
deleted file mode 100644
index 0b93fb7..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/FussyProgressProvider.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.ProgressProvider;
-import org.eclipse.core.tests.harness.FussyProgressMonitor;
-
-/**
- * Dispatches fussy progress monitors, and sanity checks them when finished.
- */
-public class FussyProgressProvider extends ProgressProvider {
- private ArrayList monitors = new ArrayList();
-
- public IProgressMonitor createMonitor(Job job) {
- //only give a fussy monitor to jobs from runtime tests
- String name = job == null ? "" : job.getClass().getName();
- if (name.indexOf("core.tests.runtime") == -1 && name.indexOf("core.tests.internal.runtime") == -1 && name.indexOf("core.tests.harness") == -1)
- return new NullProgressMonitor();
- IProgressMonitor result = new FussyProgressMonitor(job);
- monitors.add(result);
- return result;
- }
-
- public void sanityCheck() {
- for (Iterator it = monitors.iterator(); it.hasNext();) {
- ((FussyProgressMonitor) it.next()).sanityCheck();
- }
- }
-
- public IProgressMonitor getDefaultMonitor() {
- return createMonitor(null);
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/IJobManagerTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/IJobManagerTest.java
deleted file mode 100644
index cf66b4b..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/IJobManagerTest.java
+++ /dev/null
@@ -1,1692 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import java.util.*;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.core.tests.harness.*;
-
-/**
- * Tests the API of the class IJobManager
- */
-public class IJobManagerTest extends AbstractJobManagerTest {
- class TestJobListener extends JobChangeAdapter {
- private Set scheduled = Collections.synchronizedSet(new HashSet());
-
- public void cancelAllJobs() {
- Job[] jobs = (Job[]) scheduled.toArray(new Job[0]);
- for (int i = 0; i < jobs.length; i++) {
- jobs[i].cancel();
- }
- }
-
- public void done(IJobChangeEvent event) {
- synchronized (IJobManagerTest.this) {
- if (scheduled.remove(event.getJob())) {
- //wake up the waitForCompletion method
- completedJobs++;
- IJobManagerTest.this.notify();
- }
- }
- }
-
- public void scheduled(IJobChangeEvent event) {
- Job job = event.getJob();
- synchronized (IJobManagerTest.this) {
- if (job instanceof TestJob) {
- scheduledJobs++;
- scheduled.add(job);
- }
- }
- }
- }
-
- /**
- * Tests that are timing sensitive cannot be released in automated tests.
- * Set this flag to true to do manual timing sanity tests
- */
- private static final boolean PEDANTIC = false;
-
- protected int completedJobs;
- private IJobChangeListener[] jobListeners;
-
- protected int scheduledJobs;
-
- public static Test suite() {
- return new TestSuite(IJobManagerTest.class);
- // TestSuite suite = new TestSuite();
- // suite.addTest(new IJobManagerTest("testJobFamilyCancel"));
- // return suite;
- }
-
- public IJobManagerTest() {
- super("");
- }
-
- public IJobManagerTest(String name) {
- super(name);
- }
-
- /**
- * Asserts the current job state
- */
- public void assertState(String msg, Job job, int expectedState) {
- int actualState = job.getState();
- if (actualState != expectedState)
- assertTrue(msg + ": expected state: " + printState(expectedState) + " actual state: " + printState(actualState), false);
- }
-
- /**
- * Cancels a list of jobs
- */
- protected void cancel(ArrayList jobs) {
- for (Iterator it = jobs.iterator(); it.hasNext();)
- ((Job) it.next()).cancel();
- }
-
- private String printState(int state) {
- switch (state) {
- case Job.NONE :
- return "NONE";
- case Job.WAITING :
- return "WAITING";
- case Job.SLEEPING :
- return "SLEEPING";
- case Job.RUNNING :
- return "RUNNING";
- }
- return "UNKNOWN";
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- completedJobs = 0;
- scheduledJobs = 0;
- jobListeners = new IJobChangeListener[] {/* new VerboseJobListener(),*/
- new TestJobListener()};
- for (int i = 0; i < jobListeners.length; i++) {
- manager.addJobChangeListener(jobListeners[i]);
- }
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- for (int i = 0; i < jobListeners.length; i++)
- if (jobListeners[i] instanceof TestJobListener)
- ((TestJobListener) jobListeners[i]).cancelAllJobs();
- waitForCompletion();
- for (int i = 0; i < jobListeners.length; i++) {
- manager.removeJobChangeListener(jobListeners[i]);
- }
- super.tearDown();
- // manager.startup();
- }
-
- /**
- * Tests running a job that begins a rule but never ends it
- */
- public void testBeginRuleNoEnd() {
- final PathRule rule = new PathRule("testBeginRuleNoEnd");
- Job job = new Job("testBeginRuleNoEnd") {
- protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask(getName(), 1);
- try {
- Job.getJobManager().beginRule(rule, null);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
- job.schedule();
- try {
- job.join();
- } catch (InterruptedException e) {
- fail("4.99", e);
- }
- //another thread should be able to access the rule now
- try {
- manager.beginRule(rule, null);
- } finally {
- manager.endRule(rule);
- }
- }
-
- public void testBug48073() {
- ISchedulingRule ruleA = new PathRule("/testBug48073");
- ISchedulingRule ruleB = new PathRule("/testBug48073/B");
- ISchedulingRule ruleC = new PathRule("/testBug48073/C");
- TestJob jobA = new TestJob("Job1", 1000, 100);
- TestJob jobB = new TestJob("Job2", 1000, 100);
- TestJob jobC = new TestJob("Job3", 1000, 100);
- jobA.setRule(ruleA);
- jobB.setRule(ruleB);
- jobC.setRule(ruleC);
-
- //B should be running, A blocked by B and C blocked by A
- jobB.schedule();
- sleep(100);
- jobA.schedule();
- sleep(100);
- jobC.schedule();
-
- //cancel and restart A
- jobA.cancel();
- jobA.schedule();
-
- //cancel all jobs
- jobA.cancel();
- jobC.cancel();
- jobB.cancel();
- }
-
- /**
- * Regression test for bug 57656
- */
- public void testBug57656() {
- TestJob jobA = new TestJob("Job1");
- TestJob jobB = new TestJob("Job2");
- //schedule jobA
- jobA.schedule(5000);
- //schedule jobB so it gets behind jobA in the queue
- jobB.schedule(10000);
- //now put jobA to sleep indefinitely
- jobA.sleep();
- //jobB should still run within ten seconds
- waitForCompletion(jobB, 30000);
- }
-
- /**
- * This is a regression test for bug 71448. IJobManager.currentJob was not
- * returning the correct value when executed in a thread that is performing
- * asynchronous completion of a job (i.e., a UI Job)
- */
- public void testCurrentJob() {
- final Thread[] thread = new Thread[1];
- final boolean[] done = new boolean[] {false};
- final boolean[] success = new boolean[] {false};
- //create a job that will complete asynchronously
- final Job job = new Job("Test Job") {
- protected IStatus run(IProgressMonitor monitor) {
- setThread(thread[0]);
- done[0] = true;
- return ASYNC_FINISH;
- }
- };
- //create and run a thread that will run and finish the asynchronous job
- Runnable r = new Runnable() {
- public void run() {
- job.schedule();
- //wait for job to start running
- while (!done[0]) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- //ignore
- }
- }
- //job should now be finishing asynchronously in this thread
- success[0] = job == Job.getJobManager().currentJob();
- job.done(Status.OK_STATUS);
- }
- };
- thread[0] = new Thread(r);
- thread[0].start();
- try {
- thread[0].join();
- } catch (InterruptedException e) {
- //ignore
- }
- //assert that currentJob returned the correct value
- assertTrue("1.0", success[0]);
- }
-
- public void testDelayedJob() {
- //schedule a delayed job and ensure it doesn't start until instructed
- int[] sleepTimes = new int[] {0, 10, 50, 100, 500, 1000, 2000, 2500};
- for (int i = 0; i < sleepTimes.length; i++) {
- long start = System.currentTimeMillis();
- TestJob job = new TestJob("Noop", 0, 0);
- assertEquals("1.0", 0, job.getRunCount());
- job.schedule(sleepTimes[i]);
- waitForCompletion();
- assertEquals("1.1." + i, 1, job.getRunCount());
- long duration = System.currentTimeMillis() - start;
- assertTrue("1.2: duration: " + duration + " sleep: " + sleepTimes[i], duration >= sleepTimes[i]);
- //a no-op job shouldn't take any real time
- if (PEDANTIC)
- assertTrue("1.3: duration: " + duration + " sleep: " + sleepTimes[i], duration < sleepTimes[i] + 1000);
- }
- }
-
- public void testJobFamilyCancel() {
- //test the cancellation of a family of jobs
- final int NUM_JOBS = 20;
- TestJob[] jobs = new TestJob[NUM_JOBS];
- //create two different families of jobs
- TestJobFamily first = new TestJobFamily(TestJobFamily.TYPE_ONE);
- TestJobFamily second = new TestJobFamily(TestJobFamily.TYPE_TWO);
- //need a scheduling rule so that the jobs would be executed one by one
- ISchedulingRule rule = new IdentityRule();
-
- for (int i = 0; i < NUM_JOBS; i++) {
- //assign half the jobs to the first family, the other half to the second family
- if (i % 2 == 0)
- jobs[i] = new FamilyTestJob("TestFirstFamily", 1000000, 10, TestJobFamily.TYPE_ONE);
- else
- /*if(i%2 == 1)*/
- jobs[i] = new FamilyTestJob("TestSecondFamily", 1000000, 10, TestJobFamily.TYPE_TWO);
- jobs[i].setRule(rule);
- jobs[i].schedule();
- }
-
- waitForStart(jobs[0]);
-
- assertState("1.0", jobs[0], Job.RUNNING);
-
- //first job is running, the rest are waiting
- for (int i = 1; i < NUM_JOBS; i++) {
- assertState("1." + i, jobs[i], Job.WAITING);
- }
-
- //cancel the first family of jobs
- manager.cancel(first);
- waitForFamilyCancel(jobs, first);
-
- //the previously running job should have no state
- assertState("2.0", jobs[0], Job.NONE);
- //the first job from the second family should now be running
- waitForStart(jobs[1]);
-
- for (int i = 2; i < NUM_JOBS; i++) {
- //all other jobs in the first family should be removed from the waiting queue
- //no operations can be performed on these jobs until they are scheduled with the manager again
- if (jobs[i].belongsTo(first)) {
- assertState("2." + i, jobs[i], Job.NONE);
- jobs[i].wakeUp();
- assertState("2." + i, jobs[i], Job.NONE);
- jobs[i].sleep();
- assertState("2." + i, jobs[i], Job.NONE);
- }
- //all other jobs in the second family should still be in the waiting queue
- else {
- assertState("3." + i, jobs[i], Job.WAITING);
- }
- }
-
- for (int i = 2; i < NUM_JOBS; i++) {
- //all the jobs in the second family that are waiting to start can now be set to sleep
- if (jobs[i].belongsTo(second)) {
- assertState("4." + i, jobs[i], Job.WAITING);
- assertTrue("5." + i, jobs[i].sleep());
- assertState("6." + i, jobs[i], Job.SLEEPING);
- }
- }
- //cancel the second family of jobs
- manager.cancel(second);
- waitForFamilyCancel(jobs, second);
-
- //the second job should now have no state
- assertState("7.0", jobs[1], Job.NONE);
-
- for (int i = 0; i < NUM_JOBS; i++) {
- //all jobs should now be in the NONE state
- assertState("8." + i, jobs[i], Job.NONE);
- }
- }
-
- public void testJobFamilyFind() {
- //test of finding jobs based on the job family they belong to
- final int NUM_JOBS = 20;
- TestJob[] jobs = new TestJob[NUM_JOBS];
- //create five different families of jobs
- TestJobFamily first = new TestJobFamily(TestJobFamily.TYPE_ONE);
- TestJobFamily second = new TestJobFamily(TestJobFamily.TYPE_TWO);
- TestJobFamily third = new TestJobFamily(TestJobFamily.TYPE_THREE);
- TestJobFamily fourth = new TestJobFamily(TestJobFamily.TYPE_FOUR);
- TestJobFamily fifth = new TestJobFamily(TestJobFamily.TYPE_FIVE);
-
- //need a scheduling rule so that the jobs would be executed one by one
- ISchedulingRule rule = new IdentityRule();
-
- for (int i = 0; i < NUM_JOBS; i++) {
- //assign four jobs to each family
- if (i % 5 == 0)
- jobs[i] = new FamilyTestJob("TestFirstFamily", 1000000, 10, TestJobFamily.TYPE_ONE);
- else if (i % 5 == 1)
- jobs[i] = new FamilyTestJob("TestSecondFamily", 1000000, 10, TestJobFamily.TYPE_TWO);
- else if (i % 5 == 2)
- jobs[i] = new FamilyTestJob("TestThirdFamily", 1000000, 10, TestJobFamily.TYPE_THREE);
- else if (i % 5 == 3)
- jobs[i] = new FamilyTestJob("TestFourthFamily", 1000000, 10, TestJobFamily.TYPE_FOUR);
- else
- /*if(i%5 == 4)*/
- jobs[i] = new FamilyTestJob("TestFifthFamily", 1000000, 10, TestJobFamily.TYPE_FIVE);
-
- jobs[i].setRule(rule);
- jobs[i].schedule();
- }
-
- waitForStart(jobs[0]);
-
- //try finding all jobs by supplying the NULL parameter
- //note that this might find other jobs that are running as a side-effect of the test
- //suites running, such as snapshot
- HashSet allJobs = new HashSet();
- allJobs.addAll(Arrays.asList(jobs));
- Job[] result = manager.find(null);
- assertTrue("1.0", result.length >= NUM_JOBS);
- for (int i = 0; i < result.length; i++) {
- //only test jobs that we know about
- if (allJobs.remove(result[i]))
- assertTrue("1." + i, (result[i].belongsTo(first) || result[i].belongsTo(second) || result[i].belongsTo(third) || result[i].belongsTo(fourth) || result[i].belongsTo(fifth)));
- }
- assertEquals("1.2", 0, allJobs.size());
-
- //try finding all jobs from the first family
- result = manager.find(first);
- assertTrue("2.0", result.length == 4);
- for (int i = 0; i < result.length; i++) {
- assertTrue("2." + (i + 1), result[i].belongsTo(first));
- }
-
- //try finding all jobs from the second family
- result = manager.find(second);
- assertTrue("3.0", result.length == 4);
- for (int i = 0; i < result.length; i++) {
- assertTrue("3." + (i + 1), result[i].belongsTo(second));
- }
-
- //try finding all jobs from the third family
- result = manager.find(third);
- assertTrue("4.0", result.length == 4);
- for (int i = 0; i < result.length; i++) {
- assertTrue("4." + (i + 1), result[i].belongsTo(third));
- }
-
- //try finding all jobs from the fourth family
- result = manager.find(fourth);
- assertTrue("5.0", result.length == 4);
- for (int i = 0; i < result.length; i++) {
- assertTrue("5." + (i + 1), result[i].belongsTo(fourth));
- }
-
- //try finding all jobs from the fifth family
- result = manager.find(fifth);
- assertTrue("6.0", result.length == 4);
- for (int i = 0; i < result.length; i++) {
- assertTrue("6." + (i + 1), result[i].belongsTo(fifth));
- }
-
- //the first job should still be running
- assertState("7.0", jobs[0], Job.RUNNING);
-
- //put the second family of jobs to sleep
- manager.sleep(second);
-
- //cancel the first family of jobs
- manager.cancel(first);
-
- //the third job should start running
- waitForStart(jobs[2]);
- assertState("7.1", jobs[2], Job.RUNNING);
-
- //finding all jobs from the first family should return an empty array
- result = manager.find(first);
- assertEquals("7.2", 0, result.length);
-
- //finding all jobs from the second family should return all the jobs (they are just sleeping)
- result = manager.find(second);
- assertTrue("8.0", result.length == 4);
- for (int i = 0; i < result.length; i++) {
- assertTrue("8." + (i + 1), result[i].belongsTo(second));
- }
-
- //cancel the second family of jobs
- manager.cancel(second);
- //finding all jobs from the second family should now return an empty array
- result = manager.find(second);
- assertEquals("9.0", 0, result.length);
-
- //cancel the fourth family of jobs
- manager.cancel(fourth);
- //finding all jobs from the fourth family should now return an empty array
- result = manager.find(fourth);
- assertEquals("9.1", 0, result.length);
-
- //put the third family of jobs to sleep
- manager.sleep(third);
- //the first job from the third family should still be running
- assertState("9.2", jobs[2], Job.RUNNING);
- //wake up the last job from the third family
- jobs[NUM_JOBS - 3].wakeUp();
- //it should now be in the WAITING state
- assertState("9.3", jobs[NUM_JOBS - 3], Job.WAITING);
-
- //finding all jobs from the third family should return all 4 jobs (1 is running, 1 is waiting, 2 are sleeping)
- result = manager.find(third);
- assertTrue("10.0", result.length == 4);
- for (int i = 0; i < result.length; i++) {
- assertTrue("10." + (i + 1), result[i].belongsTo(third));
- }
-
- //finding all jobs by supplying the NULL parameter should return 8 jobs (4 from the 3rd family, and 4 from the 5th family)
- //note that this might find other jobs that are running as a side-effect of the test
- //suites running, such as snapshot
- allJobs.addAll(Arrays.asList(jobs));
- result = manager.find(null);
- assertTrue("11.0", result.length >= 8);
- for (int i = 0; i < result.length; i++) {
- //only test jobs that we know about
- if (allJobs.remove(result[i]))
- assertTrue("11." + (i + 1), (result[i].belongsTo(third) || result[i].belongsTo(fifth)));
- }
-
- assertEquals("11.2", 12, allJobs.size());
- allJobs.clear();
-
- //cancel the fifth family of jobs
- manager.cancel(fifth);
- //cancel the third family of jobs
- manager.cancel(third);
- waitForFamilyCancel(jobs, third);
-
- //all jobs should now be in the NONE state
- for (int i = 0; i < NUM_JOBS; i++) {
- assertState("12." + i, jobs[i], Job.NONE);
- }
-
- //finding all jobs should return an empty array
- //note that this might find other jobs that are running as a side-effect of the test
- //suites running, such as snapshot
- allJobs.addAll(Arrays.asList(jobs));
- result = manager.find(null);
- assertTrue("13.0", result.length >= 0);
-
- for (int i = 0; i < result.length; i++) {
- //test jobs that we know about should not be found (they should have all been removed)
- if (allJobs.remove(result[i]))
- assertTrue("14." + i, false);
- }
- assertEquals("15.0", NUM_JOBS, allJobs.size());
- allJobs.clear();
- }
-
- public void testJobFamilyJoin() {
- //test the join method on a family of jobs
- final int[] status = new int[1];
- status[0] = TestBarrier.STATUS_WAIT_FOR_START;
- final int NUM_JOBS = 20;
- Job[] jobs = new Job[NUM_JOBS];
- //create two different families of jobs
- final TestJobFamily first = new TestJobFamily(TestJobFamily.TYPE_ONE);
- final TestJobFamily second = new TestJobFamily(TestJobFamily.TYPE_TWO);
- //need two scheduling rule so that jobs in each family would be executing one by one
- ISchedulingRule rule1 = new IdentityRule();
- ISchedulingRule rule2 = new IdentityRule();
- for (int i = 0; i < NUM_JOBS; i++) {
- //assign half the jobs to the first family, the other half to the second family
- if (i % 2 == 0) {
- jobs[i] = new FamilyTestJob("TestFirstFamily", 10, 10, TestJobFamily.TYPE_ONE);
- jobs[i].setRule(rule1);
- jobs[i].schedule(1000000);
- } else /*if(i%2 == 1)*/{
- jobs[i] = new FamilyTestJob("TestSecondFamily", 1000000, 10, TestJobFamily.TYPE_TWO);
- jobs[i].setRule(rule2);
- jobs[i].schedule();
- }
-
- }
-
- Thread t = new Thread(new Runnable() {
- public void run() {
- status[0] = TestBarrier.STATUS_START;
- try {
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_WAIT_FOR_RUN);
- status[0] = TestBarrier.STATUS_RUNNING;
- manager.join(first, null);
- } catch (OperationCanceledException e) {
- //ignore
- } catch (InterruptedException e) {
- //ignore
- }
- status[0] = TestBarrier.STATUS_DONE;
- }
- });
-
- //start the thread that will join the first family of jobs and be blocked until they finish execution
- t.start();
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_START);
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
- //wake up the first family of jobs
- manager.wakeUp(first);
-
- int i = 0;
- for (; i < 100; i++) {
- int currentStatus = status[0];
- Job[] result = manager.find(first);
-
- //if the thread is complete then all jobs must be done
- if (currentStatus == TestBarrier.STATUS_DONE) {
- assertTrue("2." + i, result.length == 0);
- break;
- }
- sleep(100);
- }
- assertTrue("2.0", i < 100);
-
- //cancel the second family of jobs
- manager.cancel(second);
- waitForFamilyCancel(jobs, second);
-
- //all the jobs should now be in the NONE state
- for (int j = 0; j < NUM_JOBS; j++) {
- assertState("3." + j, jobs[j], Job.NONE);
- }
- }
-
- public void testJobFamilyJoinCancelJobs() {
- //test the join method on a family of jobs, then cancel the jobs that are blocking the join call
- final int[] status = new int[1];
- status[0] = TestBarrier.STATUS_WAIT_FOR_START;
- final int NUM_JOBS = 20;
- TestJob[] jobs = new TestJob[NUM_JOBS];
- //create two different families of jobs
- final TestJobFamily first = new TestJobFamily(TestJobFamily.TYPE_ONE);
- final TestJobFamily second = new TestJobFamily(TestJobFamily.TYPE_TWO);
- //need two scheduling rule so that jobs in each family would be executing one by one
- ISchedulingRule rule1 = new IdentityRule();
- ISchedulingRule rule2 = new IdentityRule();
- for (int i = 0; i < NUM_JOBS; i++) {
- //assign half the jobs to the first family, the other half to the second family
- if (i % 2 == 0) {
- jobs[i] = new FamilyTestJob("TestFirstFamily", 1000000, 10, TestJobFamily.TYPE_ONE);
- jobs[i].setRule(rule1);
- } else /*if(i%2 == 1)*/{
- jobs[i] = new FamilyTestJob("TestSecondFamily", 1000000, 10, TestJobFamily.TYPE_TWO);
- jobs[i].setRule(rule2);
- }
- jobs[i].schedule();
-
- }
-
- Thread t = new Thread(new Runnable() {
- public void run() {
- status[0] = TestBarrier.STATUS_START;
- try {
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_WAIT_FOR_RUN);
- status[0] = TestBarrier.STATUS_RUNNING;
- manager.join(first, null);
- } catch (OperationCanceledException e) {
- //ignore
- } catch (InterruptedException e) {
- //ignore
- }
- status[0] = TestBarrier.STATUS_DONE;
- }
- });
-
- //start the thread that will join the first family of jobs
- //it will be blocked until the all jobs in the first family finish execution or are canceled
- t.start();
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_START);
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
- waitForStart(jobs[0]);
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
-
- assertState("2.0", jobs[0], Job.RUNNING);
- assertTrue("2.1", status[0] == TestBarrier.STATUS_RUNNING);
-
- //cancel the first family of jobs
- //the join call should be unblocked when all the jobs are canceled
- manager.cancel(first);
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_DONE);
-
- //all jobs in the first family should be removed from the manager
- assertTrue("2.2", manager.find(first).length == 0);
-
- //cancel the second family of jobs
- manager.cancel(second);
- waitForFamilyCancel(jobs, second);
-
- //all the jobs should now be in the NONE state
- for (int j = 0; j < NUM_JOBS; j++) {
- assertState("3." + j, jobs[j], Job.NONE);
- }
- }
-
- public void testJobFamilyJoinCancelManager() {
- //test the join method on a family of jobs, then cancel the call
- final int[] status = new int[1];
- status[0] = TestBarrier.STATUS_WAIT_FOR_START;
- final int NUM_JOBS = 20;
- TestJob[] jobs = new TestJob[NUM_JOBS];
- //create a progress monitor to cancel the join call
- final IProgressMonitor canceller = new FussyProgressMonitor();
- //create two different families of jobs
- final TestJobFamily first = new TestJobFamily(TestJobFamily.TYPE_ONE);
- final TestJobFamily second = new TestJobFamily(TestJobFamily.TYPE_TWO);
- //need two scheduling rule so that jobs in each family would be executing one by one
- ISchedulingRule rule1 = new IdentityRule();
- ISchedulingRule rule2 = new IdentityRule();
- for (int i = 0; i < NUM_JOBS; i++) {
- //assign half the jobs to the first family, the other half to the second family
- if (i % 2 == 0) {
- jobs[i] = new FamilyTestJob("TestFirstFamily", 1000000, 10, TestJobFamily.TYPE_ONE);
- jobs[i].setRule(rule1);
- } else /*if(i%2 == 1)*/{
- jobs[i] = new FamilyTestJob("TestSecondFamily", 1000000, 10, TestJobFamily.TYPE_TWO);
- jobs[i].setRule(rule2);
- }
- jobs[i].schedule();
-
- }
-
- Thread t = new Thread(new Runnable() {
- public void run() {
- status[0] = TestBarrier.STATUS_START;
- try {
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_WAIT_FOR_RUN);
- status[0] = TestBarrier.STATUS_RUNNING;
- manager.join(first, canceller);
- } catch (OperationCanceledException e) {
- //ignore
- } catch (InterruptedException e) {
- //ignore
- }
- status[0] = TestBarrier.STATUS_DONE;
- }
- });
-
- //start the thread that will join the first family of jobs
- //it will be blocked until the cancel call is made to the thread
- t.start();
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_START);
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
- waitForStart(jobs[0]);
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
-
- assertState("2.0", jobs[0], Job.RUNNING);
- assertTrue("2.1", status[0] == TestBarrier.STATUS_RUNNING);
-
- //cancel the monitor that is attached to the join call
- canceller.setCanceled(true);
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_DONE);
-
- //the first job in the first family should still be running
- assertState("2.2", jobs[0], Job.RUNNING);
- assertTrue("2.3", status[0] == TestBarrier.STATUS_DONE);
- assertTrue("2.4", manager.find(first).length > 0);
-
- //cancel the second family of jobs
- manager.cancel(second);
- waitForFamilyCancel(jobs, second);
-
- //cancel the first family of jobs
- manager.cancel(first);
- waitForFamilyCancel(jobs, first);
-
- //all the jobs should now be in the NONE state
- for (int j = 0; j < NUM_JOBS; j++) {
- assertState("3." + j, jobs[j], Job.NONE);
- }
- }
-
- /**
- * Asserts that the LockListener is called correctly during invocation of
- * {@link IJobManager#join(Object, IProgressMonitor)}.
- * See bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=195839.
- */
- public void testJobFamilyJoinLockListener() {
- final TestJobFamily family = new TestJobFamily(TestJobFamily.TYPE_ONE);
- int count = 5;
- Job[] jobs = new Job[count];
- for (int i = 0; i < jobs.length; i++) {
- jobs[i] = new FamilyTestJob("TestJobFamilyJoinLockListener" + i, 5, 500, family.getType());
- jobs[i].schedule();
- }
- TestLockListener lockListener = new TestLockListener();
- try {
- manager.setLockListener(lockListener);
- manager.join(family, new FussyProgressMonitor());
- } catch (OperationCanceledException e) {
- fail("4.99", e);
- } catch (InterruptedException e) {
- fail("4.99", e);
- } finally {
- manager.setLockListener(null);
- }
- lockListener.assertNotWaiting("1.0");
- }
-
- public void testJobFamilyJoinNothing() {
- //test joining a bogus family, and the monitor should be used up
- try {
- final FussyProgressMonitor monitor = new FussyProgressMonitor();
- monitor.prepare();
- manager.join(new Object(), monitor);
- monitor.sanityCheck();
- monitor.assertUsedUp();
- } catch (OperationCanceledException e) {
- fail("4.99", e);
- } catch (InterruptedException e) {
- fail("4.99", e);
- }
- }
-
- /**
- * Tests joining a job that repeats in a loop
- */
- public void testJobFamilyJoinRepeating() {
- Object family = new Object();
- int count = 25;
- RepeatingJob job = new RepeatingJob("testJobFamilyJoinRepeating", count);
- job.setFamily(family);
- job.schedule();
- try {
- Job.getJobManager().join(family, null);
- } catch (OperationCanceledException e) {
- fail("1.0", e);
- } catch (InterruptedException e) {
- fail("1.1", e);
- }
- //ensure the job has run the expected number of times
- assertEquals("1.2", count, job.getRunCount());
- }
-
- /**
- * Tests joining a job family that repeats but returns false to shouldSchedule
- */
- public void testJobFamilyJoinShouldSchedule() {
- Object family = new Object();
- final int count = 1;
- RepeatingJob job = new RepeatingJob("testJobFamilyJoinShouldSchedule", count) {
- public boolean shouldSchedule() {
- return shouldRun();
- }
- };
- job.setFamily(family);
- job.schedule();
- try {
- Job.getJobManager().join(family, null);
- } catch (OperationCanceledException e) {
- fail("1.0", e);
- } catch (InterruptedException e) {
- fail("1.1", e);
- }
- //ensure the job has run the expected number of times
- assertEquals("1.2", count, job.getRunCount());
- }
-
- /**
- * Tests simple usage of the IJobManager.join() method.
- */
- public void testJobFamilyJoinSimple() {
- //test the join method on a family of jobs that is empty
- final int[] status = new int[1];
- status[0] = TestBarrier.STATUS_WAIT_FOR_START;
- final int NUM_JOBS = 20;
- TestJob[] jobs = new TestJob[NUM_JOBS];
- //create three different families of jobs
- final TestJobFamily first = new TestJobFamily(TestJobFamily.TYPE_ONE);
- final TestJobFamily second = new TestJobFamily(TestJobFamily.TYPE_TWO);
- final TestJobFamily third = new TestJobFamily(TestJobFamily.TYPE_THREE);
- //need two scheduling rule so that jobs in each family would be executing one by one
- ISchedulingRule rule1 = new IdentityRule();
- ISchedulingRule rule2 = new IdentityRule();
- for (int i = 0; i < NUM_JOBS; i++) {
- //assign half the jobs to the first family, the other half to the second family
- if (i % 2 == 0) {
- jobs[i] = new FamilyTestJob("TestFirstFamily", 1000000, 10, TestJobFamily.TYPE_ONE);
- jobs[i].setRule(rule1);
- } else /*if(i%2 == 1)*/{
- jobs[i] = new FamilyTestJob("TestSecondFamily", 1000000, 10, TestJobFamily.TYPE_TWO);
- jobs[i].setRule(rule2);
- }
-
- jobs[i].schedule();
- }
-
- Thread t = new Thread(new Runnable() {
- public void run() {
- status[0] = TestBarrier.STATUS_START;
- try {
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_WAIT_FOR_RUN);
- status[0] = TestBarrier.STATUS_RUNNING;
- manager.join(third, null);
- } catch (OperationCanceledException e) {
- //ignore
- } catch (InterruptedException e) {
- //ignore
- }
- status[0] = TestBarrier.STATUS_DONE;
- }
- });
-
- //try joining the third family of jobs, which is empty
- //join method should return without blocking
- waitForStart(jobs[0]);
- t.start();
-
- //let the thread execute the join call
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_START);
- assertTrue("1.0", status[0] == TestBarrier.STATUS_START);
- long startTime = System.currentTimeMillis();
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_DONE);
- long endTime = System.currentTimeMillis();
-
- assertTrue("2.0", status[0] == TestBarrier.STATUS_DONE);
- assertTrue("2.1", endTime > startTime);
-
- //the join call should take no actual time (join call should not block thread at all)
- if (PEDANTIC)
- assertTrue("2.2 start time: " + startTime + " end time: " + endTime, (endTime - startTime) < 300);
-
- //cancel all jobs
- manager.cancel(first);
- manager.cancel(second);
- waitForFamilyCancel(jobs, first);
- waitForFamilyCancel(jobs, second);
-
- //all the jobs should now be in the NONE state
- for (int j = 0; j < NUM_JOBS; j++) {
- assertState("3." + j, jobs[j], Job.NONE);
- }
- }
-
- public void testJobFamilyNULL() {
- //test methods that accept the null job family (i.e. all jobs)
- final int NUM_JOBS = 20;
- TestJob[] jobs = new TestJob[NUM_JOBS];
- //create two different families of jobs
- TestJobFamily first = new TestJobFamily(TestJobFamily.TYPE_ONE);
- TestJobFamily second = new TestJobFamily(TestJobFamily.TYPE_TWO);
- //need one common scheduling rule so that the jobs would be executed one by one
- ISchedulingRule rule = new IdentityRule();
- for (int i = 0; i < NUM_JOBS; i++) {
- //assign half the jobs to the first family, the other half to the second family
- if (i % 2 == 0)
- jobs[i] = new FamilyTestJob("TestFirstFamily", 1000000, 10, TestJobFamily.TYPE_ONE);
- else
- /*if(i%2 == 1)*/
- jobs[i] = new FamilyTestJob("TestSecondFamily", 1000000, 10, TestJobFamily.TYPE_TWO);
-
- jobs[i].setRule(rule);
- jobs[i].schedule();
- }
-
- waitForStart(jobs[0]);
- assertState("1.0", jobs[0], Job.RUNNING);
-
- //put all jobs to sleep
- manager.sleep(null);
- //the first job should still be running
- assertState("2.0", jobs[0], Job.RUNNING);
-
- //all the other jobs should be sleeping
- for (int i = 1; i < NUM_JOBS; i++) {
- assertState("2." + i, jobs[i], Job.SLEEPING);
- }
-
- //wake up all the jobs
- manager.wakeUp(null);
- //the first job should still be running
- assertState("3.0", jobs[0], Job.RUNNING);
-
- //all the other jobs should be waiting
- for (int i = 1; i < NUM_JOBS; i++) {
- assertState("3." + i, jobs[i], Job.WAITING);
- }
-
- //cancel all the jobs
- manager.cancel(first);
- manager.cancel(second);
- waitForFamilyCancel(jobs, first);
- waitForFamilyCancel(jobs, second);
-
- //all the jobs should now be in the NONE state
- for (int i = 0; i < NUM_JOBS; i++) {
- assertState("4." + i, jobs[i], Job.NONE);
- }
-
- }
-
- public void testJobFamilySleep() {
- //test the sleep method on a family of jobs
- final int NUM_JOBS = 20;
- TestJob[] jobs = new TestJob[NUM_JOBS];
- //create two different families of jobs
- TestJobFamily first = new TestJobFamily(TestJobFamily.TYPE_ONE);
- TestJobFamily second = new TestJobFamily(TestJobFamily.TYPE_TWO);
- //need a common scheduling rule so that the jobs would be executed one by one
- ISchedulingRule rule = new IdentityRule();
- for (int i = 0; i < NUM_JOBS; i++) {
- //assign half the jobs to the first family, the other half to the second family
- if (i % 2 == 0)
- jobs[i] = new FamilyTestJob("TestFirstFamily", 1000000, 10, TestJobFamily.TYPE_ONE);
- else
- /*if(i%2 == 1)*/
- jobs[i] = new FamilyTestJob("TestSecondFamily", 1000000, 10, TestJobFamily.TYPE_TWO);
-
- jobs[i].setRule(rule);
- jobs[i].schedule();
- }
-
- waitForStart(jobs[0]);
-
- assertState("1.0", jobs[0], Job.RUNNING);
-
- //first job is running, the rest are waiting
- for (int i = 1; i < NUM_JOBS; i++) {
- assertState("1." + i, jobs[i], Job.WAITING);
- }
-
- //set the first family of jobs to sleep
- manager.sleep(first);
-
- //the running job should still be running
- assertState("2.0", jobs[0], Job.RUNNING);
-
- for (int i = 1; i < NUM_JOBS; i++) {
- //all other jobs in the first family should be sleeping
- //they can now be canceled
- if (jobs[i].belongsTo(first)) {
- assertState("2." + i, jobs[i], Job.SLEEPING);
- jobs[i].cancel();
- }
- //all jobs in the second family should still be in the waiting queue
- else {
- assertState("3." + i, jobs[i], Job.WAITING);
- }
- }
-
- manager.sleep(second);
- //cancel the running job
- jobs[0].cancel();
- waitForCancel(jobs[0]);
-
- //no job should now be running
- assertTrue("4.0", manager.currentJob() == null);
-
- for (int i = 1; i < NUM_JOBS; i++) {
- //all other jobs in the second family should be sleeping
- //they can now be canceled
- if (jobs[i].belongsTo(second)) {
- assertState("4." + i, jobs[i], Job.SLEEPING);
- jobs[i].cancel();
- }
- }
-
- //all the jobs should now be in the NONE state
- for (int i = 0; i < NUM_JOBS; i++) {
- assertState("5." + i, jobs[i], Job.NONE);
- }
- }
-
- /**
- * Tests the API method IJobManager.wakeUp(family)
- */
- public void testJobFamilyWakeUp() {
- //disabled due to bug 109898
- if (true)
- return;
- final int JOBS_PER_FAMILY = 10;
- //create two different families of jobs
- Job[] family1 = new Job[JOBS_PER_FAMILY];
- Job[] family2 = new Job[JOBS_PER_FAMILY];
- TestJobFamily first = new TestJobFamily(TestJobFamily.TYPE_ONE);
- TestJobFamily second = new TestJobFamily(TestJobFamily.TYPE_TWO);
- //need one common scheduling rule so that the jobs would be executed one by one
- ISchedulingRule rule = new IdentityRule();
- //create and schedule a seed job that will cause all others to be blocked
- TestJob seedJob = new FamilyTestJob("SeedJob", 1000000, 10, TestJobFamily.TYPE_THREE);
- seedJob.setRule(rule);
- seedJob.schedule();
- waitForStart(seedJob);
- assertState("1.0", seedJob, Job.RUNNING);
-
- //create jobs in first family and put them to sleep
- for (int i = 0; i < JOBS_PER_FAMILY; i++) {
- family1[i] = new FamilyTestJob("TestFirstFamily", 1000000, 10, TestJobFamily.TYPE_ONE);
- family1[i].setRule(rule);
- family1[i].schedule();
- assertState("1.1." + i, family1[i], Job.WAITING);
- assertTrue("1.2." + i, family1[i].sleep());
- assertState("1.3." + i, family1[i], Job.SLEEPING);
- }
- //create jobs in second family and put them to sleep
- for (int i = 0; i < JOBS_PER_FAMILY; i++) {
- family2[i] = new FamilyTestJob("TestSecondFamily", 1000000, 10, TestJobFamily.TYPE_TWO);
- family2[i].setRule(rule);
- family2[i].schedule();
- assertState("2.1." + i, family2[i], Job.WAITING);
- assertTrue("2.2." + i, family2[i].sleep());
- assertState("2.3." + i, family2[i], Job.SLEEPING);
- }
-
- //cancel the seed job
- seedJob.cancel();
- waitForCancel(seedJob);
- assertState("3.0", seedJob, Job.NONE);
-
- //all family jobs should still be sleeping
- for (int i = 0; i < JOBS_PER_FAMILY; i++)
- assertState("3.1." + i, family1[i], Job.SLEEPING);
- for (int i = 0; i < JOBS_PER_FAMILY; i++)
- assertState("3.2." + i, family2[i], Job.SLEEPING);
-
- //wake-up the second family of jobs
- manager.wakeUp(second);
-
- //jobs in the first family should still be in the sleep state
- for (int i = 0; i < JOBS_PER_FAMILY; i++)
- assertState("4.1." + i, family1[i], Job.SLEEPING);
- //ensure all jobs in second family are either running or waiting
- int runningCount = 0;
- for (int i = 0; i < JOBS_PER_FAMILY; i++) {
- if (family2[i].getState() == Job.RUNNING)
- runningCount++;
- else
- assertState("4.2." + i, family2[i], Job.WAITING);
- }
- //ensure only one job is running (it is possible that none have started yet)
- assertTrue("4.running", runningCount <= 1);
-
- //cycle through the jobs in the second family and cancel them
- for (int i = 0; i < JOBS_PER_FAMILY; i++) {
- //the running job may not respond immediately
- if (!family2[i].cancel())
- waitForCancel(family2[i]);
- assertState("5." + i, family2[i], Job.NONE);
- }
-
- //all jobs in the first family should still be sleeping
- for (int i = 0; i < JOBS_PER_FAMILY; i++)
- assertState("6.1." + i, family1[i], Job.SLEEPING);
-
- //wake up the first family
- manager.wakeUp(first);
-
- //ensure all jobs in first family are either running or waiting
- runningCount = 0;
- for (int i = 0; i < JOBS_PER_FAMILY; i++) {
- if (family1[i].getState() == Job.RUNNING)
- runningCount++;
- else
- assertState("7.1." + i, family1[i], Job.WAITING);
- }
- //ensure only one job is running (it is possible that none have started yet)
- assertTrue("7.running", runningCount <= 1);
-
- //cycle through the jobs in the first family and cancel them
- for (int i = 0; i < JOBS_PER_FAMILY; i++) {
- //the running job may not respond immediately
- if (!family1[i].cancel())
- waitForCancel(family1[i]);
- assertState("8." + i, family1[i], Job.NONE);
- }
-
- //all jobs should now be in the NONE state
- for (int i = 0; i < JOBS_PER_FAMILY; i++)
- assertState("9.1." + i, family1[i], Job.NONE);
- for (int i = 0; i < JOBS_PER_FAMILY; i++)
- assertState("9.2." + i, family2[i], Job.NONE);
- }
-
- public void testMutexRule() {
- final int JOB_COUNT = 10;
- TestJob[] jobs = new TestJob[JOB_COUNT];
- ISchedulingRule mutex = new IdentityRule();
- for (int i = 0; i < JOB_COUNT; i++) {
- jobs[i] = new TestJob("testMutexRule", 1000000, 10);
- jobs[i].setRule(mutex);
- jobs[i].schedule();
- }
- //first job should be running, all others should be waiting
- waitForStart(jobs[0]);
- assertState("1.0", jobs[0], Job.RUNNING);
- for (int i = 1; i < JOB_COUNT; i++) {
- assertState("1.1." + i, jobs[i], Job.WAITING);
- }
- //cancel job i, then i+1 should run and all others should wait
- for (int i = 0; i < JOB_COUNT - 1; i++) {
- jobs[i].cancel();
- waitForStart(jobs[i + 1]);
- assertState("2.0." + i, jobs[i + 1], Job.RUNNING);
- for (int j = i + 2; j < JOB_COUNT; j++) {
- assertState("2.1" + i + "." + j, jobs[j], Job.WAITING);
- }
- }
- //cancel the final job
- jobs[JOB_COUNT - 1].cancel();
- }
-
- public void testOrder() {
- //ensure jobs are run in order from lowest to highest sleep time.
- final List done = Collections.synchronizedList(new ArrayList());
- IJobChangeListener listener = new JobChangeAdapter() {
- public void done(IJobChangeEvent event) {
- if (event.getJob() instanceof TestJob)
- done.add(event.getJob());
- }
- };
- int[] sleepTimes = new int[] {50, 250, 500, 800, 1000, 1500};
- Job[] jobs = new Job[sleepTimes.length];
- manager.addJobChangeListener(listener);
- try {
- for (int i = 0; i < sleepTimes.length; i++)
- jobs[i] = new TestJob("testOrder(" + i + ")", 1, 1);
- for (int i = 0; i < sleepTimes.length; i++)
- jobs[i].schedule(sleepTimes[i]);
- waitForCompletion();
- //make sure listener has had a chance to process the finished job
- while (done.size() != jobs.length) {
- Thread.yield();
- sleep(100);
- }
- Job[] doneOrder = (Job[]) done.toArray(new Job[done.size()]);
- assertEquals("1.0", jobs.length, doneOrder.length);
- for (int i = 0; i < doneOrder.length; i++)
- assertEquals("1.1." + i, jobs[i], doneOrder[i]);
- } finally {
- manager.removeJobChangeListener(listener);
- }
- }
-
- public void testReverseOrder() {
- //ensure jobs are run in order from lowest to highest sleep time.
- final List done = Collections.synchronizedList(new ArrayList());
- IJobChangeListener listener = new JobChangeAdapter() {
- public void done(IJobChangeEvent event) {
- if (event.getJob() instanceof TestJob)
- //add at start of list to get reverse order
- done.add(0, event.getJob());
- }
- };
- int[] sleepTimes = new int[] {4000, 3000, 2000, 1000, 500};
- Job[] jobs = new Job[sleepTimes.length];
- manager.addJobChangeListener(listener);
- try {
- for (int i = 0; i < sleepTimes.length; i++)
- jobs[i] = new TestJob("testReverseOrder(" + i + ")", 0, 1);
- for (int i = 0; i < sleepTimes.length; i++)
- jobs[i].schedule(sleepTimes[i]);
- waitForCompletion();
- //make sure listener has had a chance to process the finished job
- while (done.size() != jobs.length) {
- Thread.yield();
- sleep(100);
- }
- Job[] doneOrder = (Job[]) done.toArray(new Job[done.size()]);
- assertEquals("1.0", jobs.length, doneOrder.length);
- for (int i = 0; i < doneOrder.length; i++)
- assertEquals("1.1." + i, jobs[i], doneOrder[i]);
- } finally {
- manager.removeJobChangeListener(listener);
- }
- }
-
- /**
- * Tests conditions where there is a race to schedule the same job multiple times.
- */
- public void testScheduleRace() {
- final int[] count = new int[1];
- final boolean[] running = new boolean[] {false};
- final boolean[] failure = new boolean[] {false};
- final Job testJob = new Job("testScheduleRace") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- synchronized (running) {
- //indicate job is running, and assert the job is not already running
- if (running[0])
- failure[0] = true;
- else
- running[0] = true;
- }
- //sleep for awhile to let duplicate job start running
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- //ignore
- } finally {
- synchronized (running) {
- running[0] = false;
- }
- }
- return Status.OK_STATUS;
- }
- };
- testJob.addJobChangeListener(new JobChangeAdapter() {
- public void scheduled(IJobChangeEvent event) {
- while (count[0]++ < 2) {
- testJob.schedule();
- }
- }
- });
- testJob.schedule();
- waitForCompletion(testJob, 5000);
- assertTrue("1.0", !failure[0]);
- }
-
- public void testSimple() {
- final int JOB_COUNT = 10;
- for (int i = 0; i < JOB_COUNT; i++) {
- new TestJob("testSimple").schedule();
- }
- waitForCompletion();
- //
- for (int i = 0; i < JOB_COUNT; i++) {
- new TestJob("testSimple").schedule(50);
- }
- waitForCompletion();
- }
-
- public void testSleep() {
- TestJob job = new TestJob("ParentJob", 10, 100);
- //sleeping a job that isn't scheduled should have no effect
- assertEquals("1.0", Job.NONE, job.getState());
- assertTrue("1.1", job.sleep());
- assertEquals("1.2", Job.NONE, job.getState());
-
- //sleeping a job that is already running should not work
- job.schedule();
- //give the job a chance to start
- waitForStart(job);
- assertState("2.0", job, Job.RUNNING);
- assertTrue("2.1", !job.sleep());
- assertState("2.2", job, Job.RUNNING);
-
- waitForCompletion();
-
- //sleeping a job that is already sleeping should make sure it never runs
- job.schedule(500);
- assertState("3.0", job, Job.SLEEPING);
- assertTrue("3.1", job.sleep());
- assertState("3.2", job, Job.SLEEPING);
- //wait awhile and ensure the job is still sleeping
- Thread.yield();
- sleep(600);
- Thread.yield();
- assertState("3.3", job, Job.SLEEPING);
- assertTrue("3.4", job.cancel()); //should be possible to cancel a sleeping job
- }
-
- public void testSleepOnWait() {
- final ISchedulingRule rule = new PathRule("testSleepOnWait");
- TestJob blockingJob = new TestJob("Long Job", 1000000, 10);
- blockingJob.setRule(rule);
- blockingJob.schedule();
-
- TestJob job = new TestJob("Long Job", 1000000, 10);
- job.setRule(rule);
- job.schedule();
- //we know this job is waiting, so putting it to sleep should prevent it from running
- assertState("1.0", job, Job.WAITING);
- assertTrue("1.1", job.sleep());
- assertState("1.2", job, Job.SLEEPING);
-
- //cancel the blocking job, thus freeing the pool for the waiting job
- blockingJob.cancel();
-
- //make sure the job is still sleeping
- assertState("1.3", job, Job.SLEEPING);
-
- //now wake the job up
- job.wakeUp();
- waitForStart(job);
- assertState("2.0", job, Job.RUNNING);
-
- //finally cancel the job
- job.cancel();
- waitForCompletion(job);
- }
-
- public void testSuspend() {
- assertTrue("1.0", !manager.isSuspended());
- manager.suspend();
- try {
- assertTrue("1.1", manager.isSuspended());
- } finally {
- manager.resume();
- }
- assertTrue("1.1", !manager.isSuspended());
- }
-
- /**
- * Tests the following sequence:
- * [Thread[main,6,main]]Suspend rule: R/
- * [Thread[main,6,main]]Begin rule: R/
- * [Thread[Worker-3,5,main]]Begin rule: L/JUnit/junit/tests/framework/Failure.java
- * [Thread[main,6,main]]End rule: R/
- * [Thread[main,6,main]]Resume rule: R/
- * [Thread[Worker-3,5,main]]End rule: L/JUnit/junit/tests/framework/Failure.java
- * @deprecated tests deprecated API
- */
- public void testSuspendMismatchedBegins() {
- PathRule rule1 = new PathRule("/TestSuspendMismatchedBegins");
- PathRule rule2 = new PathRule("/TestSuspendMismatchedBegins/Child");
- manager.suspend(rule1, null);
-
- //start a job that acquires a child rule
- TestBarrier barrier = new TestBarrier();
- JobRuleRunner runner = new JobRuleRunner("TestSuspendJob", rule2, barrier, 1, true);
- runner.schedule();
- barrier.waitForStatus(TestBarrier.STATUS_START);
- //let the job start the rule
- barrier.setStatus(TestBarrier.STATUS_WAIT_FOR_RUN);
- barrier.waitForStatus(TestBarrier.STATUS_RUNNING);
-
- //now try to resume the rule in this thread
- manager.resume(rule1);
-
- //finally let the test runner resume the rule
- barrier.setStatus(TestBarrier.STATUS_WAIT_FOR_DONE);
- barrier.waitForStatus(TestBarrier.STATUS_DONE);
- waitForCompletion(runner);
-
- }
-
- /**
- * Tests IJobManager suspend and resume API
- * @deprecated tests deprecated API
- */
- public void testSuspendMultiThreadAccess() {
- PathRule rule1 = new PathRule("/TestSuspend");
- PathRule rule2 = new PathRule("/TestSuspend/Child");
- manager.suspend(rule1, null);
-
- //should not be able to run a job that uses the rule
- Job job = new Job("TestSuspend") {
- protected IStatus run(IProgressMonitor monitor) {
- return Status.OK_STATUS;
- }
- };
- job.setRule(rule1);
- job.schedule();
- //give the job a chance to run
- sleep(200);
- assertNull("1.0", job.getResult());
-
- //should be able to run a thread that begins the rule
- int[] status = new int[1];
- SimpleRuleRunner runner = new SimpleRuleRunner(rule1, status, null);
- new Thread(runner).start();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_DONE);
-
- //should be able to run a thread that begins a conflicting rule
- status[0] = 0;
- runner = new SimpleRuleRunner(rule2, status, null);
- new Thread(runner).start();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_DONE);
-
- //now begin the rule in this thread
- manager.beginRule(rule1, null);
-
- //should still be able to run a thread that begins the rule
- status[0] = 0;
- runner = new SimpleRuleRunner(rule1, status, null);
- new Thread(runner).start();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_DONE);
-
- //our job should still not have executed
- sleep(100);
- assertNull("1.1", job.getResult());
-
- //even ending the rule in this thread should not allow the job to continue
- manager.endRule(rule1);
- sleep(100);
- assertNull("1.2", job.getResult());
-
- //should still be able to run a thread that begins the rule
- status[0] = 0;
- runner = new SimpleRuleRunner(rule1, status, null);
- new Thread(runner).start();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_DONE);
-
- //finally resume the rule in this thread
- manager.resume(rule1);
-
- //job should now complete
- waitForCompletion(job);
-
- }
-
- /**
- * Tests IJobManager#transfer(ISchedulingRule, Thread) failure conditions.
- */
- public void testTransferFailure() {
- PathRule rule = new PathRule("/testTransferFailure");
- PathRule subRule = new PathRule("/testTransferFailure/Sub");
- Thread other = new Thread();
- //can't transfer a rule this thread doesn't own it
- try {
- manager.transferRule(rule, other);
- fail("1.0");
- } catch (RuntimeException e) {
- //expected
- }
- try {
- manager.beginRule(rule, null);
- //can't transfer a child rule of a rule currently owned by the caller
- try {
- manager.transferRule(subRule, other);
- fail("1.1");
- } catch (RuntimeException e) {
- //expected
- }
- //TODO This test is failing
- //can't transfer a rule when the destination already owns an unrelated rule
- TestBarrier barrier = new TestBarrier();
- ISchedulingRule unrelatedRule = new PathRule("UnrelatedRule");
- JobRuleRunner ruleRunner = new JobRuleRunner("testTransferFailure", unrelatedRule, barrier, 1, false);
- ruleRunner.schedule();
- //wait for runner to start
- barrier.waitForStatus(TestBarrier.STATUS_START);
- //let it acquire the rule
- barrier.setStatus(TestBarrier.STATUS_WAIT_FOR_RUN);
- barrier.waitForStatus(TestBarrier.STATUS_RUNNING);
- //transferring the calling thread's rule to the background job should fail
- //because the destination thread already owns a rule
- try {
- manager.transferRule(rule, ruleRunner.getThread());
- fail("1.2");
- } catch (RuntimeException e) {
- //expected
- }
- //let the background job finish
- barrier.setStatus(TestBarrier.STATUS_WAIT_FOR_DONE);
- barrier.waitForStatus(TestBarrier.STATUS_DONE);
- try {
- ruleRunner.join();
- } catch (InterruptedException e1) {
- fail("1.99", e1);
- }
- } finally {
- manager.endRule(rule);
- }
- }
-
- /**
- * Tests transferring a scheduling rule to the same thread
- */
- public void testTransferSameThread() {
- PathRule rule = new PathRule("testTransferSameThread");
- try {
- manager.beginRule(rule, null);
- //transfer to same thread is ok
- manager.transferRule(rule, Thread.currentThread());
- } catch (Exception e) {
- fail("1.0", e);
- } finally {
- manager.endRule(rule);
- }
- }
-
- /**
- * Simple test of rule transfer
- */
- public void testTransferSimple() {
- class RuleEnder implements Runnable {
- Exception error;
- private final ISchedulingRule rule;
-
- RuleEnder(ISchedulingRule rule) {
- this.rule = rule;
- }
-
- public void run() {
- try {
- manager.endRule(rule);
- } catch (Exception e) {
- this.error = e;
- }
- }
- }
- PathRule rule = new PathRule("testTransferSimple");
- manager.beginRule(rule, null);
- RuleEnder ender = new RuleEnder(rule);
- Thread destination = new Thread(ender);
- manager.transferRule(rule, destination);
- destination.start();
- try {
- destination.join();
- } catch (InterruptedException e) {
- fail("1.99", e);
- }
- if (ender.error != null)
- fail("1.0", ender.error);
- }
-
- /**
- * Tests a batch of jobs that use two mutually exclusive rules.
- */
- public void testTwoRules() {
- final int JOB_COUNT = 10;
- TestJob[] jobs = new TestJob[JOB_COUNT];
- ISchedulingRule evens = new IdentityRule();
- ISchedulingRule odds = new IdentityRule();
- for (int i = 0; i < JOB_COUNT; i++) {
- jobs[i] = new TestJob("testSimpleRules", 1000000, 10);
- jobs[i].setRule(((i & 0x1) == 0) ? evens : odds);
- jobs[i].schedule();
- }
- //first two jobs should be running, all others should be waiting
- waitForStart(jobs[0]);
- waitForStart(jobs[1]);
- assertState("1.0", jobs[0], Job.RUNNING);
- assertState("1.1", jobs[1], Job.RUNNING);
- for (int i = 2; i < JOB_COUNT; i++) {
- assertState("1.2." + i, jobs[i], Job.WAITING);
- }
- //cancel job i then i+1 and i+2 should run and all others should wait
- for (int i = 0; i < JOB_COUNT; i++) {
- jobs[i].cancel();
- try {
- waitForStart(jobs[i + 1]);
- assertState("2.0." + i, jobs[i + 1], Job.RUNNING);
- waitForStart(jobs[i + 2]);
- assertState("2.1." + i, jobs[i + 2], Job.RUNNING);
- } catch (ArrayIndexOutOfBoundsException e) {
- //ignore
- }
- for (int j = i + 3; j < JOB_COUNT; j++) {
- assertState("2.2." + i + "." + j, jobs[j], Job.WAITING);
- }
- }
- }
-
- /**
- * A job has been canceled. Pause this thread so that a worker thread
- * has a chance to receive the cancel event.
- */
- private void waitForCancel(Job job) {
- int i = 0;
- while (job.getState() == Job.RUNNING) {
- Thread.yield();
- sleep(100);
- Thread.yield();
- //sanity test to avoid hanging tests
- if (i++ > 1000) {
- dumpState();
- assertTrue("Timeout waiting for job to cancel", false);
- }
- }
- }
-
- private synchronized void waitForCompletion() {
- int i = 0;
- assertTrue("Jobs completed that weren't scheduled", completedJobs <= scheduledJobs);
- while (completedJobs < scheduledJobs) {
- try {
- wait(500);
- } catch (InterruptedException e) {
- //ignore
- }
- //sanity test to avoid hanging tests
- if (i++ > 1000) {
- dumpState();
- assertTrue("Timeout waiting for job to complete", false);
- }
- }
- }
-
- /**
- * A family of jobs have been canceled. Pause this thread until all of the jobs
- * in the family are canceled
- */
- private void waitForFamilyCancel(Job[] jobs, TestJobFamily type) {
-
- for (int j = 0; j < jobs.length; j++) {
- int i = 0;
- while (jobs[j].belongsTo(type) && (jobs[j].getState() != Job.NONE)) {
- Thread.yield();
- sleep(100);
- Thread.yield();
- //sanity test to avoid hanging tests
- if (i++ > 100) {
- dumpState();
- assertTrue("Timeout waiting for job in family " + type.getType() + "to be canceled ", false);
- }
- }
- }
- }
-
- private void waitForRunCount(TestJob job, int runCount) {
- int i = 0;
- while (job.getRunCount() < runCount) {
- Thread.yield();
- sleep(100);
- Thread.yield();
- //sanity test to avoid hanging tests
- if (i++ >= 1000) {
- dumpState();
- assertTrue("Timeout waiting for job to start. Job: " + job + ", state: " + job.getState(), false);
- }
- }
- }
-
- /**
- * A job has been scheduled. Pause this thread so that a worker thread
- * has a chance to pick up the new job.
- */
- private void waitForStart(TestJob job) {
- waitForRunCount(job, 1);
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/IdentityRule.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/IdentityRule.java
deleted file mode 100644
index 6270a09..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/IdentityRule.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-
-/**
- * A scheduling rule that always conflicts with an identical instance, but not with any
- * other rules.
- */
-public class IdentityRule implements ISchedulingRule {
- private static int nextRule = 0;
- private final int ruleNumber = nextRule++;
-
- public boolean contains(ISchedulingRule rule) {
- return rule == this;
- }
-
- public boolean isConflicting(ISchedulingRule rule) {
- return rule == this;
- }
-
- public String toString() {
- return "IdentityRule(" + ruleNumber + ")";
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobQueueTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobQueueTest.java
deleted file mode 100644
index 98209ca..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobQueueTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import junit.framework.TestCase;
-import org.eclipse.core.internal.jobs.InternalJob;
-import org.eclipse.core.internal.jobs.JobQueue;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- *
- */
-public class JobQueueTest extends TestCase {
- class Entry extends InternalJob {
- Entry(int value) {
- super("Entry");
- setPriority(value);
- }
-
- protected IStatus run(IProgressMonitor monitor) {
- return Status.OK_STATUS;
- }
- }
-
- private JobQueue queue;
-
- public JobQueueTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- this.queue = new JobQueue(false);
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- public void testEqualValues() {
- //if several equal values are entered, they should come out in FIFO order
- final int NUM_ENTRIES = 10;
- Entry[] entries = new Entry[NUM_ENTRIES];
- for (int i = 0; i < entries.length; i++) {
- entries[i] = new Entry(Job.LONG);
- queue.enqueue(entries[i]);
- assertEquals("1.0." + i, entries[0], queue.peek());
- }
- for (int i = 0; i < entries.length; i++) {
- assertEquals("2.0." + i, entries[i], queue.dequeue());
- }
- }
-
- public void testBasic() {
- Entry[] entries = createEntries();
- assertTrue("1.0", queue.isEmpty());
- assertTrue("1.1", queue.dequeue() == null);
- assertTrue("1.2", queue.peek() == null);
- for (int i = 0; i < entries.length; i++) {
- queue.enqueue(entries[i]);
- assertTrue("1.3", queue.peek() != null);
- }
- for (int i = 0; i < entries.length; i++) {
- queue.remove(entries[i]);
- if (i + 1 < entries.length)
- assertTrue("1.4." + i, queue.peek() != null);
- }
- assertTrue("2.0", queue.isEmpty());
- assertTrue("2.1", queue.dequeue() == null);
- assertTrue("2.2", queue.peek() == null);
- for (int i = 0; i < entries.length; i++) {
- queue.enqueue(entries[i]);
- }
- int count = entries.length;
- while (!queue.isEmpty()) {
- InternalJob peek = queue.peek();
- InternalJob removed = queue.dequeue();
- assertEquals("3.0." + count, peek, removed);
- count--;
- }
- assertEquals("3.1", 0, count);
- }
-
- private Entry[] createEntries() {
- return new Entry[] {new Entry(Job.INTERACTIVE), new Entry(Job.BUILD), new Entry(Job.INTERACTIVE), new Entry(Job.SHORT), new Entry(Job.DECORATE), new Entry(Job.LONG), new Entry(Job.SHORT), new Entry(Job.BUILD), new Entry(Job.LONG), new Entry(Job.DECORATE),};
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobRuleRunner.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobRuleRunner.java
deleted file mode 100644
index 5ac7f17..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobRuleRunner.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.core.tests.harness.TestBarrier;
-
-/**
- * A test job that begins and ends a scheduling rule, waiting on signals
- * at each step to allow synchronization with the thread that is running the test.
- */
-class JobRuleRunner extends Job {
- private ISchedulingRule rule;
- private TestBarrier barrier;
- private int numRepeats;
- private boolean reportBlocking;
-
- /**
- * This job will start applying the given rule in the manager
- */
- public JobRuleRunner(String name, ISchedulingRule rule, int[] status, int index, int numRepeats, boolean reportBlocking) {
- this(name, rule, new TestBarrier(status, index), numRepeats, reportBlocking);
- }
- /**
- * This job will start applying the given rule in the manager
- */
- public JobRuleRunner(String name, ISchedulingRule rule, TestBarrier barrier, int numRepeats, boolean reportBlocking) {
- super(name);
- this.rule = rule;
- this.barrier = barrier;
- this.numRepeats = numRepeats;
- this.reportBlocking = reportBlocking;
- }
- /**
- * This job will start applying the given rule in the manager
- */
- public JobRuleRunner(String name, ISchedulingRule rule, TestBarrier barrier) {
- this(name, rule, barrier, 1, false);
- }
-
- protected IStatus run(IProgressMonitor monitor) {
- //begin executing the job
- monitor.beginTask(getName(), numRepeats);
- try {
- //set the status flag to START
- barrier.setStatus(TestBarrier.STATUS_START);
- for (int i = 0; i < numRepeats; i++) {
- monitor.worked(1);
- //wait until the tester allows this job to run again
- barrier.waitForStatusNoFail(TestBarrier.STATUS_WAIT_FOR_RUN);
- //create a hook that would notify this thread when this job was blocked on a rule (if needed)
- TestBlockingMonitor bMonitor = null;
- if (reportBlocking)
- bMonitor = new TestBlockingMonitor(barrier);
-
- //start the given rule in the manager
- manager.beginRule(rule, bMonitor);
- //set status to RUNNING
- barrier.setStatus(TestBarrier.STATUS_RUNNING);
-
- if (monitor.isCanceled())
- return Status.CANCEL_STATUS;
-
- //wait until tester allows this job to finish
- barrier.waitForStatusNoFail(TestBarrier.STATUS_WAIT_FOR_DONE);
- //end the given rule
- manager.endRule(rule);
- //set status to DONE
- barrier.setStatus(TestBarrier.STATUS_DONE);
-
- Thread.yield();
- }
-
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobTest.java
deleted file mode 100644
index b559410..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobTest.java
+++ /dev/null
@@ -1,1163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import junit.framework.*;
-import junit.framework.Assert;
-import org.eclipse.core.internal.jobs.Worker;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.core.tests.harness.*;
-
-/**
- * Tests the implemented get/set methods of the abstract class Job
- */
-public class JobTest extends AbstractJobTest {
- protected Job longJob;
- protected Job shortJob;
-
- public static Test suite() {
- return new TestSuite(JobTest.class);
- }
-
- //see bug #43591
- public void _testDone() {
- //calling the done method on a job that is not executing asynchronously should have no effect
-
- shortJob.done(Status.OK_STATUS);
- assertTrue("1.0", shortJob.getResult() == null);
-
- shortJob.done(Status.CANCEL_STATUS);
- assertTrue("2.0", shortJob.getResult() == null);
-
- //calling the done method after the job is scheduled
- shortJob.schedule();
- shortJob.done(Status.CANCEL_STATUS);
- waitForState(shortJob, Job.NONE);
-
- //the done call should be ignored, and the job should finish execution normally
- assertTrue("3.0", shortJob.getResult().getSeverity() == IStatus.OK);
-
- shortJob.done(Status.CANCEL_STATUS);
- assertTrue("4.0", shortJob.getResult().getSeverity() == IStatus.OK);
-
- //calling the done method before a job is canceled
- longJob.schedule();
- waitForState(longJob, Job.RUNNING);
- longJob.done(Status.OK_STATUS);
- longJob.cancel();
- waitForState(longJob, Job.NONE);
-
- //the done call should be ignored, and the job status should still be canceled
- assertTrue("5.0", longJob.getResult().getSeverity() == IStatus.CANCEL);
-
- longJob.done(Status.OK_STATUS);
- assertTrue("6.0", longJob.getResult().getSeverity() == IStatus.CANCEL);
-
- }
-
- private void cancel(Job[] jobs) {
- for (int i = 0; i < jobs.length; i++)
- jobs[i].cancel();
- }
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- shortJob = new TestJob("Short Test Job", 100, 10);
- longJob = new TestJob("Long Test Job", 1000000, 10);
- }
-
- /*
- * @see TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- waitForState(shortJob, Job.NONE);
- waitForState(longJob, Job.NONE);
- }
-
- //see bug #43566
- public void testAsynchJob() {
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START};
-
- //execute a job asynchronously and check the result
- AsynchTestJob main = new AsynchTestJob("Test Asynch Finish", status, 0);
-
- assertTrue("1.0", main.getThread() == null);
- assertTrue("2.0", main.getResult() == null);
- //schedule the job to run
- main.schedule();
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
- assertTrue("3.0", main.getState() == Job.RUNNING);
- //the asynchronous process that assigns the thread the job is going to run in has not been started yet
- //the job is running in the thread provided to it by the manager
- assertTrue("3.1" + main.getThread().getName(), main.getThread() instanceof Worker);
-
- status[0] = TestBarrier.STATUS_START;
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_WAIT_FOR_START);
-
- //the asynchronous process has been started, but the set thread method has not been called yet
- assertTrue("3.2", main.getThread() instanceof Worker);
-
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
-
- //make sure the job has set the thread it is going to run in
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
-
- assertTrue("3.3", status[0] == TestBarrier.STATUS_RUNNING);
- assertTrue("3.4", main.getThread() instanceof AsynchExecThread);
-
- //let the job run
- status[0] = TestBarrier.STATUS_WAIT_FOR_DONE;
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_DONE);
- waitForState(main, Job.NONE);
-
- //after the job is finished, the thread should be reset
- assertTrue("4.0", main.getState() == Job.NONE);
- assertTrue("4.1", main.getResult().getSeverity() == IStatus.OK);
- assertTrue("4.2", main.getThread() == null);
-
- //reset status
- status[0] = TestBarrier.STATUS_WAIT_FOR_START;
-
- //schedule the job to run again
- main.schedule();
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
- assertTrue("5.0", main.getState() == Job.RUNNING);
-
- //the asynchronous process that assigns the thread the job is going to run in has not been started yet
- //job is running in the thread provided by the manager
- assertTrue("5.1", main.getThread() instanceof Worker);
-
- status[0] = TestBarrier.STATUS_START;
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_WAIT_FOR_START);
-
- //the asynchronous process has been started, but the set thread method has not been called yet
- assertTrue("5.2", main.getThread() instanceof Worker);
-
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
-
- //make sure the job has set the thread it is going to run in
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
-
- assertTrue("5.3", status[0] == TestBarrier.STATUS_RUNNING);
- assertTrue("5.4", main.getThread() instanceof AsynchExecThread);
-
- //cancel the job, then let the job get the cancellation request
- main.cancel();
- status[0] = TestBarrier.STATUS_WAIT_FOR_DONE;
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_DONE);
- waitForState(main, Job.NONE);
-
- //thread should be reset to null after cancellation
- assertTrue("6.0", main.getState() == Job.NONE);
- assertTrue("6.1", main.getResult().getSeverity() == IStatus.CANCEL);
- assertTrue("6.2", main.getThread() == null);
- }
-
- public void testAsynchJobComplex() {
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START};
-
- //test the interaction of several asynchronous jobs
- AsynchTestJob[] jobs = new AsynchTestJob[5];
-
- for (int i = 0; i < jobs.length; i++) {
- jobs[i] = new AsynchTestJob("TestJob" + (i + 1), status, i);
- assertTrue("1." + i, jobs[i].getThread() == null);
- assertTrue("2." + i, jobs[i].getResult() == null);
- jobs[i].schedule();
- //status[i] = TestBarrier.STATUS_START;
- }
- //all the jobs should be running at the same time
- waitForStart(jobs, status);
-
- //every job should now be waiting for the STATUS_START flag
- for (int i = 0; i < status.length; i++) {
- assertTrue("3." + i, jobs[i].getState() == Job.RUNNING);
- assertTrue("4." + i, jobs[i].getThread() instanceof Worker);
- status[i] = TestBarrier.STATUS_START;
- }
-
- for (int i = 0; i < status.length; i++)
- TestBarrier.waitForStatus(status, i, TestBarrier.STATUS_WAIT_FOR_START);
-
- //every job should now be waiting for the STATUS_WAIT_FOR_RUN flag
- for (int i = 0; i < status.length; i++) {
- assertTrue("5. " + i, jobs[i].getThread() instanceof Worker);
- status[i] = TestBarrier.STATUS_WAIT_FOR_RUN;
- }
-
- //wait until all jobs are in the running state
- for (int i = 0; i < status.length; i++)
- TestBarrier.waitForStatus(status, i, TestBarrier.STATUS_RUNNING);
-
- //let the jobs execute
- for (int i = 0; i < status.length; i++) {
- assertTrue("6. " + i, jobs[i].getThread() instanceof AsynchExecThread);
- status[i] = TestBarrier.STATUS_WAIT_FOR_DONE;
- }
-
- for (int i = 0; i < status.length; i++)
- TestBarrier.waitForStatus(status, i, TestBarrier.STATUS_DONE);
-
- //the status for every job should be STATUS_OK
- //the threads should have been reset to null
- for (int i = 0; i < status.length; i++) {
- assertEquals("7." + i, TestBarrier.STATUS_DONE, status[i]);
- assertEquals("8." + i, Job.NONE, jobs[i].getState());
- assertEquals("9." + i, IStatus.OK, jobs[i].getResult().getSeverity());
- assertNull("10." + i, jobs[i].getThread());
- }
- }
-
- public void testAsynchJobConflict() {
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START};
-
- //test the interaction of several asynchronous jobs when a conflicting rule is assigned to some of them
- AsynchTestJob[] jobs = new AsynchTestJob[5];
-
- ISchedulingRule rule = new IdentityRule();
-
- for (int i = 0; i < jobs.length; i++) {
- jobs[i] = new AsynchTestJob("TestJob" + (i + 1), status, i);
- assertTrue("1." + i, jobs[i].getThread() == null);
- assertTrue("2." + i, jobs[i].getResult() == null);
- if (i < 2) {
- jobs[i].schedule();
- } else if (i > 2) {
- jobs[i].setRule(rule);
- } else {
- jobs[i].setRule(rule);
- jobs[i].schedule();
- }
-
- }
-
- //these 3 jobs should be waiting for the STATUS_START flag
- for (int i = 0; i < 3; i++) {
- TestBarrier.waitForStatus(status, i, TestBarrier.STATUS_RUNNING);
- assertTrue("3." + i, jobs[i].getState() == Job.RUNNING);
- assertTrue("4." + i, jobs[i].getThread() instanceof Worker);
- status[i] = TestBarrier.STATUS_START;
- }
-
- //the first 3 jobs should be running at the same time
- for (int i = 0; i < 3; i++)
- TestBarrier.waitForStatus(status, i, TestBarrier.STATUS_WAIT_FOR_START);
-
- //the 3 jobs should now be waiting for the STATUS_WAIT_FOR_RUN flag
- for (int i = 0; i < 3; i++) {
- assertTrue("5. " + i, jobs[i].getThread() instanceof Worker);
- status[i] = TestBarrier.STATUS_WAIT_FOR_RUN;
- }
-
- //wait until jobs block on running state
- for (int i = 0; i < 3; i++)
- TestBarrier.waitForStatus(status, i, TestBarrier.STATUS_RUNNING);
-
- //schedule the 2 remaining jobs
- jobs[3].schedule();
- jobs[4].schedule();
-
- //the 2 newly scheduled jobs should be waiting since they conflict with the third job
- //no threads were assigned to them yet
- assertEquals("6.1", Job.WAITING, jobs[3].getState());
- assertNull("6.2", jobs[3].getThread());
- assertEquals("6.3", Job.WAITING, jobs[4].getState());
- assertNull("6.4", jobs[4].getThread());
-
- //let the two non-conflicting jobs execute together
- for (int i = 0; i < 2; i++) {
- assertTrue("7. " + i, jobs[i].getThread() instanceof AsynchExecThread);
- status[i] = TestBarrier.STATUS_WAIT_FOR_DONE;
- }
- //wait until the non-conflicting jobs are done
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_DONE);
-
- //the third job should still be in the running state
- assertEquals("8.1", Job.RUNNING, jobs[2].getState());
- //the 2 conflicting jobs should still be in the waiting state
- assertEquals("8.2", Job.WAITING, jobs[3].getState());
- assertEquals("8.3", Job.WAITING, jobs[4].getState());
-
- //let the third job finish execution
- assertTrue("8.4", jobs[2].getThread() instanceof AsynchExecThread);
- status[2] = TestBarrier.STATUS_WAIT_FOR_DONE;
-
- //wait until the third job is done
- TestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_DONE);
-
- //the fourth job should now start running, the fifth job should still be waiting
- TestBarrier.waitForStatus(status, 3, TestBarrier.STATUS_RUNNING);
- assertEquals("9.1", Job.RUNNING, jobs[3].getState());
- assertEquals("9.2", Job.WAITING, jobs[4].getState());
-
- //let the fourth job run, the fifth job is still waiting
- status[3] = TestBarrier.STATUS_START;
- assertEquals("9.3", Job.WAITING, jobs[4].getState());
- TestBarrier.waitForStatus(status, 3, TestBarrier.STATUS_WAIT_FOR_START);
- status[3] = TestBarrier.STATUS_WAIT_FOR_RUN;
- assertEquals("9.4", Job.WAITING, jobs[4].getState());
- TestBarrier.waitForStatus(status, 3, TestBarrier.STATUS_RUNNING);
- assertEquals("9.5", Job.WAITING, jobs[4].getState());
-
- //cancel the fifth job, finish the fourth job
- jobs[4].cancel();
- assertTrue("9.6", jobs[3].getThread() instanceof AsynchExecThread);
- status[3] = TestBarrier.STATUS_WAIT_FOR_DONE;
-
- //wait until the fourth job is done
- TestBarrier.waitForStatus(status, 3, TestBarrier.STATUS_DONE);
-
- //the status for the first 4 jobs should be STATUS_OK
- //the threads should have been reset to null
- for (int i = 0; i < status.length - 1; i++) {
- assertEquals("10." + i, TestBarrier.STATUS_DONE, status[i]);
- assertEquals("11." + i, Job.NONE, jobs[i].getState());
- assertEquals("12." + i, IStatus.OK, jobs[i].getResult().getSeverity());
- assertNull("13." + i, jobs[i].getThread());
- }
-
- //the fifth job should have null as its status (it never finished running)
- //the thread for it should have also been reset
- assertEquals("14.1", TestBarrier.STATUS_WAIT_FOR_START, status[4]);
- assertEquals("14.2", Job.NONE, jobs[4].getState());
- assertNull("14.3", jobs[4].getResult());
- assertNull("14.4", jobs[4].getThread());
- }
-
- /**
- * Tests cancelation of a job from the aboutToRun job event.
- * See bug 70434 for details.
- */
- public void testCancelFromAboutToRun() {
- final int[] doneCount = new int[] {0};
- final int[] runningCount = new int[] {0};
- TestJob job = new TestJob("testCancelFromAboutToRun", 0, 0);
- job.addJobChangeListener(new JobChangeAdapter() {
- public void aboutToRun(IJobChangeEvent event) {
- event.getJob().cancel();
- }
-
- public void done(IJobChangeEvent event) {
- doneCount[0]++;
- }
-
- public void running(IJobChangeEvent event) {
- runningCount[0]++;
- }
- });
- job.schedule();
- try {
- job.join();
- } catch (InterruptedException e) {
- e.printStackTrace();
- fail("0.99 " + e.getMessage());
- }
- assertEquals("1.0", 0, job.getRunCount());
- assertEquals("1.1", 1, doneCount[0]);
- assertEquals("1.2", 0, runningCount[0]);
- }
-
- /**
- * Tests the hook method {@link Job#canceling}.
- */
- public void testCanceling() {
- final TestBarrier barrier = new TestBarrier();
- barrier.setStatus(TestBarrier.STATUS_WAIT_FOR_START);
- final boolean[] canceling = new boolean[] {false};
- Job job = new Job("Testing#testCanceling") {
- protected void canceling() {
- canceling[0] = true;
- }
-
- protected IStatus run(IProgressMonitor monitor) {
- barrier.setStatus(TestBarrier.STATUS_WAIT_FOR_RUN);
- barrier.waitForStatus(TestBarrier.STATUS_RUNNING);
- return Status.OK_STATUS;
- }
- };
- //schedule the job and wait on the barrier until it is running
- job.schedule();
- barrier.waitForStatus(TestBarrier.STATUS_WAIT_FOR_RUN);
- assertTrue("1.0", !canceling[0]);
- job.cancel();
- assertTrue("1.0", canceling[0]);
- //let the job finish
- barrier.setStatus(TestBarrier.STATUS_RUNNING);
- waitForState(job, Job.NONE);
- }
-
- public void testGetName() {
- assertTrue("1.0", shortJob.getName().equals("Short Test Job"));
- assertTrue("1.1", longJob.getName().equals("Long Test Job"));
-
- //try creating a job with a null name
- try {
- new TestJob(null);
- fail("2.0");
- } catch (RuntimeException e) {
- //should fail
- }
- }
-
- public void testGetPriority() {
- //set priorities to all allowed options
- //check if getPriority() returns proper result
-
- int[] priority = {Job.SHORT, Job.LONG, Job.INTERACTIVE, Job.BUILD, Job.DECORATE};
-
- for (int i = 0; i < priority.length; i++) {
- shortJob.setPriority(priority[i]);
- assertTrue("1." + i, shortJob.getPriority() == priority[i]);
- }
- }
-
- public void testGetProperty() {
- QualifiedName n1 = new QualifiedName("org.eclipse.core.tests.runtime", "p1");
- QualifiedName n2 = new QualifiedName("org.eclipse.core.tests.runtime", "p2");
- assertNull("1.0", shortJob.getProperty(n1));
- shortJob.setProperty(n1, null);
- assertNull("1.1", shortJob.getProperty(n1));
- shortJob.setProperty(n1, shortJob);
- assertTrue("1.2", shortJob.getProperty(n1) == shortJob);
- assertNull("1.3", shortJob.getProperty(n2));
- shortJob.setProperty(n1, "hello");
- assertEquals("1.4", "hello", shortJob.getProperty(n1));
- shortJob.setProperty(n1, null);
- assertNull("1.5", shortJob.getProperty(n1));
- assertNull("1.6", shortJob.getProperty(n2));
- }
-
- public void testGetResult() {
- //execute a short job
- assertTrue("1.0", shortJob.getResult() == null);
- shortJob.schedule();
- waitForState(shortJob, Job.NONE);
- assertTrue("1.1", shortJob.getResult().getSeverity() == IStatus.OK);
-
- //cancel a long job
- waitForState(longJob, Job.NONE);
- longJob.schedule();
- waitForState(longJob, Job.RUNNING);
- longJob.cancel();
- waitForState(longJob, Job.NONE);
- assertTrue("2.0", longJob.getResult().getSeverity() == IStatus.CANCEL);
- }
-
- public void testGetRule() {
- //set several rules for the job, check if getRule returns the rule that was set
- //no rule was set yet
- assertTrue("1.0", shortJob.getRule() == null);
-
- shortJob.setRule(new IdentityRule());
- assertTrue("1.1", (shortJob.getRule() instanceof IdentityRule));
-
- ISchedulingRule rule = new PathRule("/testGetRule");
- shortJob.setRule(rule);
- assertTrue("1.2", shortJob.getRule() == rule);
-
- shortJob.setRule(null);
- assertTrue("1.3", shortJob.getRule() == null);
- }
-
- public void testGetThread() {
- //check that getThread returns the thread that was passed in setThread, when the job is not running
- //if the job is scheduled, only jobs that return the asynch_exec status will run in the indicated thread
-
- //main is not running now
- assertTrue("1.0", shortJob.getThread() == null);
-
- Thread t = new Thread();
- shortJob.setThread(t);
- assertTrue("1.1", shortJob.getThread() == t);
-
- shortJob.setThread(new Thread());
- assertTrue("1.2", shortJob.getThread() != t);
-
- shortJob.setThread(null);
- assertTrue("1.3", shortJob.getThread() == null);
- }
-
- public void testIsBlocking() {
- IdentityRule rule = new IdentityRule();
- TestJob high = new TestJob("TestIsBlocking.long", 10000, 100);
- high.setRule(rule);
- high.setPriority(Job.LONG);
- TestJob medium = new TestJob("TestIsBlocking.build", 10000, 100);
- medium.setRule(rule);
- medium.setPriority(Job.BUILD);
- TestJob low = new TestJob("TestIsBlocking.decorate", 10000, 100);
- low.setRule(rule);
- low.setPriority(Job.DECORATE);
-
- //start the build job, and make sure it is not blocking
- medium.schedule();
- waitForState(medium, Job.RUNNING);
- assertTrue("1.0", !medium.isBlocking());
- //schedule a lower priority job, and it should still not be blocking
- low.schedule();
- assertTrue("1.1", !medium.isBlocking());
- //schedule a higher priority job - now it should be blocking
- high.schedule();
- //wait for the high priority job to become blocked
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- //ignore
- }
- assertTrue("1.2", medium.isBlocking());
-
- //cancel everything
- Job[] jobs = new Job[] {high, medium, low};
- cancel(jobs);
- waitForState(jobs, Job.NONE);
-
- //a higher priority system job should not be blocking
- high.setSystem(true);
- medium.schedule();
- waitForState(medium, Job.RUNNING);
- high.schedule();
- assertTrue("2.0", !medium.isBlocking());
-
- //clean up
- cancel(jobs);
- waitForState(jobs, Job.NONE);
- }
-
- public void testIsSystem() {
- //reset the system parameter several times
- shortJob.setUser(false);
- shortJob.setSystem(false);
- assertTrue("1.0", !shortJob.isUser());
- assertTrue("1.1", !shortJob.isSystem());
- shortJob.setSystem(true);
- assertTrue("1.2", !shortJob.isUser());
- assertTrue("1.3", shortJob.isSystem());
- shortJob.setSystem(false);
- assertTrue("1.4", !shortJob.isUser());
- assertTrue("1.5", !shortJob.isSystem());
- }
-
- public void testIsUser() {
- //reset the user parameter several times
- shortJob.setUser(false);
- shortJob.setSystem(false);
- assertTrue("1.0", !shortJob.isUser());
- assertTrue("1.1", !shortJob.isSystem());
- shortJob.setUser(true);
- assertTrue("1.2", shortJob.isUser());
- assertTrue("1.3", !shortJob.isSystem());
- shortJob.setUser(false);
- assertTrue("1.4", !shortJob.isUser());
- assertTrue("1.5", !shortJob.isSystem());
- }
-
- public void testJoin() {
- longJob.schedule(100000);
- //create a thread that will join the test job
- final int[] status = new int[1];
- status[0] = TestBarrier.STATUS_WAIT_FOR_START;
- Thread t = new Thread(new Runnable() {
- public void run() {
- status[0] = TestBarrier.STATUS_START;
- try {
- longJob.join();
- } catch (InterruptedException e) {
- Assert.fail("0.99");
- }
- status[0] = TestBarrier.STATUS_DONE;
- }
- });
- t.start();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_START);
- assertEquals("1.0", TestBarrier.STATUS_START, status[0]);
- //putting the job to sleep should not affect the join call
- longJob.sleep();
- //give a chance for the sleep to take effect
- sleep(100);
- assertEquals("1.0", TestBarrier.STATUS_START, status[0]);
- //similarly waking the job up should not affect the join
- longJob.wakeUp(100000);
- sleep(100);
- assertEquals("1.0", TestBarrier.STATUS_START, status[0]);
-
- //finally canceling the job will cause the join to return
- longJob.cancel();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_DONE);
- }
-
- /**
- * Asserts that the LockListener is called correctly during invocation of
- * {@link Job#join()}.
- * See bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=195839.
- */
- public void testJoinLockListener() {
- Job testJob = new TestJob("testJoinLockListener", 5, 500);
- TestLockListener lockListener = new TestLockListener();
- try {
- Job.getJobManager().setLockListener(lockListener);
- testJob.join();
- } catch (OperationCanceledException e) {
- fail("4.99", e);
- } catch (InterruptedException e) {
- fail("4.99", e);
- } finally {
- Job.getJobManager().setLockListener(null);
- }
- lockListener.assertNotWaiting("1.0");
- }
-
- /**
- * Tests a job change listener that throws an exception.
- * This would previously cause join attempts on that job to
- * hang indefinitely because they would miss the notification
- * required to end the join.
- */
- public void testJoinFailingListener() {
- shortJob.addJobChangeListener(new JobChangeAdapter() {
- public void done(IJobChangeEvent event) {
- throw new RuntimeException("This exception thrown on purpose as part of a test");
- }
- });
- final int[] status = new int[1];
- //create a thread that will join the job
- Thread t = new Thread(new Runnable() {
- public void run() {
- status[0] = TestBarrier.STATUS_START;
- try {
- shortJob.join();
- } catch (InterruptedException e) {
- Assert.fail("0.99");
- }
- status[0] = TestBarrier.STATUS_DONE;
- }
- });
- //schedule the job and then fork the thread to join it
- shortJob.schedule();
- t.start();
- //wait until the join succeeds
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_DONE);
- }
-
- /**
- * Tests that a job joining itself is an error.
- */
- public void testJoinSelf() {
- final Exception[] failure = new Exception[1];
- Job selfJoiner = new Job("testJoinSelf") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- this.join();
- } catch (RuntimeException e) {
- failure[0] = e;
- } catch (InterruptedException e) {
- failure[0] = e;
- }
- return Status.OK_STATUS;
- }
- };
- selfJoiner.schedule();
- try {
- selfJoiner.join();
- } catch (InterruptedException e) {
- fail("Unexpected interrupt");
- }
- assertTrue("1.0", failure[0] != null);
- }
-
- /**
- * This is a regression test for bug 60323. If a job change listener
- * removed itself from the listener list during the done() change event,
- * then anyone joining on that job would hang forever.
- */
- public void testJoinRemoveListener() {
- final IJobChangeListener listener = new JobChangeAdapter() {
- public void done(IJobChangeEvent event) {
- shortJob.removeJobChangeListener(this);
- }
- };
- shortJob.addJobChangeListener(listener);
- final int[] status = new int[1];
- //create a thread that will join the job
- Thread t = new Thread(new Runnable() {
- public void run() {
- status[0] = TestBarrier.STATUS_START;
- try {
- shortJob.join();
- } catch (InterruptedException e) {
- Assert.fail("0.99");
- }
- status[0] = TestBarrier.STATUS_DONE;
- }
- });
- //schedule the job and then fork the thread to join it
- shortJob.schedule();
- t.start();
- //wait until the join succeeds
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_DONE);
- }
-
- /*
- * Test that a canceled job is rescheduled
- */
- public void testRescheduleCancel() {
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START};
- Job job = new Job("Testing") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_RUNNING);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
- //schedule the job, cancel it, then reschedule
- job.schedule();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_WAIT_FOR_RUN);
- job.cancel();
- job.schedule();
- //let the first iteration of the job finish
- status[0] = TestBarrier.STATUS_RUNNING;
- //wait until the job runs again
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_WAIT_FOR_RUN);
- //let the job finish
- status[0] = TestBarrier.STATUS_RUNNING;
- waitForState(job, Job.NONE);
- }
-
- /*
- * Test that multiple reschedules of the same job while it is running
- * only remembers the last reschedule request
- */
- public void testRescheduleComplex() {
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START};
- final int[] runCount = new int[] {0};
- Job job = new Job("Testing") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_RUNNING);
- monitor.worked(1);
- } finally {
- runCount[0]++;
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
- //schedule the job, reschedule when it is running
- job.schedule();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_WAIT_FOR_RUN);
- //the last schedule value should win
- job.schedule(1000000);
- job.schedule(3000);
- job.schedule(200000000);
- job.schedule();
- status[0] = TestBarrier.STATUS_RUNNING;
- //wait until the job runs again
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_WAIT_FOR_RUN);
- assertEquals("1.0", 1, runCount[0]);
- //let the job finish
- status[0] = TestBarrier.STATUS_RUNNING;
- waitForState(job, Job.NONE);
- assertEquals("1.0", 2, runCount[0]);
- }
-
- /*
- * Reschedule a running job with a delay
- */
- public void testRescheduleDelay() {
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START};
- final int[] runCount = new int[] {0};
- Job job = new Job("Testing") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_RUNNING);
- monitor.worked(1);
- } finally {
- runCount[0]++;
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
- //schedule the job, reschedule when it is running
- job.schedule();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_WAIT_FOR_RUN);
- job.schedule(1000000);
- status[0] = TestBarrier.STATUS_RUNNING;
- //now wait until the job is scheduled again and put to sleep
- waitForState(job, Job.SLEEPING);
- assertEquals("1.0", 1, runCount[0]);
-
- //reschedule the job while it is sleeping
- job.schedule();
- //wake up the currently sleeping job
- job.wakeUp();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_WAIT_FOR_RUN);
- status[0] = TestBarrier.STATUS_RUNNING;
- //make sure the job was not rescheduled while the executing job was sleeping
- waitForState(job, Job.NONE);
- assertTrue("1.0", job.getState() == Job.NONE);
- assertEquals("1.0", 2, runCount[0]);
- }
-
- /*
- * Schedule a simple job that repeats several times from within the run method.
- */
- public void testRescheduleRepeat() {
- final int[] count = new int[] {0};
- final int REPEATS = 10;
- Job job = new Job("testRescheduleRepeat") {
- protected IStatus run(IProgressMonitor monitor) {
- count[0]++;
- schedule();
- return Status.OK_STATUS;
- }
-
- public boolean shouldSchedule() {
- return count[0] < REPEATS;
- }
- };
- job.schedule();
- int timeout = 0;
- while (timeout++ < 100 && count[0] < REPEATS) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- //ignore
- }
- }
- assertTrue("1.0", timeout < 100);
- assertEquals("1.1", REPEATS, count[0]);
- } /*
- * Schedule a simple job that repeats several times from within the run method.
- */
-
- public void testRescheduleRepeatWithDelay() {
- final int[] count = new int[] {0};
- final int REPEATS = 10;
- Job job = new Job("testRescheduleRepeat") {
- protected IStatus run(IProgressMonitor monitor) {
- count[0]++;
- schedule(10);
- return Status.OK_STATUS;
- }
-
- public boolean shouldSchedule() {
- return count[0] < REPEATS;
- }
- };
- job.schedule();
- int timeout = 0;
- while (timeout++ < 100 && count[0] < REPEATS) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- //ignore
- }
- }
- assertTrue("1.0", timeout < 100);
- assertEquals("1.1", REPEATS, count[0]);
- }
-
- /*
- * Schedule a job to run, and then reschedule it
- */
- public void testRescheduleSimple() {
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START};
- Job job = new Job("testRescheduleSimple") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_RUNNING);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
- //schedule the job, reschedule when it is running
- job.schedule();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_WAIT_FOR_RUN);
- job.schedule();
- status[0] = TestBarrier.STATUS_RUNNING;
- //wait until the job runs again
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_WAIT_FOR_RUN);
- //let the job finish
- status[0] = TestBarrier.STATUS_RUNNING;
- waitForState(job, Job.NONE);
-
- //the job should only run once the second time around
- job.schedule();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_WAIT_FOR_RUN);
- //let the job finish
- status[0] = TestBarrier.STATUS_RUNNING;
- //wait until the job truly finishes and has a chance to be rescheduled (it shouldn't reschedule)
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- //ignore
- }
- waitForState(job, Job.NONE);
- }
-
- /*
- * Reschedule a waiting job.
- */
- public void testRescheduleWaiting() {
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START};
- final int[] runCount = new int[] {0};
- final ISchedulingRule rule = new IdentityRule();
- Job first = new Job("Testing1") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- status[0] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
- monitor.worked(1);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
- Job second = new Job("Testing2") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Testing", 1);
- status[1] = TestBarrier.STATUS_WAIT_FOR_RUN;
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_RUNNING);
- monitor.worked(1);
- } finally {
- runCount[0]++;
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
- //set the same rule for both jobs so that the second job would have to wait
- first.setRule(rule);
- first.schedule();
- second.setRule(rule);
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_WAIT_FOR_RUN);
- second.schedule();
- waitForState(second, Job.WAITING);
- //reschedule the second job while it is waiting
- second.schedule();
- //let the first job finish
- status[0] = TestBarrier.STATUS_RUNNING;
- //the second job will start
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_WAIT_FOR_RUN);
- //let the second job finish
- status[1] = TestBarrier.STATUS_RUNNING;
-
- //make sure the second job was not rescheduled
- waitForState(second, Job.NONE);
- assertEquals("2.0", Job.NONE, second.getState());
- assertEquals("2.1", 1, runCount[0]);
- }
-
- /*
- * see bug #43458
- */
- public void testSetPriority() {
- int[] wrongPriority = {1000, -Job.DECORATE, 25, 0, 5, Job.INTERACTIVE - Job.BUILD};
-
- for (int i = 0; i < wrongPriority.length; i++) {
- //set priority to non-existent type
- try {
- shortJob.setPriority(wrongPriority[i]);
- fail("1." + (i + 1));
- } catch (RuntimeException e) {
- //should fail
- }
- }
- }
-
- /**
- * Tests the API methods Job.setProgressGroup
- */
- public void testSetProgressGroup() {
- //null group
- try {
- longJob.setProgressGroup(null, 5);
- fail("1.0");
- } catch (RuntimeException e) {
- //should fail
- }
- IProgressMonitor group = Job.getJobManager().createProgressGroup();
- group.beginTask("Group task name", 10);
- longJob.setProgressGroup(group, 5);
-
- //ignore changes to group while waiting or running
- longJob.schedule(100);
- longJob.setProgressGroup(group, 0);
- waitForState(longJob, Job.RUNNING);
- longJob.setProgressGroup(group, 0);
-
- //ensure cancelation still works
- longJob.cancel();
- waitForState(longJob, Job.NONE);
- group.done();
- }
-
- /*
- * see bug #43459
- */
- public void testSetRule() {
- //setting a scheduling rule for a job after it was already scheduled should throw an exception
- shortJob.setRule(new IdentityRule());
- assertTrue("1.0", shortJob.getRule() instanceof IdentityRule);
- shortJob.schedule(1000000);
- try {
- shortJob.setRule(new PathRule("/testSetRule"));
- fail("1.1");
- } catch (RuntimeException e) {
- //should fail
- }
-
- //wake up the sleeping job
- shortJob.wakeUp();
-
- //setting the rule while running should fail
- try {
- shortJob.setRule(new PathRule("/testSetRule/B"));
- fail("2.0");
- } catch (RuntimeException e1) {
- //should fail
- }
-
- try {
- //wait for the job to complete
- shortJob.join();
- } catch (InterruptedException e2) {
- //ignore
- }
-
- //after the job has finished executing, the scheduling rule for it can once again be reset
- shortJob.setRule(new PathRule("/testSetRule/B/C/D"));
- assertTrue("1.2", shortJob.getRule() instanceof PathRule);
- shortJob.setRule(null);
- assertTrue("1.3", shortJob.getRule() == null);
- }
-
- public void testSetThread() {
- //setting the thread of a job that is not an asynchronous job should not affect the actual thread the job will run in
- assertTrue("0.0", longJob.getThread() == null);
-
- longJob.setThread(Thread.currentThread());
- assertTrue("1.0", longJob.getThread() == Thread.currentThread());
- longJob.schedule();
- waitForState(longJob, Job.RUNNING);
-
- //the setThread method should have no effect on jobs that execute normally
- assertTrue("2.0", longJob.getThread() != Thread.currentThread());
-
- longJob.cancel();
- waitForState(longJob, Job.NONE);
-
- //the thread should reset to null when the job finishes execution
- assertTrue("3.0", longJob.getThread() == null);
-
- longJob.setThread(null);
- assertTrue("4.0", longJob.getThread() == null);
-
- longJob.schedule();
- waitForState(longJob, Job.RUNNING);
-
- //the thread that the job is executing in is not the one that was set
- assertTrue("5.0", longJob.getThread() != null);
- longJob.cancel();
- waitForState(longJob, Job.NONE);
-
- //thread should reset to null after execution of job
- assertTrue("6.0", longJob.getThread() == null);
-
- Thread t = new Thread();
- longJob.setThread(t);
- assertTrue("7.0", longJob.getThread() == t);
- longJob.schedule();
- waitForState(longJob, Job.RUNNING);
-
- //the thread that the job is executing in is not the one that it was set to
- assertTrue("8.0", longJob.getThread() != t);
- longJob.cancel();
- waitForState(longJob, Job.NONE);
-
- //execution thread should reset to null after job is finished
- assertTrue("9.0", longJob.getThread() == null);
- }
-
- /**
- * Several jobs were scheduled to run.
- * Pause this thread until all the jobs start running.
- */
- private void waitForStart(Job[] jobs, int[] status) {
- for (int i = 0; i < jobs.length; i++)
- TestBarrier.waitForStatus(status, i, TestBarrier.STATUS_RUNNING);
- }
-
- /**
- * A job has been scheduled. Pause this thread so that a worker thread
- * has a chance to pick up the new job.
- */
- private void waitForState(Job job, int state) {
- int i = 0;
- while (job.getState() != state) {
- try {
- Thread.yield();
- Thread.sleep(100);
- Thread.yield();
- } catch (InterruptedException e) {
- //ignore
- }
- //sanity test to avoid hanging tests
- assertTrue("Timeout waiting for job to change state.", i++ < 100);
- }
- }
-
- private void waitForState(Job[] jobs, int state) {
- for (int i = 0; i < jobs.length; i++)
- waitForState(jobs[i], state);
- }
-
- /**
- * A job was scheduled to run. Pause this thread so that a worker thread
- * has a chance to finish the job
- */
- // private void waitForEnd(Job job) {
- // int i = 0;
- // while(job.getState() != Job.NONE) {
- // try {
- // Thread.sleep(100);
- // } catch (InterruptedException e) {
- //
- // }
- //
- // //sanity test to avoid hanging tests
- // assertTrue("Timeout waiting for job to end", i++ < 1000);
- // }
- // }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/LockAcquiringRunnable.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/LockAcquiringRunnable.java
deleted file mode 100644
index 044e0e6..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/LockAcquiringRunnable.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import java.util.Random;
-import org.eclipse.core.runtime.jobs.ILock;
-
-public class LockAcquiringRunnable implements Runnable {
- private ILock[] locks;
- private Random random = new Random();
- private boolean alive;
- private boolean done;
-
- /**
- * This runnable will randomly acquire the given lock for
- * random periods of time, in the given order
- */
- public LockAcquiringRunnable(ILock[] locks) {
- this.locks = locks;
- this.alive = true;
- done = false;
- }
-
- public void kill() {
- alive = false;
- }
-
- public void run() {
- while (alive) {
- try {
- Thread.sleep(random.nextInt(500));
- } catch (InterruptedException e) {
- //ignore
- }
- for (int i = 0; i < locks.length; i++) {
- locks[i].acquire();
- try {
- Thread.sleep(random.nextInt(500));
- } catch (InterruptedException e1) {
- //ignore
- }
- }
- //release all locks
- for (int i = locks.length; --i >= 0;) {
- locks[i].release();
- }
- }
- done = true;
- }
-
- public void isDone() {
- while (!done) {
- try {
- Thread.yield();
- Thread.sleep(100);
- Thread.yield();
- } catch (InterruptedException e) {
- //ignore
- }
- }
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/OrderedLockTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/OrderedLockTest.java
deleted file mode 100644
index 8fec968..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/OrderedLockTest.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import junit.framework.TestCase;
-import org.eclipse.core.internal.jobs.LockManager;
-import org.eclipse.core.internal.jobs.OrderedLock;
-import org.eclipse.core.runtime.jobs.ILock;
-import org.eclipse.core.runtime.jobs.LockListener;
-import org.eclipse.core.tests.harness.TestBarrier;
-
-/**
- * Tests implementation of ILock objects
- */
-public class OrderedLockTest extends TestCase {
- public OrderedLockTest() {
- super(null);
- }
-
- public OrderedLockTest(String name) {
- super(name);
- }
-
- /**
- * Creates n runnables on the given lock and adds them to the given list.
- */
- private void createRunnables(ILock[] locks, int n, ArrayList allRunnables) {
- for (int i = 0; i < n; i++)
- allRunnables.add(new LockAcquiringRunnable(locks));
- }
-
- private void kill(ArrayList allRunnables) {
- for (Iterator it = allRunnables.iterator(); it.hasNext();) {
- LockAcquiringRunnable r = (LockAcquiringRunnable) it.next();
- r.kill();
- }
- }
-
- public void testComplex() {
- ArrayList allRunnables = new ArrayList();
- LockManager manager = new LockManager();
- OrderedLock lock1 = manager.newLock();
- OrderedLock lock2 = manager.newLock();
- OrderedLock lock3 = manager.newLock();
- createRunnables(new ILock[] {lock1, lock2, lock3}, 5, allRunnables);
- createRunnables(new ILock[] {lock3, lock2, lock1}, 5, allRunnables);
- createRunnables(new ILock[] {lock1, lock3, lock2}, 5, allRunnables);
- createRunnables(new ILock[] {lock2, lock3, lock1}, 5, allRunnables);
- start(allRunnables);
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- }
- kill(allRunnables);
- for (int i = 0; i < allRunnables.size(); i++) {
- ((LockAcquiringRunnable) allRunnables.get(i)).isDone();
- }
- //the underlying array has to be empty
- assertTrue("Locks not removed from graph.", manager.isEmpty());
- }
-
- public void testSimple() {
- ArrayList allRunnables = new ArrayList();
- LockManager manager = new LockManager();
- OrderedLock lock1 = manager.newLock();
- OrderedLock lock2 = manager.newLock();
- OrderedLock lock3 = manager.newLock();
- createRunnables(new ILock[] {lock1, lock2, lock3}, 1, allRunnables);
- createRunnables(new ILock[] {lock3, lock2, lock1}, 1, allRunnables);
- start(allRunnables);
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- }
- kill(allRunnables);
- for (int i = 0; i < allRunnables.size(); i++) {
- ((LockAcquiringRunnable) allRunnables.get(i)).isDone();
- }
- //the underlying array has to be empty
- assertTrue("Locks not removed from graph.", manager.isEmpty());
- }
-
- /**
- * test that an acquire call that times out does not
- * become the lock owner (regression test)
- */
- public void testLockTimeout() {
- //create a new lock manager and 1 lock
- final LockManager manager = new LockManager();
- final OrderedLock lock = manager.newLock();
- //status array for communicating between threads
- final int[] status = {TestBarrier.STATUS_START};
- //array to end a runnable after it is no longer needed
- final boolean[] alive = {true};
-
- //first runnable which is going to hold the created lock
- Runnable getLock = new Runnable() {
- public void run() {
- lock.acquire();
- status[0] = TestBarrier.STATUS_RUNNING;
- while (alive[0]) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- }
- }
- lock.release();
- status[0] = TestBarrier.STATUS_DONE;
- }
- };
-
- //second runnable which is going to try and acquire the given lock and then time out
- Runnable tryForLock = new Runnable() {
- public void run() {
- boolean success = false;
- try {
- success = lock.acquire(100);
- } catch (InterruptedException e) {
- }
- assertTrue("1.0", !success);
- assertTrue("1.1", !manager.isLockOwner());
- status[0] = TestBarrier.STATUS_WAIT_FOR_DONE;
- }
- };
-
- Thread first = new Thread(getLock);
- Thread second = new Thread(tryForLock);
-
- //start the first thread and wait for it to acquire the lock
- first.start();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_RUNNING);
- //start the second thread, make sure the assertion passes
- second.start();
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_WAIT_FOR_DONE);
- //let the first thread die
- alive[0] = false;
- TestBarrier.waitForStatus(status, TestBarrier.STATUS_DONE);
- //the underlying array has to be empty
- assertTrue("Locks not removed from graph.", manager.isEmpty());
- }
-
- /**
- * test that when a Lock Listener forces the Lock Manager to grant a lock
- * to a waiting thread, that other threads in the queue don't get disposed (regression test)
- */
- public void testLockRequestDisappearence() {
- //create a new lock manager and 1 lock
- final LockManager manager = new LockManager();
- final OrderedLock lock = manager.newLock();
- //status array for communicating between threads
- final int[] status = {TestBarrier.STATUS_WAIT_FOR_START, TestBarrier.STATUS_WAIT_FOR_START};
-
- //first runnable which is going to hold the created lock
- Runnable getLock = new Runnable() {
- public void run() {
- lock.acquire();
- status[0] = TestBarrier.STATUS_START;
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);
- lock.release();
- status[0] = TestBarrier.STATUS_DONE;
- }
- };
-
- //second runnable which is going to submit a request for this lock and wait until it is available
- Runnable waitForLock = new Runnable() {
- public void run() {
- status[1] = TestBarrier.STATUS_START;
- lock.acquire();
- assertTrue("1.0", manager.isLockOwner());
- lock.release();
- status[1] = TestBarrier.STATUS_DONE;
-
- }
- };
-
- //third runnable which is going to submit a request for this lock but not wait
- //because the hook is going to force it to be given the lock (implicitly)
- Runnable forceGetLock = new Runnable() {
- public void run() {
- lock.acquire();
- lock.release();
- status[0] = TestBarrier.STATUS_WAIT_FOR_DONE;
- }
- };
-
- //a locklistener to force lock manager to give the lock to the third runnable (implicitly)
- LockListener listener = new LockListener() {
- public boolean aboutToWait(Thread lockOwner) {
- return true;
- }
- };
-
- //assign each runnable to a separate thread
- Thread first = new Thread(getLock);
- Thread second = new Thread(waitForLock);
- Thread third = new Thread(forceGetLock);
-
- //start the first thread and wait for it to acquire the lock
- first.start();
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_START);
- //start the second thread, make sure it is added to the lock wait queue
- second.start();
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_START);
-
- //assign our listener to the manager
- manager.setLockListener(listener);
- //start the third thread
- third.start();
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_WAIT_FOR_DONE);
-
- //let the first runnable complete
- status[0] = TestBarrier.STATUS_RUNNING;
- TestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_DONE);
-
- //now wait for the second runnable to get the lock, and have the assertion pass
- TestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_DONE);
-
- //the underlying array has to be empty
- assertTrue("Locks not removed from graph.", manager.isEmpty());
- }
-
- private void start(ArrayList allRunnables) {
- for (Iterator it = allRunnables.iterator(); it.hasNext();) {
- LockAcquiringRunnable r = (LockAcquiringRunnable) it.next();
- new Thread(r).start();
- }
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/PathRule.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/PathRule.java
deleted file mode 100644
index 4fe7ac7..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/PathRule.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-
-/**
- * A hierarchical rule based on IPath. A path rule contains another path
- * rule if its path is a prefix of the other rule's path. A path rule is conflicting
- * with another rule if either one is a prefix of the other.
- */
-public class PathRule implements ISchedulingRule {
- private IPath path;
-
- public PathRule(IPath path) {
- this.path = path;
- }
-
- public PathRule(String pathString) {
- this.path = new Path(pathString);
- }
-
- public boolean contains(ISchedulingRule rule) {
- if (this == rule)
- return true;
- if (!(rule instanceof PathRule))
- return false;
- return path.isPrefixOf(((PathRule) rule).getFullPath());
- }
-
- public boolean isConflicting(ISchedulingRule rule) {
- if (!(rule instanceof PathRule))
- return false;
- IPath otherPath = ((PathRule) rule).getFullPath();
- return path.isPrefixOf(otherPath) || otherPath.isPrefixOf(path);
- }
-
- public IPath getFullPath() {
- return path;
- }
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return "PathRule(" + path + ")";
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/RandomTestRunnable.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/RandomTestRunnable.java
deleted file mode 100644
index b2c041a..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/RandomTestRunnable.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import java.util.Random;
-import org.eclipse.core.runtime.jobs.ILock;
-
-public class RandomTestRunnable extends Thread {
- private ILock[] locks;
- private Random random = new Random();
- private boolean alive;
- private boolean needRandomization;
-
- /**
- * This runnable will randomly acquire the given locks for
- * random periods of time, in the given order, or in random order (if specified)
- */
- public RandomTestRunnable(ILock[] locks, String name, boolean addRandomness) {
- super(name);
- this.locks = new ILock[locks.length];
- for (int i = 0; i < locks.length; i++) {
- this.locks[i] = locks[i];
- }
- this.alive = true;
- this.needRandomization = addRandomness;
- }
-
- public void kill() {
- alive = false;
- }
-
- public void run() {
- while (alive) {
- if (needRandomization) {
- for (int i = 0; i < locks.length; i++) {
- int nextFlip = random.nextInt(locks.length);
- ILock temp = locks[i];
- locks[i] = locks[nextFlip];
- locks[nextFlip] = temp;
- }
- }
- for (int i = 0; i < locks.length; i++) {
- locks[i].acquire();
- try {
- Thread.sleep(random.nextInt(500));
- } catch (InterruptedException e1) {
- }
- }
- //release all locks
- for (int i = locks.length; --i >= 0;) {
- locks[i].release();
- }
- }
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/ReadWriteMonitor.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/ReadWriteMonitor.java
deleted file mode 100644
index b810d74..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/ReadWriteMonitor.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import java.util.*;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.jobs.ILock;
-
-/**
- * Monitor ensuring no more than one writer working concurrently.
- * Multiple readers are allowed to perform simultaneously.
- */
-public class ReadWriteMonitor {
- private final Set blockedThreads = Collections.synchronizedSet(new HashSet());
- private ILock lock;
- /**
- * <0 : writing (cannot go beyond -1, i.e one concurrent writer)
- * =0 : idle
- * >0 : reading (number of concurrent readers)
- */
- private int status = 0;
-
- public ReadWriteMonitor(ILock lock) {
- this.lock = lock;
- }
-
- /**
- * Concurrent reading is allowed
- * Blocking only when already writing.
- */
- public void enterRead() {
- if (!incrementRead()) {
- blockedThreads.add(Thread.currentThread());
- //wait until this thread or another reader acquires the lock
- while (!incrementRead()) {
- try {
- lock.acquire(Long.MAX_VALUE);
- setStatus(1);
- break;
- } catch (InterruptedException e) {
- }
- }
- blockedThreads.remove(Thread.currentThread());
- }
- //interrupt other threads so all readers can proceed
- interruptBlockedThreads();
- }
-
- /**
- * Only one writer at a time is allowed to perform
- * Blocking only when already writing or reading.
- */
- public void enterWrite() {
- blockedThreads.add(Thread.currentThread());
- while (true) {
- try {
- lock.acquire(Long.MAX_VALUE);
- setStatus(-1);
- break;
- } catch (InterruptedException e) {
- }
- }
- blockedThreads.remove(Thread.currentThread());
- }
-
- /**
- * Synchronized to ensure field value is reconciled.
- */
- private synchronized void setStatus(int s) {
- this.status = s;
- }
-
- /**
- * Only notify waiting writer(s) if last reader
- */
- public synchronized void exitRead() {
- Assert.isTrue(status > 0, "exitRead without enterRead");
- if (--status == 0) {
- lock.release();
- interruptBlockedThreads();
- }
- }
-
- /**
- * When writing is over, all readers and possible
- * writers are granted permission to restart concurrently
- */
- public synchronized void exitWrite() {
- Assert.isTrue(status == -1, "exitWrite without enterWrite");
- status = 0;
- lock.release();
- interruptBlockedThreads();
- }
-
- /**
- * Atomic exitWrite/enterRead: Allows to keep monitor in between
- * exit write and next enter read.
- * When writing is over, all readers are granted permissing to restart
- * concurrently.
- * This is the same as:
- * <pre>
- * synchronized(monitor) {
- * monitor.exitWrite();
- * monitor.enterRead();
- * }
- * </pre>
- */
- public synchronized void exitWriteEnterRead() {
- //don't release the lock, just fix the counter to indicate a single reader
- status = 1;
- interruptBlockedThreads();
- }
-
- /**
- * Increment the reader count if it is safe to do so.
- */
- private synchronized boolean incrementRead() {
- if (status <= 0)
- return false;
- status++;
- return true;
- }
-
- /**
- * Wake up all waiting threads so they can compete for the counter again.
- */
- private void interruptBlockedThreads() {
- for (Iterator it = blockedThreads.iterator(); it.hasNext();)
- ((Thread) it.next()).interrupt();
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/RepeatingJob.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/RepeatingJob.java
deleted file mode 100644
index 9c4e8d4..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/RepeatingJob.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- * A job that runs the given number of times with a small delay between runs
- * Can report how many times it has run.
- */
-public class RepeatingJob extends Job {
- final int repeats;
- int runCount = 0;
- private static final int DELAY = 20;
- private Object myFamily;
-
- public RepeatingJob(String name, int repeats) {
- super(name);
- this.repeats = repeats;
- }
-
- public boolean belongsTo(Object family) {
- return family == myFamily;
- }
-
- /**
- * Returns the number of times this job has executed.
- */
- public int getRunCount() {
- return runCount;
- }
-
- protected IStatus run(IProgressMonitor monitor) {
- schedule(DELAY);
- runCount++;
- return Status.OK_STATUS;
- }
-
- public void setFamily(Object family) {
- this.myFamily = family;
- }
-
- public boolean shouldRun() {
- return runCount < repeats;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/SimpleRuleRunner.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/SimpleRuleRunner.java
deleted file mode 100644
index 2868f83..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/SimpleRuleRunner.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.core.tests.harness.TestBarrier;
-
-/**
- * This runnable will try to begin the given rule in the Job Manager. It will
- * end the rule before returning.
- */
-class SimpleRuleRunner implements Runnable {
- private ISchedulingRule rule;
- private IProgressMonitor monitor;
- private int[] status;
- RuntimeException exception;
- private static final IJobManager manager = Job.getJobManager();
-
- public SimpleRuleRunner(ISchedulingRule rule, int[] status, IProgressMonitor monitor) {
- this.rule = rule;
- this.monitor = monitor;
- this.status = status;
- this.exception = null;
- }
-
- public void run() {
- //tell the caller that we have entered the run method
- status[0] = TestBarrier.STATUS_RUNNING;
- try {
- try {
- manager.beginRule(rule, monitor);
- } finally {
- manager.endRule(rule);
- }
- } catch (OperationCanceledException e) {
- //ignore
- } catch (RuntimeException e) {
- exception = e;
- } finally {
- status[0] = TestBarrier.STATUS_DONE;
- }
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestBlockingMonitor.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestBlockingMonitor.java
deleted file mode 100644
index 6e8740c..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestBlockingMonitor.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import org.eclipse.core.runtime.IProgressMonitorWithBlocking;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.tests.harness.TestBarrier;
-import org.eclipse.core.tests.harness.TestProgressMonitor;
-
-/**
- * A test progress monitor that sends a signal to a barrier object when it
- * becomes blocked.
- */
-class TestBlockingMonitor extends TestProgressMonitor implements IProgressMonitorWithBlocking {
- private TestBarrier barrier;
- private boolean cancelled;
-
- public TestBlockingMonitor(int[] status, int index) {
- this(new TestBarrier(status, index));
- }
-
- public TestBlockingMonitor(TestBarrier barrier) {
- this.barrier = barrier;
- }
-
- public void clearBlocked() {
- //leave empty for now
- }
-
- public boolean isCanceled() {
- return cancelled;
- }
-
- public void setBlocked(IStatus reason) {
- barrier.setStatus(TestBarrier.STATUS_BLOCKED);
- }
-
- public void setCanceled(boolean b) {
- cancelled = true;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestJobFamily.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestJobFamily.java
deleted file mode 100644
index b09314e..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestJobFamily.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-public class TestJobFamily {
- public static final int TYPE_NONE = 0;
- public static final int TYPE_ONE = 1;
- public static final int TYPE_TWO = 2;
- public static final int TYPE_THREE = 3;
- public static final int TYPE_FOUR = 4;
- public static final int TYPE_FIVE = 5;
-
- private int type = TYPE_NONE;
-
- public TestJobFamily() {
- this(TYPE_NONE);
- }
-
- public TestJobFamily(int type) {
- this.type = type;
- }
-
- public int getType() {
- return type;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestLockListener.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestLockListener.java
deleted file mode 100644
index 1998210..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestLockListener.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import junit.framework.Assert;
-import org.eclipse.core.runtime.jobs.LockListener;
-
-/**
- * A lock listener used for testing that ensures wait/release calls are correctly paired.
- */
-public class TestLockListener extends LockListener {
- private boolean waiting;
-
- public synchronized void aboutToRelease() {
- waiting = false;
- }
-
- public synchronized boolean aboutToWait(Thread lockOwner) {
- waiting = true;
- return false;
- }
-
- public synchronized void assertNotWaiting(String message) {
- Assert.assertTrue(message, !waiting);
- }
-
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/VerboseJobListener.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/VerboseJobListener.java
deleted file mode 100644
index eb65596..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/VerboseJobListener.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.jobs;
-
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.IJobChangeListener;
-
-/**
- *
- */
-public class VerboseJobListener implements IJobChangeListener {
- public void aboutToRun(IJobChangeEvent event) {
- System.out.println("[" + Thread.currentThread() + "] aboutToRun: " + event.getJob());
- }
-
- public void scheduled(IJobChangeEvent event) {
- System.out.println("[" + Thread.currentThread() + "] scheduled: " + event.getJob());
- }
-
- public void done(IJobChangeEvent event) {
- System.out.println("[" + Thread.currentThread() + "] finished: " + event.getJob());
- }
-
- public void running(IJobChangeEvent event) {
- System.out.println("[" + Thread.currentThread() + "] running: " + event.getJob());
- }
-
- public void sleeping(IJobChangeEvent event) {
- System.out.println("[" + Thread.currentThread() + "] sleeping: " + event.getJob());
- }
-
- public void awake(IJobChangeEvent event) {
- System.out.println("[" + Thread.currentThread() + "] awake: " + event.getJob());
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/model/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/model/AllTests.java
deleted file mode 100644
index 80e9d4e..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/model/AllTests.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.model;
-
-import junit.framework.*;
-
-public class AllTests extends TestCase {
-
- public AllTests() {
- super(null);
- }
-
- public AllTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AllTests.class.getName());
- suite.addTest(ConfigurationElementModelTest.suite());
- return suite;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/model/ConfigurationElementModelTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/model/ConfigurationElementModelTest.java
deleted file mode 100644
index f1fd98a..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/model/ConfigurationElementModelTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.model;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.model.*;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-
-/**
- * Test cases for the ConfigurationElementModel class.
- */
-public class ConfigurationElementModelTest extends RuntimeTest {
-
- /**
- * Need a zero argument constructor to satisfy the test harness.
- * This constructor should not do any real work nor should it be
- * called by user code.
- */
- public ConfigurationElementModelTest() {
- super(null);
- }
-
- /**
- * Constructor for ConfigurationElementModelTest
- */
- public ConfigurationElementModelTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(ConfigurationElementModelTest.class.getName());
- suite.addTest(new ConfigurationElementModelTest("testConstructor"));
- suite.addTest(new ConfigurationElementModelTest("testIsReadOnly"));
- suite.addTest(new ConfigurationElementModelTest("testMarkReadOnly"));
- return suite;
- }
-
- public void testConstructor() {
-
- ConfigurationElementModel model = new ConfigurationElementModel();
-
- assertNotNull("1.0", model);
-
- assertNull("2.0", model.getParent());
- assertNull("2.1", model.getParentExtension());
- assertNull("2.2", model.getProperties());
- assertNull("2.3", model.getSubElements());
- assertNull("2.4", model.getValue());
- assertNull("2.5", model.getName());
-
- //assumes that a new-created object is not read-only
- assertTrue("3.0", !model.isReadOnly());
-
- }
-
- public void testIsReadOnly() {
-
- assertTrue("1.0", !new ConfigurationElementModel().isReadOnly());
-
- ConfigurationElementModel model = new ConfigurationElementModel();
- model.markReadOnly();
- assertTrue("2.0", model.isReadOnly());
- }
-
- public void testMarkReadOnly() {
-
- ConfigurationElementModel model = new ConfigurationElementModel();
- model.markReadOnly();
-
- assertTrue("1.0", model.isReadOnly());
-
- Factory fact = new Factory(new MultiStatus("plugin-id", 10, "", new Throwable()));
- ConfigurationPropertyModel[] c = new ConfigurationPropertyModel[1];
- c[0] = fact.createConfigurationProperty();
- try {
- // try to set an attribute to a read-only object
- model.setProperties(c);
- fail("2.0");
- } catch (Exception e) {
- }
-
- }
- // End of class
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/AllTests.java
deleted file mode 100644
index f503ab8..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/AllTests.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.perf;
-
-import junit.framework.*;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.eclipse.core.tests.session.*;
-import org.eclipse.core.tests.session.SetupManager.SetupException;
-
-public class AllTests extends TestCase {
- public static Test suite() {
- TestSuite suite = new TestSuite(AllTests.class.getName());
-
- // make sure that the first run of the startup test is not recorded - it is heavily
- // influenced by the presence and validity of the cached information
- try {
- PerformanceSessionTestSuite firstRun = new PerformanceSessionTestSuite(RuntimeTestsPlugin.PI_RUNTIME_TESTS, 1, StartupTest.class);
- Setup setup = firstRun.getSetup();
- setup.setSystemProperty("eclipseTest.ReportResults", "false");
- suite.addTest(firstRun);
- } catch (SetupException e) {
- fail("Unable to create warm up test");
- }
-
- // For this test to take advantage of the new runtime processing, we set "-eclipse.activateRuntimePlugins=false"
- try {
- PerformanceSessionTestSuite headlessSuite = new PerformanceSessionTestSuite(RuntimeTestsPlugin.PI_RUNTIME_TESTS, 5, StartupTest.class);
- Setup headlessSetup = headlessSuite.getSetup();
- headlessSetup.setSystemProperty("eclipse.activateRuntimePlugins", "false");
- suite.addTest(headlessSuite);
- } catch (SetupException e) {
- fail("Unable to setup headless startup performance test");
- }
-
- suite.addTest(new UIPerformanceSessionTestSuite(RuntimeTestsPlugin.PI_RUNTIME_TESTS, 5, UIStartupTest.class));
- suite.addTest(BenchPath.suite());
- suite.addTest(ContentTypePerformanceTest.suite());
- suite.addTest(PreferencePerformanceTest.suite());
- return suite;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/BenchPath.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/BenchPath.java
deleted file mode 100644
index c2949ea..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/BenchPath.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.perf;
-
-import java.util.HashMap;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.tests.harness.PerformanceTestRunner;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-
-public class BenchPath extends RuntimeTest {
- public BenchPath() {
- super();
- }
-
- public BenchPath(String testName) {
- super(testName);
- }
-
- public static Test suite() {
- return new TestSuite(BenchPath.class);
- // TestSuite suite = new TestSuite(BenchPath.class.getName());
- // suite.addTest(new BenchPath("testToString"));
- // return suite;
- }
-
- /**
- * Tests performance of equals and hashCode by using paths
- * as keys in a hash map.
- */
- public void testHash() {
- final int REPEAT = 500000;
- final IPath[] paths = generateVariousPaths();
- final HashMap map = new HashMap(32);
- for (int i = 0; i < paths.length; i++)
- map.put(paths[i], "");
- final int numPaths = paths.length;
- new PerformanceTestRunner() {
- protected void test() {
- for (int p = 0; p < numPaths; p++)
- map.get(paths[p]);
- }
- }.run(this, 10, REPEAT);
- }
-
- /**
- * Tests the performance of path creation
- */
- public void testPathCreation() {
- final int REPEAT = 50000;
- new PerformanceTestRunner() {
- protected void test() {
- //folders (5)
- new Path("/");
- new Path("/Foo");
- new Path("/Foo/bar");
- new Path("/Foo/bar/baz");
- new Path("/Foo/bar/baz/blap");
-
- //files (15)
- new Path("/Foo/abc.txt");
- new Path("/Foo/bar/abc.txt");
- new Path("/Foo/bar/baz/abc.txt");
- new Path("/Foo/bar/baz/blap/abc.txt");
- new Path("/Foo/bar/abc.txt");
- new Path("/Foo/bar/baz/abc.txt");
- new Path("/Foo/bar/baz/blap/abc.txt");
- new Path("/Foo/bar/baz/abc.txt");
- new Path("/Foo/bar/baz/blap/abc.txt");
- new Path("/Foo/bar/baz/abc.txt");
- new Path("/Foo/bar/baz/blap/abc.txt");
- new Path("/Foo/bar/baz/abc.txt");
- new Path("/Foo/bar/baz/blap/abc.txt");
- new Path("/Foo/bar/baz/blap/blam/abc.txt");
- new Path("/Foo/bar/baz/blap/blam/blip/boop/abc.txt");
- }
- }.run(this, 20, REPEAT);
- }
-
- /**
- * Tests the performance of Path.toOSString
- */
- public void testToOSString() {
- final int REPEAT = 50000;
- final IPath[] paths = generateVariousPaths();
- new PerformanceTestRunner() {
- protected void test() {
- for (int p = paths.length; --p >= 0;)
- paths[p].toOSString();
- }
- }.run(this, 10, REPEAT);
- }
-
- /**
- * Tests the performance of Path.toOSString
- */
- public void testToString() {
- final int REPEAT = 50000;
- final IPath[] paths = generateVariousPaths();
- new PerformanceTestRunner() {
- protected void test() {
- for (int p = paths.length; --p >= 0;)
- paths[p].toString();
- }
- }.run(this, 10, REPEAT);
- }
-
- /**
- * Returns an array containing various paths.
- */
- private IPath[] generateVariousPaths() {
- IPath[] paths = new IPath[20];
- int i = 0;
- paths[i++] = new Path("/");
- paths[i++] = new Path("/Foo");
- paths[i++] = new Path("/Foo/bar");
- paths[i++] = new Path("/Foo/bar/baz");
- paths[i++] = new Path("/Foo/bar/baz/blap");
-
- //files (15)
- paths[i++] = new Path("/Foo/abc.txt");
- paths[i++] = new Path("/Foo/bar/abc.txt");
- paths[i++] = new Path("/Foo/bar/baz/abc.txt");
- paths[i++] = new Path("/Foo/bar/baz/blap/abc.txt");
- paths[i++] = new Path("/Foo/bar/abc.txt");
- paths[i++] = new Path("/Foo/bar/baz/abc.txt");
- paths[i++] = new Path("/Foo/bar/baz/blap/abc.txt");
- paths[i++] = new Path("/Foo/bar/baz/abc.txt");
- paths[i++] = new Path("/Foo/bar/baz/blap/abc.txt");
- paths[i++] = new Path("/Foo/bar/baz/abc.txt");
- paths[i++] = new Path("/Foo/bar/baz/blap/abc.txt");
- paths[i++] = new Path("/Foo/bar/baz/abc.txt");
- paths[i++] = new Path("/Foo/bar/baz/blap/abc.txt");
- paths[i++] = new Path("/Foo/bar/baz/blap/blam/abc.txt");
- paths[i++] = new Path("/Foo/bar/baz/blap/blam/blip/boop/abc.txt");
-
- return paths;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/ContentTypePerformanceTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/ContentTypePerformanceTest.java
deleted file mode 100644
index ece0f26..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/ContentTypePerformanceTest.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.perf;
-
-import java.io.*;
-import java.net.MalformedURLException;
-import java.net.URL;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.internal.content.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.content.*;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.core.tests.harness.*;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.eclipse.core.tests.session.PerformanceSessionTestSuite;
-import org.eclipse.core.tests.session.SessionTestSuite;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-public class ContentTypePerformanceTest extends RuntimeTest {
-
- private final static String CONTENT_TYPE_PREF_NODE = Platform.PI_RUNTIME + IPath.SEPARATOR + "content-types"; //$NON-NLS-1$
- private static final String DEFAULT_NAME = "file_" + ContentTypePerformanceTest.class.getName();
- private static final int ELEMENTS_PER_LEVEL = 4;
- private static final int NUMBER_OF_LEVELS = 4;
- private static final String TEST_DATA_ID = "org.eclipse.core.tests.runtime.contenttype.perf.testdata";
- private static final int TOTAL_NUMBER_OF_ELEMENTS = computeTotalTypes(NUMBER_OF_LEVELS, ELEMENTS_PER_LEVEL);
-
- private static int computeTotalTypes(int levels, int elementsPerLevel) {
- double sum = 0;
- for (int i = 0; i <= levels; i++)
- sum += Math.pow(elementsPerLevel, i);
- return (int) sum;
- }
-
- private static String createContentType(Writer writer, int number, String baseTypeId) throws IOException {
- String id = "performance" + number;
- String definition = generateContentType(number, id, baseTypeId, new String[] {DEFAULT_NAME}, null);
- writer.write(definition);
- writer.write(System.getProperty("line.separator"));
- return id;
- }
-
- public static int createContentTypes(Writer writer, String baseTypeId, int created, int numberOfLevels, int nodesPerLevel) throws IOException {
- if (numberOfLevels == 0)
- return 0;
- int local = nodesPerLevel;
- for (int i = 0; i < nodesPerLevel; i++) {
- String id = createContentType(writer, created + i, baseTypeId);
- local += createContentTypes(writer, id, created + local, numberOfLevels - 1, nodesPerLevel);
- }
- return local;
- }
-
- private static String generateContentType(int number, String id, String baseTypeId, String[] fileNames, String[] fileExtensions) {
- StringBuffer result = new StringBuffer();
- result.append("<content-type id=\"");
- result.append(id);
- result.append("\" name=\"");
- result.append(id);
- result.append("\" ");
- if (baseTypeId != null) {
- result.append("base-type=\"");
- result.append(baseTypeId);
- result.append("\" ");
- }
- String fileNameList = Util.toListString(fileNames);
- if (fileNameList != null) {
- result.append("file-names=\"");
- result.append(fileNameList);
- result.append("\" ");
- }
- String fileExtensionsList = Util.toListString(fileExtensions);
- if (fileExtensions != null && fileExtensions.length > 0) {
- result.append("file-extensions=\"");
- result.append(fileExtensionsList);
- result.append("\" ");
- }
- result.append("describer=\"");
- result.append(BinarySignatureDescriber.class.getName());
- result.append(":");
- result.append(getSignatureString(number));
- result.append("\"/>");
- return result.toString();
- }
-
- private static String getContentTypeId(int i) {
- return TEST_DATA_ID + ".performance" + i;
- }
-
- private static byte[] getSignature(int number) {
- byte[] result = new byte[4];
- for (int i = 0; i < result.length; i++)
- result[i] = (byte) ((number >> (i * 8)) & 0xFFL);
- return result;
- }
-
- private static String getSignatureString(int number) {
- byte[] signature = getSignature(number);
- StringBuffer result = new StringBuffer(signature.length * 3 - 1);
- for (int i = 0; i < signature.length; i++) {
- result.append(Integer.toHexString(0xFF & signature[i]));
- result.append(' ');
- }
- result.deleteCharAt(result.length() - 1);
- return result.toString();
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(ContentTypePerformanceTest.class.getName());
-
- // suite.addTest(new ContentTypePerformanceTest("testDoSetUp"));
- // suite.addTest(new ContentTypePerformanceTest("testContentMatching"));
- // suite.addTest(new ContentTypePerformanceTest("testContentTXTMatching"));
- // suite.addTest(new ContentTypePerformanceTest("testContentXMLMatching"));
- // suite.addTest(new ContentTypePerformanceTest("testDoTearDown"));
-
- SessionTestSuite setUp = new SessionTestSuite(PI_RUNTIME_TESTS, "testDoSetUp");
- setUp.addTest(new ContentTypePerformanceTest("testDoSetUp"));
- suite.addTest(setUp);
-
- TestSuite singleRun = new PerformanceSessionTestSuite(PI_RUNTIME_TESTS, 1, "singleSessionTests");
- singleRun.addTest(new ContentTypePerformanceTest("testContentMatching"));
- singleRun.addTest(new ContentTypePerformanceTest("testNameMatching"));
- singleRun.addTest(new ContentTypePerformanceTest("testIsKindOf"));
- suite.addTest(singleRun);
-
- TestSuite loadCatalog = new PerformanceSessionTestSuite(PI_RUNTIME_TESTS, 10, "multipleSessionTests");
- loadCatalog.addTest(new ContentTypePerformanceTest("testLoadCatalog"));
- suite.addTest(loadCatalog);
-
- TestSuite tearDown = new SessionTestSuite(PI_RUNTIME_TESTS, "testDoTearDown");
- tearDown.addTest(new ContentTypePerformanceTest("testDoTearDown"));
- suite.addTest(tearDown);
- return suite;
- }
-
- public ContentTypePerformanceTest(String name) {
- super(name);
- }
-
- private int countTestContentTypes(IContentType[] all) {
- String namespace = TEST_DATA_ID + '.';
- int count = 0;
- for (int i = 0; i < all.length; i++)
- if (all[i].getId().startsWith(namespace))
- count++;
- return count;
- }
-
- private Bundle installContentTypes(String tag, int numberOfLevels, int nodesPerLevel) {
- TestRegistryChangeListener listener = new TestRegistryChangeListener(Platform.PI_RUNTIME, ContentTypeBuilder.PT_CONTENTTYPES, null, null);
- Bundle installed = null;
- listener.register();
- try {
- IPath pluginLocation = getRandomLocation();
- pluginLocation.toFile().mkdirs();
- URL installURL = null;
- try {
- installURL = pluginLocation.toFile().toURL();
- } catch (MalformedURLException e) {
- fail(tag + ".0.5", e);
- }
- Writer writer = null;
- try {
- writer = new BufferedWriter(new FileWriter(pluginLocation.append("plugin.xml").toFile()), 0x10000);
- writer.write("<plugin id=\"" + TEST_DATA_ID + "\" name=\"Content Type Performance Test Data\" version=\"1\">");
- writer.write(System.getProperty("line.separator"));
- writer.write("<requires><import plugin=\"" + PI_RUNTIME_TESTS + "\"/></requires>");
- writer.write(System.getProperty("line.separator"));
- writer.write("<extension point=\"org.eclipse.core.runtime.contentTypes\">");
- writer.write(System.getProperty("line.separator"));
- String root = createContentType(writer, 0, null);
- createContentTypes(writer, root, 1, numberOfLevels, nodesPerLevel);
- writer.write("</extension></plugin>");
- } catch (IOException e) {
- fail(tag + ".1.0", e);
- } finally {
- if (writer != null)
- try {
- writer.close();
- } catch (IOException e) {
- fail("1.1", e);
- }
- }
- try {
- installed = RuntimeTestsPlugin.getContext().installBundle(installURL.toExternalForm());
- } catch (BundleException e) {
- fail(tag + ".3.0", e);
- }
- BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {installed});
- assertTrue(tag + ".4.0", listener.eventReceived(10000));
- } finally {
- listener.unregister();
- }
- return installed;
- }
-
- /**
- * Warms up the content type registry.
- */
- private void loadChildren() {
- final IContentTypeManager manager = Platform.getContentTypeManager();
- IContentType[] allTypes = manager.getAllContentTypes();
- for (int i = 0; i < allTypes.length; i++) {
- String[] fileNames = allTypes[i].getFileSpecs(IContentType.IGNORE_USER_DEFINED | IContentType.FILE_NAME_SPEC);
- for (int j = 0; j < fileNames.length; j++)
- manager.findContentTypeFor(fileNames[j]);
- String[] fileExtensions = allTypes[i].getFileSpecs(IContentType.IGNORE_USER_DEFINED | IContentType.FILE_EXTENSION_SPEC);
- for (int j = 0; j < fileExtensions.length; j++)
- manager.findContentTypeFor("anyname." + fileExtensions[j]);
- }
- }
-
- /**
- * Returns a loaded content type manager. Except for load time tests, this method should
- * be called outside the scope of performance monitoring.
- */
- private IContentTypeManager loadContentTypeManager() {
- // any cheap interaction that causes the catalog to be built
- Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT);
- return Platform.getContentTypeManager();
- }
-
- /** Forces all describers to be loaded.*/
- private void loadDescribers() {
- final IContentTypeManager manager = Platform.getContentTypeManager();
- IContentType[] allTypes = manager.getAllContentTypes();
- for (int i = 0; i < allTypes.length; i++)
- ((ContentTypeHandler) allTypes[i]).getTarget().getDescriber();
- }
-
- private void loadPreferences() {
- new InstanceScope().getNode(CONTENT_TYPE_PREF_NODE);
- }
-
- /** Tests how much the size of the catalog affects the performance of content type matching by content analysis */
- public void testContentMatching() {
- loadPreferences();
- // warm up content type registry
- final IContentTypeManager manager = loadContentTypeManager();
- loadDescribers();
- loadChildren();
- new PerformanceTestRunner() {
- protected void test() {
- try {
- for (int i = 0; i < TOTAL_NUMBER_OF_ELEMENTS; i++) {
- String id = getContentTypeId(i);
- IContentType[] result = manager.findContentTypesFor(new ByteArrayInputStream(getSignature(i)), DEFAULT_NAME);
- assertEquals("1.0." + i, 1, result.length);
- assertEquals("1.1." + i, id, result[0].getId());
- }
- } catch (IOException e) {
- fail("2.0", e);
- }
- }
- }.run(this, 10, 2);
- }
-
- public void testDoSetUp() {
- installContentTypes("1.0", NUMBER_OF_LEVELS, ELEMENTS_PER_LEVEL);
- }
-
- public void testDoTearDown() {
- Bundle bundle = Platform.getBundle(TEST_DATA_ID);
- if (bundle == null)
- // there is nothing to clean up (install failed?)
- fail("1.0 nothing to clean-up");
- try {
- bundle.uninstall();
- ensureDoesNotExistInFileSystem(new File(new URL(bundle.getLocation()).getFile()));
- } catch (MalformedURLException e) {
- fail("2.0", e);
- } catch (BundleException e) {
- fail("3.0", e);
- }
- }
-
- public void testIsKindOf() {
- // warm up preference service
- loadPreferences();
- // warm up content type registry
- final IContentTypeManager manager = loadContentTypeManager();
- loadChildren();
- final IContentType root = manager.getContentType(getContentTypeId(0));
- assertNotNull("2.0", root);
- new PerformanceTestRunner() {
- protected void test() {
- for (int i = 0; i < TOTAL_NUMBER_OF_ELEMENTS; i++) {
- IContentType type = manager.getContentType(getContentTypeId(i));
- assertNotNull("3.0." + i, type);
- assertTrue("3.1." + i, type.isKindOf(root));
- }
- }
- }.run(this, 10, 500);
- }
-
- /**
- * This test is intended for running as a session test.
- */
- public void testLoadCatalog() {
- // warm up preference service
- loadPreferences();
- PerformanceTestRunner runner = new PerformanceTestRunner() {
- protected void test() {
- // any interation that will cause the registry to be loaded
- Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT);
- }
- };
- runner.setRegressionReason("Loading the content types traverses all extensions to the content type extension point, and that operation became more expensive in 3.1. Thankfully, it happens only once per session.");
- runner.run(this, 1, /* must run only once - the suite controls how many sessions are run */1);
- // sanity check to make sure we are running with good data
- assertEquals("missing content types", TOTAL_NUMBER_OF_ELEMENTS, countTestContentTypes(Platform.getContentTypeManager().getAllContentTypes()));
- }
-
- /** Tests how much the size of the catalog affects the performance of content type matching by name */
- public void testNameMatching() {
- // warm up preference service
- loadPreferences();
- // warm up content type registry
- final IContentTypeManager manager = loadContentTypeManager();
- loadDescribers();
- loadChildren();
- new PerformanceTestRunner() {
- protected void test() {
- IContentType[] associated = manager.findContentTypesFor("foo.txt");
- // we know at least the etxt content type should be here
- assertTrue("2.0", associated.length >= 1);
- // and it is supposed to be the first one (since it is at the root)
- assertEquals("2.1", IContentTypeManager.CT_TEXT, associated[0].getId());
- }
- }.run(this, 10, 200000);
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/PreferencePerformanceTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/PreferencePerformanceTest.java
deleted file mode 100644
index 18b293e..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/PreferencePerformanceTest.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.perf;
-
-import java.util.ArrayList;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.tests.harness.PerformanceTestRunner;
-import org.eclipse.core.tests.internal.preferences.TestScope;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-public class PreferencePerformanceTest extends RuntimeTest {
- private static final int INNER_LOOP = 10000;
- private static final int KEYS_PER_NODE = 1000;
-
- public static Test suite() {
- return new TestSuite(PreferencePerformanceTest.class);
- // TestSuite suite = new TestSuite(PreferencePerformanceTest.class.getName());
- // suite.addTest(new PreferencePerformanceTest("testPutStringKeys"));
- // return suite;
- }
-
- public PreferencePerformanceTest() {
- super();
- }
-
- public PreferencePerformanceTest(String testName) {
- super(testName);
- }
-
- /*
- * Return a 2 dimensional String array with the first element being the keys
- * and the second being the values. All the keys will have the given prefix.
- */
- private String[][] getCommonPrefixKeys(int size, String prefix) {
- ArrayList keyList = new ArrayList();
- ArrayList valueList = new ArrayList();
- for (int i = 0; i < size; i++) {
- keyList.add(prefix + '.' + Integer.toString(i) + getUniqueString());
- valueList.add(Integer.toString(i));
- }
- String[][] result = new String[2][];
- result[0] = (String[]) keyList.toArray(new String[keyList.size()]);
- result[1] = (String[]) valueList.toArray(new String[valueList.size()]);
- return result;
- }
-
- private IEclipsePreferences getScopeRoot() {
- return (IEclipsePreferences) Platform.getPreferencesService().getRootNode().node(TestScope.SCOPE);
- }
-
- /*
- * Return a 2 dimensional String array with the first element being the keys
- * and the second being the values. The keys will be integers in sequential order.
- */
- private String[][] getSequentialKeys(int size) {
- ArrayList keyList = new ArrayList();
- ArrayList valueList = new ArrayList();
- for (int i = 0; i < size; i++) {
- keyList.add(Integer.toString(i));
- valueList.add(Integer.toString(i));
- }
- String[][] result = new String[2][];
- result[0] = (String[]) keyList.toArray(new String[keyList.size()]);
- result[1] = (String[]) valueList.toArray(new String[valueList.size()]);
- return result;
- }
-
- /*
- * Return a 2 dimensional String array with the first element being the keys
- * and the second being the values. All the keys will have a unique prefix.
- */
- private String[][] getUniqueKeys(int size) {
- ArrayList keyList = new ArrayList();
- ArrayList valueList = new ArrayList();
- for (int i = 0; i < size; i++) {
- keyList.add(Integer.toString(i) + getUniqueString());
- valueList.add(Integer.toString(i));
- }
- String[][] result = new String[2][];
- result[0] = (String[]) keyList.toArray(new String[keyList.size()]);
- result[1] = (String[]) valueList.toArray(new String[valueList.size()]);
- return result;
- }
-
- /**
- * Time how long it takes to retrieve KEYS_PER_NODE keys with a common prefix.
- * This is a good finger print test because preference keys typically have a common
- * prefix (org.eclipse.component.keyName).
- */
- public void testGetStringCommonPrefixKeys() {
- // setup
- final String qualifier = getUniqueString();
- String[][] kvp = getCommonPrefixKeys(KEYS_PER_NODE, qualifier);
- final String[] keys = kvp[0];
- final String[] values = kvp[1];
-
- // run the test
- PerformanceTestRunner runner = new PerformanceTestRunner() {
- Preferences prefs;
-
- // set the values outside the timed loop
- protected void setUp() {
- prefs = getScopeRoot().node(qualifier);
- for (int i = 0; i < keys.length; i++)
- prefs.put(keys[i], values[i]);
- }
-
- // clean-up
- protected void tearDown() {
- try {
- prefs.removeNode();
- } catch (BackingStoreException e) {
- fail("0.99", e);
- }
- }
-
- // test retrieval
- protected void test() {
- for (int i = 0; i < keys.length; i++)
- prefs.get(keys[i], null);
- }
- };
- runner.setFingerprintName("Retrieve preference values");
- runner.run(this, 10, INNER_LOOP);
- }
-
- /*
- * Time how long it takes to get KEYS_PER_NODE keys that aren't there.
- * Fill the node up with KEYS_PER_NODE key/value pairs so it has some data
- */
- public void testGetStringMisses() {
- // setup
- final String qualifier = getUniqueString();
- String[][] kvp = getUniqueKeys(KEYS_PER_NODE);
- final String[] keys = kvp[0];
- final String[] values = kvp[1];
- final String[] missingKeys = getUniqueKeys(KEYS_PER_NODE)[0];
-
- // run the test
- new PerformanceTestRunner() {
- Preferences prefs;
-
- // set the values outside the timed loop
- protected void setUp() {
- prefs = getScopeRoot().node(qualifier);
- for (int i = 0; i < keys.length; i++)
- prefs.put(keys[i], values[i]);
- }
-
- // clean-up
- protected void tearDown() {
- try {
- prefs.removeNode();
- } catch (BackingStoreException e) {
- fail("0.99", e);
- }
- }
-
- // how long to get the values?
- protected void test() {
- for (int i = 0; i < keys.length; i++)
- prefs.get(missingKeys[i], null);
- }
- }.run(this, 10, INNER_LOOP);
- }
-
- /*
- * Time how long it takes to retrieve KEYS_PER_NODE keys which are constructed
- * from sequential integers.
- */
- public void testGetStringSequentialKeys() {
- // setup
- final String qualifier = getUniqueString();
- String[][] kvp = getSequentialKeys(KEYS_PER_NODE);
- final String[] keys = kvp[0];
- final String[] values = kvp[1];
-
- // run the test
- new PerformanceTestRunner() {
- Preferences prefs;
-
- // set the values outside the timed loop
- protected void setUp() {
- prefs = getScopeRoot().node(qualifier);
- for (int i = 0; i < keys.length; i++)
- prefs.put(keys[i], values[i]);
- }
-
- // clean-up
- protected void tearDown() {
- try {
- prefs.removeNode();
- } catch (BackingStoreException e) {
- fail("0.99", e);
- }
- }
-
- // how long to get the values?
- protected void test() {
- for (int i = 0; i < keys.length; i++)
- prefs.get(keys[i], null);
- }
- }.run(this, 10, INNER_LOOP);
- }
-
- /*
- * Time how long it takes to get KEYS_PER_NODE keys that are unique.
- */
- public void testGetStringUniqueKeys() {
- // setup
- final String qualifier = getUniqueString();
- String[][] kvp = getUniqueKeys(KEYS_PER_NODE);
- final String[] keys = kvp[0];
- final String[] values = kvp[1];
-
- // run the test
- new PerformanceTestRunner() {
- Preferences prefs;
-
- // set the values outside the timed loop
- protected void setUp() {
- prefs = getScopeRoot().node(qualifier);
- for (int i = 0; i < keys.length; i++)
- prefs.put(keys[i], values[i]);
- }
-
- // clean-up
- protected void tearDown() {
- try {
- prefs.removeNode();
- } catch (BackingStoreException e) {
- fail("0.99", e);
- }
- }
-
- // how long to get the values?
- protected void test() {
- for (int i = 0; i < keys.length; i++)
- prefs.get(keys[i], null);
- }
- }.run(this, 10, INNER_LOOP);
- }
-
- /*
- * Time how long it takes to put KEYS_PER_NODE keys into a preference node.
- */
- public void testPutStringKeys() {
-
- // setup outside the timed block
- final String qualifier = getUniqueString();
- final ArrayList keyList = new ArrayList();
- final ArrayList valueList = new ArrayList();
- for (int i = 0; i < KEYS_PER_NODE; i++) {
- keyList.add(getUniqueString() + Integer.toString(i));
- valueList.add(Integer.toString(i));
- }
- final String[] keys = (String[]) keyList.toArray(new String[keyList.size()]);
- final String[] values = (String[]) valueList.toArray(new String[valueList.size()]);
-
- // run the test
- new PerformanceTestRunner() {
- Preferences prefs;
-
- protected void setUp() {
- prefs = getScopeRoot().node(qualifier);
- }
-
- // clean-up
- protected void tearDown() {
- try {
- prefs.removeNode();
- } catch (BackingStoreException e) {
- fail("0.99", e);
- }
- }
-
- // how long to set the values?
- protected void test() {
- for (int i = 0; i < keys.length; i++)
- prefs.put(keys[i], values[i]);
- }
- }.run(this, 10, INNER_LOOP);
- }
-
- /*
- * Add KEYS_PER_NODE keys to a preference node and then remove them one at a time.
- */
- public void testRemoveStringKeys() {
-
- // gather the key/value pairs before so we don't time it
- final String qualifier = getUniqueString();
- final ArrayList keyList = new ArrayList();
- final ArrayList valueList = new ArrayList();
- for (int i = 0; i < KEYS_PER_NODE; i++) {
- keyList.add(getUniqueString() + Integer.toString(i));
- valueList.add(Integer.toString(i));
- }
- final String[] keys = (String[]) keyList.toArray(new String[keyList.size()]);
- final String[] values = (String[]) valueList.toArray(new String[valueList.size()]);
-
- // run the performance test
- new PerformanceTestRunner() {
- Preferences prefs;
-
- // fill the node with values each run
- protected void setUp() {
- prefs = getScopeRoot().node(qualifier);
- for (int i = 0; i < keys.length; i++)
- prefs.put(keys[i], values[i]);
- }
-
- // clean-up at the end of each run
- protected void tearDown() {
- try {
- prefs.removeNode();
- } catch (BackingStoreException e) {
- fail("0.99", e);
- }
- }
-
- // can only run this once because there is only so many keys you can remove
-
- // the test is how long it takes to remove all the values
- protected void test() {
- for (int i = 0; i < keys.length; i++)
- prefs.remove(keys[i]);
- }
- }.run(this, 50, 1);
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/StartupTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/StartupTest.java
deleted file mode 100644
index 862fb91..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/StartupTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.perf;
-
-import junit.framework.*;
-import org.eclipse.test.performance.*;
-
-public class StartupTest extends TestCase {
-
- static private final String explanation = "Performance decrease caused by the increase in the number of source bundles. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=215464 for details.";
-
- public static Test suite() {
- return new TestSuite(StartupTest.class);
- }
-
- public StartupTest(String methodName) {
- super(methodName);
- }
-
- public void testApplicationStartup() {
- PerformanceMeter meter = Performance.getDefault().createPerformanceMeter(getClass().getName() + '.' + getName());
- try {
- meter.stop();
- // tag for showing in the performance fingerprint graph
- Performance performance = Performance.getDefault();
- performance.tagAsGlobalSummary(meter, "Core Headless Startup", Dimension.ELAPSED_PROCESS);
- performance.setComment(meter, Performance.EXPLAINS_DEGRADATION_COMMENT, explanation);
- String reportOption = System.getProperty("eclipseTest.ReportResults");
- boolean bReport = (reportOption == null) ? true : !("false".equalsIgnoreCase(reportOption));
- if (bReport)
- meter.commit();
- Performance.getDefault().assertPerformanceInRelativeBand(meter, Dimension.ELAPSED_PROCESS, -100, 5);
- } finally {
- meter.dispose();
- }
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/UIStartupTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/UIStartupTest.java
deleted file mode 100644
index 8fd986f..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/UIStartupTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.perf;
-
-import junit.framework.*;
-import org.eclipse.test.performance.*;
-
-public class UIStartupTest extends TestCase {
-
- public static Test suite() {
- return new TestSuite(UIStartupTest.class);
- }
-
- public UIStartupTest(String methodName) {
- super(methodName);
- }
-
- public void testUIApplicationStartup() {
- PerformanceMeter meter = Performance.getDefault().createPerformanceMeter(getClass().getName() + '.' + getName());
- try {
- meter.stop();
- Performance.getDefault().tagAsGlobalSummary(meter, "Core UI Startup", Dimension.ELAPSED_PROCESS);
- meter.commit();
- Performance.getDefault().assertPerformanceInRelativeBand(meter, Dimension.ELAPSED_PROCESS, -50, 5);
- } finally {
- meter.dispose();
- }
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/session/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/session/AllTests.java
deleted file mode 100644
index 6491156..0000000
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/session/AllTests.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tests.runtime.session;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import org.eclipse.core.tests.internal.registry.ExtensionRegistryStaticTest;
-import org.eclipse.core.tests.runtime.RuntimeTest;
-import org.eclipse.core.tests.session.SessionTestSuite;
-
-/**
- * @since 3.1
- */
-public class AllTests extends TestCase {
- public static Test suite() {
- SessionTestSuite runtimeSessionTests = new SessionTestSuite(RuntimeTest.PI_RUNTIME_TESTS, AllTests.class.getName());
- runtimeSessionTests.addTest(ExtensionRegistryStaticTest.suite());
- return runtimeSessionTests;
- }
-}
diff --git a/tests/org.eclipse.core.tests.runtime/test.xml b/tests/org.eclipse.core.tests.runtime/test.xml
deleted file mode 100644
index 941049e..0000000
--- a/tests/org.eclipse.core.tests.runtime/test.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<project name="Core Resources Automated Tests" default="run" basedir=".">
-
- <!-- The property ${eclipse-home} should be passed into this script -->
- <!-- sets the properties eclipse-home, and library-file -->
- <property name="eclipse-home" value="${basedir}/../../"/>
- <property name="library-file" value="${eclipse-home}/plugins/org.eclipse.test/library.xml"/>
- <property name="runtime_location" value="${eclipse-home}/core_runtime_sniff_folder"/>
- <property name="plugin-name" value="org.eclipse.core.tests.runtime"/>
-
- <!-- This target holds all initialization code that needs to be done for -->
- <!-- all tests that are to be run. Initialization for individual tests -->
- <!-- should be done within the body of the suite target. -->
- <target name="init">
- <tstamp/>
- </target>
-
- <!-- This target holds code to cleanup the testing environment after the tests -->
- <!-- have been run. You can use this to delete temporary files that are created. -->
- <target name="cleanup">
- <delete dir="${runtime_location}" quiet="true"/>
- <delete dir="${resources_location}" quiet="true"/>
- <delete dir="${osgi_location}" quiet="true"/>
- </target>
-
- <!-- This target runs the test suite. Any actions that need to happen after all -->
- <!-- the tests have been run should go here. -->
- <target name="run" depends="init,suite,cleanup">
- <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
- <property name="includes" value="org*.xml"/>
- <property name="output-file" value="${plugin-name}.xml"/>
- </ant>
- </target>
-
- <!-- This target runs the performance test suites. Any actions that need to happen after all -->
- <!-- the tests have been run should go here. -->
- <target name="performance" depends="init,performance-suite,cleanup">
- <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
- <property name="includes" value="org*.xml"/>
- <property name="output-file" value="${plugin-name}.xml"/>
- </ant>
- </target>
-
- <target name="RuntimeTests" depends="init,cleanup">
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${runtime_location}"/>
- <property name="plugin-name" value="org.eclipse.core.tests.runtime"/>
- <property name="classname" value="org.eclipse.core.tests.runtime.AutomatedTests"/>
- </ant>
- </target>
-
- <target name="RuntimePerformanceTests" depends="init,cleanup">
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${runtime_location}"/>
- <property name="plugin-name" value="org.eclipse.core.tests.runtime"/>
- <property name="classname" value="org.eclipse.core.tests.runtime.perf.AllTests"/>
- </ant>
- </target>
-
-
- <!-- This target defines the tests that need to be run. -->
- <target name="suite" depends="RuntimeTests"/>
-
- <!-- This target defines the performance tests that need to be run. -->
- <target name="performance-suite" depends="RuntimePerformanceTests"/>
-
- </project>