This commit was manufactured by cvs2svn to create branch 'runtime_split'.
Sprout from master 2005-11-10 20:18:03 UTC John Arthorne <johna> 'extra debugging information'
Delete:
bundles/org.eclipse.core.boot/.classpath
bundles/org.eclipse.core.boot/.cvsignore
bundles/org.eclipse.core.boot/.project
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.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/.template
bundles/org.eclipse.core.expressions/META-INF/MANIFEST.MF
bundles/org.eclipse.core.expressions/about.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/plugin.properties
bundles/org.eclipse.core.expressions/plugin.xml
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/IEvaluationContext.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/Assert.java
bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AssertionFailedException.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/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/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.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/META-INF/MANIFEST.MF
bundles/org.eclipse.core.runtime/about.html
bundles/org.eclipse.core.runtime/about_files/NOTICE.txt
bundles/org.eclipse.core.runtime/about_files/asl-v20.txt
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/adapters.exsd
bundles/org.eclipse.core.runtime/schema/applications.exsd
bundles/org.eclipse.core.runtime/schema/contentTypes.exsd
bundles/org.eclipse.core.runtime/schema/preferences.exsd
bundles/org.eclipse.core.runtime/schema/products.exsd
bundles/org.eclipse.core.runtime/scripts/src-runtime.jardesc
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/boot/PlatformURLBaseConnection.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/boot/PlatformURLConnection.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/boot/PlatformURLHandler.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/BasicDescription.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentDescription.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentType.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeBuilder.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeCatalog.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeHandler.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeManager.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeMatcher.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeSettings.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeVisitor.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/DefaultDescription.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/FileSpec.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/IContentTypeInfo.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ILazySource.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/LazyInputStream.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/LazyReader.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/LowLevelIOException.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/TextContentDescriber.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/Util.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/XMLContentDescriber.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/XMLRootHandler.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/Deadlock.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/DeadlockDetector.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/ImplicitJobs.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/InternalJob.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/JobChangeEvent.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/JobListeners.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/JobManager.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/JobQueue.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/JobStatus.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/LockManager.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/OrderedLock.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/Queue.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/Semaphore.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/ThreadJob.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/Worker.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/WorkerPool.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/AbstractScope.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/Base64.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/ConfigurationPreferences.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/DefaultPreferences.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/ExportedPreferences.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/InstancePreferences.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/ListenerRegistry.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/LookupOrder.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/PreferenceForwarder.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/PreferencesService.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/RootPreferences.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/StringPool.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ConfigurationElement.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ConfigurationElementHandle.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/Contribution.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/EclipseBundleListener.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/Extension.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionDelta.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionHandle.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionPoint.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionPointHandle.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionRegistry.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionsParser.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/Handle.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/HashtableOfInt.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/HashtableOfStringAndInt.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/IObjectManager.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/KeyedElement.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/KeyedHashSet.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ReadWriteMonitor.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ReferenceHashSet.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ReferenceMap.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryChangeEvent.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryDelta.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryObject.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryObjectManager.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/TableReader.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/TableWriter.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/TemporaryObjectManager.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ThirdLevelConfigurationElementHandle.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AdapterFactoryProxy.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AdapterManager.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Assert.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AssertionFailedException.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AuthorizationDatabase.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AuthorizationHandler.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Cipher.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/CipherInputStream.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/CipherOutputStream.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/DataArea.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/DevClassPathHelper.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/FindSupport.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/HashMapOfString.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/ListenerList.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/ObjectMap.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/PlatformURLConfigConnection.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformURLFragmentConnection.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformURLMetaConnection.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformURLPluginConnection.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Policy.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/ResourceTranslator.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/URLTool.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/messages.properties
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/CoreException.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IAdaptable.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IAdapterFactory.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IAdapterManager.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IBundleGroup.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IBundleGroupProvider.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IConfigurationElement.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExecutableExtension.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExecutableExtensionFactory.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtension.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtensionDelta.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtensionPoint.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtensionRegistry.java
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/ILogListener.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPath.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/IProgressMonitor.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProgressMonitorWithBlocking.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IRegistryChangeEvent.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IRegistryChangeListener.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ISafeRunnable.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IStatus.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/InvalidRegistryObjectException.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/MultiStatus.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/NullProgressMonitor.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/OperationCanceledException.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Path.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/PlatformObject.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Plugin.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/PluginVersionIdentifier.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Preferences.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ProgressMonitorWrapper.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/QualifiedName.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Status.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/SubProgressMonitor.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/BinarySignatureDescriber.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/IContentDescriber.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/IContentDescription.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/IContentType.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/IContentTypeManager.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/IContentTypeMatcher.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/IContentTypeSettings.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/ITextContentDescriber.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/XMLRootElementContentDescriber.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/package.html
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/ExtensionTracker.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/IExtensionChangeHandler.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/IExtensionTracker.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/IFilter.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/package.html
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/IJobChangeEvent.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/IJobChangeListener.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/IJobManager.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/IJobStatus.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/ILock.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/ISchedulingRule.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/Job.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/JobChangeAdapter.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/LockListener.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/MultiRule.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/ProgressProvider.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/package.html
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/package.html
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/AbstractPreferenceInitializer.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/ConfigurationScope.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/DefaultScope.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IEclipsePreferences.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IExportedPreferences.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IPreferenceFilter.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IPreferenceNodeVisitor.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IPreferencesService.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IScope.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IScopeContext.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/InstanceScope.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/PreferenceFilterEntry.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/PreferenceModifyListener.java
bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/package.html
bundles/org.eclipse.core.runtime/src/org/osgi/service/prefs/BackingStoreException.java
bundles/org.eclipse.core.runtime/src/org/osgi/service/prefs/Preferences.java
bundles/org.eclipse.core.runtime/src/org/osgi/service/prefs/PreferencesService.java
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/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/Policy.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/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/NLSPlugin.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/FindUnusedMembers.java
bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedMembersAction.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/.template
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/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.xmldiff --git a/bundles/org.eclipse.core.boot/.classpath b/bundles/org.eclipse.core.boot/.classpath
deleted file mode 100644
index ddf0f40..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.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <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/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.boot/META-INF/MANIFEST.MF
deleted file mode 100644
index 01c3d02..0000000
--- a/bundles/org.eclipse.core.boot/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,8 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.core.boot
-Bundle-Version: 3.1.0.qualifier
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Eclipse-AutoStart: true
diff --git a/bundles/org.eclipse.core.boot/about.html b/bundles/org.eclipse.core.boot/about.html
deleted file mode 100644
index 6f6b96c..0000000
--- a/bundles/org.eclipse.core.boot/about.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>February 24, 2005</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.</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 fea56fc..0000000
--- a/bundles/org.eclipse.core.boot/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = .,\
- plugin.properties,\
- about.html,\
- META-INF/,\
- readme.txt
-src.includes=about.html
diff --git a/bundles/org.eclipse.core.boot/plugin.properties b/bundles/org.eclipse.core.boot/plugin.properties
deleted file mode 100644
index f91a5c2..0000000
--- a/bundles/org.eclipse.core.boot/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.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.expressions/.classpath b/bundles/org.eclipse.core.expressions/.classpath
deleted file mode 100644
index 065ac06..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.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <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 d6dd2e9..0000000
--- a/bundles/org.eclipse.core.expressions/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,66 +0,0 @@
-#Wed May 25 10:22:17 CEST 2005
-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=100
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-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.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=warning
-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=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
-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/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 0305c96..0000000
--- a/bundles/org.eclipse.core.expressions/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,5 +0,0 @@
-#Tue Dec 21 11:05:13 CET 2004
-eclipse.preferences.version=1
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.ondemandthreshold=99
-org.eclipse.jdt.ui.importorder=java;javax;org.eclipse.core.runtime;org.eclipse.core.expressions;org.eclipse.core.internal.expressions;
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 bdc7dc9..0000000
--- a/bundles/org.eclipse.core.expressions/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,13 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.core.expressions; singleton:=true
-Bundle-Version: 3.2.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
-Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.1.0,4.0.0)"
-Eclipse-LazyStart: true
diff --git a/bundles/org.eclipse.core.expressions/about.html b/bundles/org.eclipse.core.expressions/about.html
deleted file mode 100644
index 6f6b96c..0000000
--- a/bundles/org.eclipse.core.expressions/about.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>February 24, 2005</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.</p>
-
-</body>
-</html>
\ No newline at end of file
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 910d001..0000000
--- a/bundles/org.eclipse.core.expressions/buildnotes_core-expressions.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/component.xml b/bundles/org.eclipse.core.expressions/component.xml
deleted file mode 100644
index d79e323..0000000
--- a/bundles/org.eclipse.core.expressions/component.xml
+++ /dev/null
@@ -1,19 +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"/>
- </package>
-
- <component-depends unrestricted="true"/>
-</component>
diff --git a/bundles/org.eclipse.core.expressions/plugin.properties b/bundles/org.eclipse.core.expressions/plugin.properties
deleted file mode 100644
index c96c176..0000000
--- a/bundles/org.eclipse.core.expressions/plugin.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-pluginName= Expression Language
-providerName= Eclipse.org
-
-propertyTesterExtensionPoint= Property Tester
diff --git a/bundles/org.eclipse.core.expressions/plugin.xml b/bundles/org.eclipse.core.expressions/plugin.xml
deleted file mode 100644
index d1d1a42..0000000
--- a/bundles/org.eclipse.core.expressions/plugin.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
-
- <extension-point id="propertyTesters" name="%propertyTesterExtensionPoint" schema="schema/propertyTesters.exsd"/>
-
-</plugin>
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 bdca18c..0000000
--- a/bundles/org.eclipse.core.expressions/schema/expressionLanguage.exsd
+++ /dev/null
@@ -1,483 +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="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"/>
- </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"/>
- </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"/>
- </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"/>
- </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 teh property tester doing the actual
- testing isn't loaded yet.
- </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>
- </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 operatand of the equals tests. 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
- referneced 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"/>
- </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
- referneced 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"/>
- </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"/>
- </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"/>
- </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>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- Release 3.0
- </documentation>
- </annotation>
-
- <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/bundles/org.eclipse.core.expressions/schema/propertyTesters.exsd b/bundles/org.eclipse.core.expressions/schema/propertyTesters.exsd
deleted file mode 100644
index 868241b..0000000
--- a/bundles/org.eclipse.core.expressions/schema/propertyTesters.exsd
+++ /dev/null
@@ -1,151 +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>
- </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="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="since"/>
- </appInfo>
- <documentation>
- 3.0
- </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="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/bundles/org.eclipse.core.expressions/scripts/exportplugin.xml b/bundles/org.eclipse.core.expressions/scripts/exportplugin.xml
deleted file mode 100644
index 4a22abd..0000000
--- a/bundles/org.eclipse.core.expressions/scripts/exportplugin.xml
+++ /dev/null
@@ -1,31 +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="plugin_version" value="_3.1.0" />
- <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 file="${destjar}" />
- <zip zipfile="${destjar}">
- <fileset dir=".">
- <include name="plugin.xml" />
- <include name="plugin.properties" />
- <include name="META-INF/**" />
- <include name=".options" />
- <include name="schema/**" />
- <include name="src/**" />
- </fileset>
- <fileset dir="bin" />
- </zip>
- </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 10a9617..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ElementHandler.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.core.internal.expressions.CompositeExpression;
-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;
-
- /**
- * 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
- */
- protected void processChildren(ExpressionConverter converter, IConfigurationElement 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 bbdc973..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationContext.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.core.internal.expressions.Assert;
-
-/**
- * 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
- */
-public class EvaluationContext implements IEvaluationContext {
-
- private IEvaluationContext fParent;
- private Object fDefaultVariable;
- private Map/*<String, Object>*/ fVariables;
- private IVariableResolver[] fVariableResolvers;
-
- /**
- * 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 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 edb4fda..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationResult.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.expressions;
-
-import org.eclipse.core.internal.expressions.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
- */
-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 47557e5..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/Expression.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 {
-
- /**
- * 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) {
- }
- };
-
- /**
- * 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());
- }
-}
\ No newline at end of file
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 f8500e0..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionConverter.java
+++ /dev/null
@@ -1,108 +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;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.core.internal.expressions.Assert;
-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} tree 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;
- }
-
- /* 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,
- children[i].getName()),
- null));
- result.add(child);
- }
- }
- }
-}
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 0130301..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionInfo.java
+++ /dev/null
@@ -1,210 +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 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 a
- * expression tree as 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
- */
-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;
-
- /**
- * 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 off accessed variables.
- *
- * @return the set off 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 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();
- 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);
- 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);
- 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;
- } 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 misbehaving expression types.
- *
- * @param other the information to merge with
- */
- private void mergeMisbehavingExpressionTypes(ExpressionInfo other) {
- if (fMisbehavingExpressionTypes == null) {
- fMisbehavingExpressionTypes= other.fMisbehavingExpressionTypes;
- } 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 0fa229e..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionTagNames.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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$
-}
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 6f62a40..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IEvaluationContext.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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
- */
-public interface IEvaluationContext {
-
- /**
- * 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();
-
- /**
- * 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;
-}
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 d360a56..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IPropertyTester.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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
- */
-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 662627d..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IVariableResolver.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 b053100..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/PropertyTester.java
+++ /dev/null
@@ -1,115 +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.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.core.internal.expressions.PropertyTesterDescriptor;
-
-import org.osgi.framework.Bundle;
-
-/**
- * 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 fragement.isDefaultPackage();
- * }
- * 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>
- * @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
- */
- 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
- */
- 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 fBundle= Platform.getBundle(fConfigElement.getNamespace());
- return fBundle.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 20c7ad3..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/package.html
+++ /dev/null
@@ -1,268 +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 to be used in extension points. The expression
-language isn't bound to one specific extension point. It can be used in
-all extension points which have to define some sort of enablement
-expression.
-<h3>XML expression language</h3>
-The XML expression language consists of the following predefined
-expression tags. The set is open and can be extended by an extension
-point provider to customize the expression language to its need.
-<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 <span style="font-family: monospace">propertyTesters</span>.
-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
- <span style="font-family: monospace">isPublic</span> defined in the
- namespace <code>org.myNamespace</code> for type <code>org.eclipse.core.IMethod</code>
- then this property will not override the property <span
- style="font-family: monospace">isPublic</span> 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 matcher.match(fileName);
- } 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. 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 609f859..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AdaptExpression.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-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.IEvaluationContext;
-import org.eclipse.core.expressions.ExpressionInfo;
-
-public class AdaptExpression extends CompositeExpression {
-
- private static final String ATT_TYPE= "type"; //$NON-NLS-1$
-
- private String fTypeName;
-
- public AdaptExpression(IConfigurationElement configElement) throws CoreException {
- fTypeName= configElement.getAttribute(ATT_TYPE);
- Expressions.checkAttribute(ATT_TYPE, fTypeName);
- }
-
- public AdaptExpression(String typeName) {
- Assert.isNotNull(typeName);
- fTypeName= typeName;
- }
-
- /* (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;
- if (Expressions.isInstanceOf(var, fTypeName)) {
- adapted= var;
- } else {
- IAdapterManager manager= Platform.getAdapterManager();
- if (!manager.hasAdapter(var, fTypeName))
- return EvaluationResult.FALSE;
-
- adapted= manager.getAdapter(var, fTypeName);
- }
- // the adapted result is null but hasAdapter returned true. This means
- // that there is an adapter but the adapter isn't loaded yet.
- if (adapted == null)
- return EvaluationResult.NOT_LOADED;
- 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 aa4315a..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AndExpression.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- return evaluateAnd(context);
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Assert.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Assert.java
deleted file mode 100644
index 61956a6..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Assert.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-/**
- * <code>Assert</code> is useful for for embedding runtime sanity checks
- * in code.
- * The predicate methods all test a condition and throw some
- * type of unchecked exception if the condition does not hold.
- * <p>
- * Assertion failure exceptions, like most runtime exceptions, are
- * thrown when something is misbehaving. Assertion failures are invariably
- * unspecified behavior; consequently, clients should never rely on
- * these being thrown (and certainly should not being catching them
- * specifically).
- * </p>
- */
-public final class Assert {
-
- /* This class is not intended to be instantiated. */
- private Assert() {
- // not allowed
- }
- /** Asserts that an argument is legal. If the given boolean is
- * not <code>true</code>, an <code>IllegalArgumentException</code>
- * is thrown.
- *
- * @param expression the outcode of the check
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- * @exception IllegalArgumentException if the legality test failed
- */
- public static boolean isLegal(boolean expression) {
- return isLegal(expression, ""); //$NON-NLS-1$
- }
- /** Asserts that an argument is legal. If the given boolean is
- * not <code>true</code>, an <code>IllegalArgumentException</code>
- * is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param expression the outcode of the check
- * @param message the message to include in the exception
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- * @exception IllegalArgumentException if the legality test failed
- */
- public static boolean isLegal(boolean expression, String message) {
- if (!expression)
- throw new IllegalArgumentException(message);
- return expression;
- }
- /** Asserts that the given object is not <code>null</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- *
- * @param object the value to test
- * @exception IllegalArgumentException if the object is <code>null</code>
- */
- public static void isNotNull(Object object) {
- isNotNull(object, ""); //$NON-NLS-1$
- }
- /** Asserts that the given object is not <code>null</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param object the value to test
- * @param message the message to include in the exception
- * @exception IllegalArgumentException if the object is <code>null</code>
- */
- public static void isNotNull(Object object, String message) {
- if (object == null)
- throw new AssertionFailedException("null argument:" + message); //$NON-NLS-1$
- }
- /** Asserts that the given boolean is <code>true</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- *
- * @param expression the outcode of the check
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- */
- public static boolean isTrue(boolean expression) {
- return isTrue(expression, ""); //$NON-NLS-1$
- }
- /** Asserts that the given boolean is <code>true</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param expression the outcode of the check
- * @param message the message to include in the exception
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- */
- public static boolean isTrue(boolean expression, String message) {
- if (!expression)
- throw new AssertionFailedException("assertion failed: " + message); //$NON-NLS-1$
- return expression;
- }
-}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AssertionFailedException.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AssertionFailedException.java
deleted file mode 100644
index 16358e0..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AssertionFailedException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-/**
- * <code>AssertionFailedException</code> is a runtime exception thrown
- * by some of the methods in <code>Assert</code>.
- * <p>
- * This class is not declared public to prevent some misuses; programs that catch
- * or otherwise depend on assertion failures are susceptible to unexpected
- * breakage when assertions in the code are added or removed.
- * </p>
- */
-/* package */
-class AssertionFailedException extends RuntimeException {
-
- /** This class is not intended to be serialized. */
- private static final long serialVersionUID= 1L;
-
- /**
- * Constructs a new exception.
- */
- public AssertionFailedException() {
- super();
- }
-
- /**
- * Constructs a new exception with the given message.
- *
- * @param detail the detail message
- */
- public AssertionFailedException(String detail) {
- super(detail);
- }
-}
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 d8e89b1..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CompositeExpression.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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.IEvaluationContext;
-import org.eclipse.core.expressions.ExpressionInfo;
-
-public abstract class CompositeExpression extends Expression {
-
- private static final Expression[] EMPTY_ARRAY= new Expression[0];
-
- 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);
- }
- }
-}
\ No newline at end of file
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 97a56f5..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CountExpression.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import java.util.Collection;
-
-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.IEvaluationContext;
-import org.eclipse.core.expressions.ExpressionInfo;
-
-
-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;
-
- private int fMode;
- private int fSize;
-
- public CountExpression(IConfigurationElement configElement) {
- String size = configElement.getAttribute(ATT_VALUE);
- initializeSize(size);
- }
-
- 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();
- Expressions.checkCollection(var, this);
- Collection collection= (Collection)var;
- int size= collection.size();
- 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();
- }
-}
\ No newline at end of file
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 90ea311..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefaultVariable.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-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 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/EnablementExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EnablementExpression.java
deleted file mode 100644
index 11ebaa9..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EnablementExpression.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-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 {
-
- public EnablementExpression(IConfigurationElement configElement) {
- // config element not used yet.
- }
-
- 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 d699505..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EqualsExpression.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-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.IEvaluationContext;
-import org.eclipse.core.expressions.ExpressionInfo;
-
-public class EqualsExpression extends Expression {
-
- 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 EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- Object element= context.getDefaultVariable();
- return EvaluationResult.valueOf(element.equals(fExpectedValue));
- }
-
- public void collectExpressionInfo(ExpressionInfo info) {
- info.markDefaultVariableAccessed();
- }
-}
\ No newline at end of file
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 67063b3..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.java
+++ /dev/null
@@ -1,41 +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.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_unknown_element;
- 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;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, ExpressionMessages.class);
- }
-}
\ No newline at end of file
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 62d6a79..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.properties
+++ /dev/null
@@ -1,33 +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
-###############################################################################
-
-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_unknown_element= Unknown expression element {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.
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 6a29a57..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionPlugin.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.eclipse.core.runtime.Plugin;
-
-import org.osgi.framework.BundleContext;
-
-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 39f690b..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionStatus.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 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 70a9787..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Expressions.java
+++ /dev/null
@@ -1,188 +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.expressions;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.core.expressions.Expression;
-
-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())));
- }
-
- //---- Argument parsing --------------------------------------------
-
- private 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[] 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 c579aa3..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/InstanceofExpression.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-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.IEvaluationContext;
-import org.eclipse.core.expressions.ExpressionInfo;
-
-public class InstanceofExpression extends Expression {
-
- private String fTypeName;
-
- public InstanceofExpression(IConfigurationElement element) throws CoreException {
- fTypeName= element.getAttribute(ATT_VALUE);
- Expressions.checkAttribute(ATT_VALUE, fTypeName);
- }
-
- 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();
- }
-
- //---- Debugging ---------------------------------------------------
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return "<instanceof value=\"" + fTypeName + "\"/>"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
\ No newline at end of file
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 8e352d9..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/IterateExpression.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.core.expressions.ExpressionInfo;
-
-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 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 int OR= 1;
- private static final int AND= 2;
-
- private int fOperator;
-
- public IterateExpression(IConfigurationElement configElement) throws CoreException {
- String opValue= configElement.getAttribute(ATT_OPERATOR);
- initializeOperatorValue(opValue);
- }
-
- public IterateExpression(String opValue) throws CoreException {
- initializeOperatorValue(opValue);
- }
-
- 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;
- }
- }
- }
-
- /* (non-Javadoc)
- * @see Expression#evaluate(IVariablePool)
- */
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- Object var= context.getDefaultVariable();
- Expressions.checkCollection(var, this);
- Collection col= (Collection)var;
- switch (col.size()) {
- case 0:
- return fOperator == AND ? 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;
- }
- }
-
- 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);
- }
-}
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 c17ee61..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Messages.java
+++ /dev/null
@@ -1,33 +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.expressions;
-
-import java.text.MessageFormat;
-
-/**
- * Helper class to format message strings.
- *
- * @since 3.1
- */
-public class Messages {
-
- public static String format(String message, Object object) {
- return MessageFormat.format(message, new Object[] { object});
- }
-
- public static String format(String message, Object[] objects) {
- return MessageFormat.format(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 02104e5..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/NotExpression.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.core.expressions.ExpressionInfo;
-
-public class NotExpression extends Expression {
-
- 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);
- }
-}
\ No newline at end of file
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 ae59b61..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/OrExpression.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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);
- }
-}
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 40dbb1e..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Property.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-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() {
- 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 5bbb1b7..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyCache.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-import java.util.LinkedHashMap;
-import java.util.Map.Entry;
-
-/* package */ class PropertyCache {
-
- private LinkedHashMap fCache;
-
- public PropertyCache(final int cacheSize) {
- // start with 100 elements but be able to grow until cacheSize
- fCache= new LinkedHashMap(100, 0.75f, true) {
- /** This class is not intended to be serialized. */
- private static final long serialVersionUID= 1L;
- protected boolean removeEldestEntry(Entry eldest) {
- return size() > 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.remove(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 3290201..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyTesterDescriptor.java
+++ /dev/null
@@ -1,98 +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.expressions;
-
-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;
-
-import org.osgi.framework.Bundle;
-
-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.getNamespace());
- 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/ResolveExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ResolveExpression.java
deleted file mode 100644
index 579a18a..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ResolveExpression.java
+++ /dev/null
@@ -1,59 +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.expressions;
-
-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.IEvaluationContext;
-import org.eclipse.core.expressions.ExpressionInfo;
-
-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$
-
- public ResolveExpression(IConfigurationElement configElement) throws CoreException {
- fVariable= configElement.getAttribute(ATT_VARIABLE);
- Expressions.checkAttribute(ATT_VARIABLE, fVariable);
- fArgs= Expressions.getArguments(configElement, 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);
- }
-}
\ No newline at end of file
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 d897b04..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/StandardElementHandler.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-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);
- }
- 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 b9c2793..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/SystemTestExpression.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions;
-
-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.IEvaluationContext;
-import org.eclipse.core.expressions.ExpressionInfo;
-
-public class SystemTestExpression extends Expression {
-
- private String fProperty;
- private String fExpectedValue;
-
- private static final String ATT_PROPERTY= "property"; //$NON-NLS-1$
-
- 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(String property, String 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();
- }
-
- //---- 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$
- }
-}
\ No newline at end of file
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 a061d68..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TestExpression.java
+++ /dev/null
@@ -1,96 +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.expressions;
-
-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.IEvaluationContext;
-import org.eclipse.core.expressions.ExpressionInfo;
-
-public class TestExpression extends Expression {
-
- private String fNamespace;
- private String fProperty;
- private Object[] fArgs;
- private Object fExpectedValue;
-
- private static final String ATT_PROPERTY= "property"; //$NON-NLS-1$
- private static final String ATT_ARGS= "args"; //$NON-NLS-1$
-
- 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('.');
- 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));
- }
-
- public TestExpression(String namespace, String property, Object[] args, Object expectedValue) {
- fNamespace= namespace;
- fProperty= property;
- fArgs= args;
- fExpectedValue= expectedValue;
- }
-
- 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);
- if (!property.isInstantiated())
- return EvaluationResult.NOT_LOADED;
- return EvaluationResult.valueOf(property.test(element, fArgs, fExpectedValue));
- }
-
- public void collectExpressionInfo(ExpressionInfo info) {
- info.markDefaultVariableAccessed();
- }
-
- //---- 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$
- "/>"; //$NON-NLS-1$
- }
-}
\ No newline at end of file
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 552262a..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtension.java
+++ /dev/null
@@ -1,146 +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.expressions;
-
-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 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) 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) 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()) {
- if (extender.isDeclaringPluginActive()) {
- return extender;
- } else {
- PropertyTester tester= (PropertyTester)extender;
- fExtenders[i]= extender= tester.internalCreateDescriptor();
- return extender;
- }
- } else {
- if (extender.isDeclaringPluginActive()) {
- 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);
- 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);
- 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 0c839e8..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtensionManager.java
+++ /dev/null
@@ -1,188 +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.expressions;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-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.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 synchronized Property getProperty(Object receiver, String namespace, String method) 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()) {
- 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);
- 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 61e0a82..0000000
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/WithExpression.java
+++ /dev/null
@@ -1,53 +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.expressions;
-
-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.IEvaluationContext;
-import org.eclipse.core.expressions.ExpressionInfo;
-
-public class WithExpression extends CompositeExpression {
-
- private String fVariable;
- private static final String ATT_VARIABLE= "variable"; //$NON-NLS-1$
-
- public WithExpression(IConfigurationElement configElement) throws CoreException {
- fVariable= configElement.getAttribute(ATT_VARIABLE);
- Expressions.checkAttribute(ATT_VARIABLE, fVariable);
- }
-
- public WithExpression(String variable) {
- fVariable= variable;
- }
-
- 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)));
- }
- 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.runtime/.classpath b/bundles/org.eclipse.core.runtime/.classpath
deleted file mode 100644
index 5d8b02c..0000000
--- a/bundles/org.eclipse.core.runtime/.classpath
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src">
- <attributes>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
- <attributes>
- </attributes>
- <accessrules>
- <accessrule kind="discouraged" pattern="**/internal/**"/>
- </accessrules>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
- <attributes>
- </attributes>
- </classpathentry>
- <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 11f075a..0000000
--- a/bundles/org.eclipse.core.runtime/.options
+++ /dev/null
@@ -1,49 +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 content types
-org.eclipse.core.runtime/contenttypes/debug=false
-
-# Prints debug information on running background jobs
-org.eclipse.core.runtime/jobs=false
-# Includes current date and time in job debug information
-org.eclipse.core.runtime/jobs/timing=false
-# Computes location of error on mismatched IJobManager.beginRule/endRule
-org.eclipse.core.runtime/jobs/beginend=false
-# Pedantic assertion checking on locks and deadlock reporting
-org.eclipse.core.runtime/jobs/locks=false
-# Throws an IllegalStateException when deadlock occurs
-org.eclipse.core.runtime/jobs/errorondeadlock=false
-
-# Turn on debugging for the registry.
-org.eclipse.core.runtime/registry/debug=false
-# Legacy PluginRegistryModel resolver
-org.eclipse.core.runtime/registry/debug/resolve=false
-# Extension registry change events
-org.eclipse.core.runtime/registry/debug/events/extension=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
-
-# Turn on debugging for preferences
-org.eclipse.core.runtime/preferences/general=false
-org.eclipse.core.runtime/preferences/get=false
-org.eclipse.core.runtime/preferences/set=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 8807128..0000000
--- a/bundles/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,77 +0,0 @@
-#Fri May 20 10:26:53 EDT 2005
-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.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.incompatibleJDKLevel=ignore
-org.eclipse.jdt.core.incompleteClasspath=error
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 ca35df9..0000000
--- a/bundles/org.eclipse.core.runtime/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,21 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Version: 3.1.100.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.boot;x-friends:="org.eclipse.core.resources,org.eclipse.core.runtime.compatibility,org.eclipse.pde.build",
- org.eclipse.core.internal.content;x-internal:=true,
- org.eclipse.core.internal.jobs;x-internal:=true,
- org.eclipse.core.internal.preferences;x-friends:="org.eclipse.core.resources",
- org.eclipse.core.internal.registry;x-internal:=true,
- org.eclipse.core.internal.runtime;x-friends:="org.eclipse.core.runtime.compatibility,org.eclipse.pde.build",
- org.eclipse.core.runtime,
- org.eclipse.core.runtime.content,
- org.eclipse.core.runtime.dynamichelpers,
- org.eclipse.core.runtime.jobs,
- org.eclipse.core.runtime.preferences,
- org.osgi.service.prefs;version="1.1"
-Require-Bundle: org.eclipse.osgi;bundle-version="[3.1.0,4.0.0)";visibility:=reexport
diff --git a/bundles/org.eclipse.core.runtime/about.html b/bundles/org.eclipse.core.runtime/about.html
deleted file mode 100644
index 58d3831..0000000
--- a/bundles/org.eclipse.core.runtime/about.html
+++ /dev/null
@@ -1,110 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>September 26, 2005</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" target="_blank">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.</p>
-
-<h3>Third Party Content</h3>
-
-<p>The Content includes items that have been sourced from third parties as follows:</p>
-
-<p><b>Jakarta Commons Collections</b></p>
-<p>The plug-in includes software developed by The Apache Software Foundation as part of the Jakarta Commons Collections project.</p>
-
-<p>The Jakarta Commons Collections binary code can be found in the plug-in JAR in the following files:</p>
-
-<ul>
- <li>org\eclipse\core\internal\registry\ReferenceMap.class</li>
-</ul>
-
-<p>The Jakarta Commons Collections source code can be found in src.zip in the following files:</p>
-
-<ul>
- <li>org\eclipse\core\internal\registry\ReferenceMap.java</li>
-</ul>
-
-<p>Your use of the Jakara Commons Collections code is subject to the terms and conditions of the Apache License, Version 2.0. A copy of the license is contained
-in the file <a href="about_files/asl-v20.txt" target="_blank">about_files/asl-v20.txt</a> and is also available at <a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">http://www.apache.org/licenses/LICENSE-2.0.html</a>.
-
-<p>The Apache attribution notice file <a href="about_files/NOTICE.TXT" target="_blank">about_files/NOTICE.TXT</a> is included with the Content in accordance with 4d of the Apache License, Version 2.0
-
-<p>The names "Jakarta" and "Apache Software Foundation" must not be used to endorse or promote products derived from this
-software without prior written permission. For written permission, please contact <a href="mailto:apache@apache.org">apache@apache.org</a>.</p>
-
-<p><b>OSGi Materials</b></p>
-
-<p>All files in the following sub-directories (and their sub-directories):</p>
-
-<ul>
- <li>org/osgi</li>
-</ul>
-
-<p>shall be defined as the "OSGi Materials." The OSGi Materials are:</p>
-
-<blockquote>
-Copyright (c) 2000, 2005
-<br /><br />
-OSGi Alliance
-Bishop Ranch 6<br/>
-2400 Camino Ramon, Suite 375<br/>
-San Ramon, CA 94583 USA
-<br /><br />
-All Rights Reserved.
-</blockquote>
-
-<p>The OSGi Materials are provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). For purposes of the EPL, "Program" will mean the OSGi Materials.</p>
-
-<p>Implementation of certain elements of the OSGi Materials may be subject to third party intellectual property rights, including without limitation, patent rights (such a third party may
-or may not be a member of the OSGi Alliance). The OSGi Alliance and its members are not responsible and shall not be held responsible in any manner for identifying or failing to identify any or all such third party
-intellectual property rights.</p>
-
-<small>OSGi™ is a trademark, registered trademark, or service mark of The OSGi Alliance in the US and other countries. Java is a trademark,
-registered trademark, or service mark of Sun Microsystems, Inc. in the US and other countries. All other trademarks, registered trademarks, or
-service marks used in the Content are the property of their respective owners and are hereby recognized.</small>
-
-<h3>Cryptography</h3>
-
-<p><b>Export Control</b></p>
-<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>
-
-<p><b>Encryption Items</b></p>
-
-<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 classified as Export Commodity Control Number (ECCN) 5D002.c.1 by the U.S. Government Department of Commerce,
-Bureau of Export Administration and deemed eligible 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.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/about_files/NOTICE.txt b/bundles/org.eclipse.core.runtime/about_files/NOTICE.txt
deleted file mode 100644
index 3f59805..0000000
--- a/bundles/org.eclipse.core.runtime/about_files/NOTICE.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
diff --git a/bundles/org.eclipse.core.runtime/about_files/asl-v20.txt b/bundles/org.eclipse.core.runtime/about_files/asl-v20.txt
deleted file mode 100644
index d645695..0000000
--- a/bundles/org.eclipse.core.runtime/about_files/asl-v20.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) 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. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/bundles/org.eclipse.core.runtime/build.properties b/bundles/org.eclipse.core.runtime/build.properties
deleted file mode 100644
index 7fc83b6..0000000
--- a/bundles/org.eclipse.core.runtime/build.properties
+++ /dev/null
@@ -1,22 +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/,\
- asl-v20.txt,\
- about_files/
-source.. = src/
-src.includes = about.html,\
- schema/,\
- about_files/
diff --git a/bundles/org.eclipse.core.runtime/component.xml b/bundles/org.eclipse.core.runtime/component.xml
deleted file mode 100644
index 130dd16..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="XMLRootElementContentDescriber" 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 dd533d7..0000000
--- a/bundles/org.eclipse.core.runtime/plugin.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-###############################################################################
-# Copyright (c) 2003, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-pluginName = Core Runtime
-providerName = Eclipse.org
-applicationsName = Applications
-shutdownHook = Shutdown Hook
-adaptersName = Adapter factories
-productsName = Products
-contentTypesName = Content Types
-textContentTypeName = Text
-xmlContentTypeName = XML
-propertiesContentTypeName = Properties
-preferencesName=Preferences
-preferencesExtPtName=Platform Preferences
diff --git a/bundles/org.eclipse.core.runtime/plugin.xml b/bundles/org.eclipse.core.runtime/plugin.xml
deleted file mode 100644
index 8f0eb2f..0000000
--- a/bundles/org.eclipse.core.runtime/plugin.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <extension-point id="applications" name="%applicationsName" schema="schema/applications.exsd"/>
- <extension-point id="products" name="%productsName" schema="schema/products.exsd"/>
- <extension-point id="adapters" name="%adaptersName" schema="schema/adapters.exsd"/>
- <extension-point id="preferences" name="%preferencesName" schema="schema/preferences.exsd"/>
- <extension-point id="contentTypes" name="%contentTypesName" schema="schema/contentTypes.exsd"/>
-
- <extension id="platform-preferences" point="org.eclipse.core.runtime.preferences" name="%preferencesExtPtName">
- <scope name="configuration" class="org.eclipse.core.internal.preferences.ConfigurationPreferences"/>
- <scope name="instance" class="org.eclipse.core.internal.preferences.InstancePreferences"/>
- <scope name="default" class="org.eclipse.core.internal.preferences.DefaultPreferences"/>
- </extension>
-
- <extension point="org.eclipse.core.runtime.contentTypes">
- <content-type id="text" name="%textContentTypeName"
- priority="high"
- file-extensions="txt">
- <describer class="org.eclipse.core.internal.content.TextContentDescriber"/>
- <property name="bom"/>
- <property name="charset"/>
- </content-type>
- <content-type id="xml" name="%xmlContentTypeName"
- base-type="org.eclipse.core.runtime.text"
- priority="high"
- file-extensions="xml">
- <property name="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="properties" name="%propertiesContentTypeName"
- base-type="org.eclipse.core.runtime.text"
- alias-for="org.eclipse.jdt.core.javaProperties"
- file-extensions="properties">
- <property name="charset" default="ISO-8859-1"/>
- </content-type>
- </extension>
-</plugin>
diff --git a/bundles/org.eclipse.core.runtime/schema/adapters.exsd b/bundles/org.eclipse.core.runtime/schema/adapters.exsd
deleted file mode 100644
index c759c77..0000000
--- a/bundles/org.eclipse.core.runtime/schema/adapters.exsd
+++ /dev/null
@@ -1,154 +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="adapters" name="Adapters"/>
- </appInfo>
- <documentation>
- The adapters extension point allows plug-ins to declaratively register adapter factories. This information is used to by the
- runtime XML expression language to determine existence of adapters without causing plug-ins to be loaded.
- Registration of adapter factories via extension point eliminates the need to manually register adapter factories when a plug-in starts up.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="factory" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="factory">
- <complexType>
- <sequence>
- <element ref="adapter" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="adaptableType" type="string" use="required">
- <annotation>
- <documentation>
- The fully qualified name of a class (typically implementing IAdaptable) that this factory provides adapters for.
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- The fully qualified name of the adapter factory class. Must implement <tt>org.eclipse.core.runtime.IAdapterFactory</tt>.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.core.runtime.IAdapterFactory"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="adapter">
- <complexType>
- <attribute name="type" type="string" use="required">
- <annotation>
- <documentation>
- The fully qualified name of a Java class or interface that this factory can adapt to.
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </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 an adapter declaration. This example declares that this plug-in will provide an adapter factory that will adapt objects of type IFile to objects of type MyFile.
-<p>
- <pre>
- <extension point="org.eclipse.core.runtime.adapters">
- <factory
- class="com.xyz.MyFileAdapterFactory"
- adaptableType="org.eclipse.core.resources.IFile">
- <adapter type="com.xyz.MyFile"/>
- </factory>
- </extension>
- </pre>
-</p>
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Adapter factories registered using this extension point can be queried using the method
-<code>IAdapterManager.hasAdapter</code>, or retrieved using one of the <tt>getAdapter</tt> methods on <tt>IAdapterFactory</tt>.
-An adapter factory registered with this extension point does not need to be registered at runtime using <tt>IAdapterFactory.registerAdapters</tt>.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- Several plug-ins in the platform provide adapters for a number of different IAdaptable objects.
- </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/applications.exsd b/bundles/org.eclipse.core.runtime/schema/applications.exsd
deleted file mode 100644
index a3c2b16..0000000
--- a/bundles/org.eclipse.core.runtime/schema/applications.exsd
+++ /dev/null
@@ -1,162 +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="applications" name="Applications"/>
- </appInfo>
- <documentation>
- Platform runtime supports plug-ins which would like to
-declare main entry points. That is, programs which
-would like to run using the platform runtime but yet
-control all aspects of execution can declare themselves
-as an application. Declared applications can be run
-directly from the main platform launcher by specifying
-the <i>-application</i> argument where the parameter
-is the id of an extension supplied to the
-applications extension point described here.
-This application is instantiated and run by the platform.
-Platform clients can also use the platform to lookup and
-run multiple applications.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="application"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string" use="required">
- <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="application">
- <complexType>
- <sequence>
- <element ref="run" minOccurs="0" maxOccurs="1"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="run">
- <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 which implements
-<samp>org.eclipse.core.runtime.IPlatformRunnable</samp>.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.core.runtime.IPlatformRunnable"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="parameter">
- <annotation>
- <appInfo>
- <meta.element labelAttribute="name"/>
- </appInfo>
- </annotation>
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- the name of this parameter made available to instances of the specified application class
- </documentation>
- </annotation>
- </attribute>
- <attribute name="value" type="string" use="required">
- <annotation>
- <documentation>
- the value of this parameter made available to instances of the specified application class
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- Following is an example of an application declaration:
-<p>
-<pre>
- <extension id="coolApplication" point="org.eclipse.core.runtime.applications">
- <application>
- <run class="com.xyz.applications.Cool">
- <parameter name="optimize" value="true"/>
- </run>
- </application>
- </extension>
-</pre>
-</p>
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- The value of the class attribute must represent an
-implementor of
-<samp>org.eclipse.core.runtime.IPlatformRunnable</samp>.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The platform supplies a number of applications including the platform workbench itself.
- </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/contentTypes.exsd b/bundles/org.eclipse.core.runtime/schema/contentTypes.exsd
deleted file mode 100644
index 6e92035..0000000
--- a/bundles/org.eclipse.core.runtime/schema/contentTypes.exsd
+++ /dev/null
@@ -1,360 +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="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 (simple id token, unique for content types within the extension namespace). The token cannot contain dot (.) or 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.XMLRootElementContentDescriber</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.XMLRootElementContentDescriber">
- <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.XMLRootElementContentDescriber</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 4eee8ba..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>
- 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/schema/products.exsd b/bundles/org.eclipse.core.runtime/schema/products.exsd
deleted file mode 100644
index b9b7ca0..0000000
--- a/bundles/org.eclipse.core.runtime/schema/products.exsd
+++ /dev/null
@@ -1,210 +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="products" name="Products"/>
- </appInfo>
- <documentation>
- Products are the Eclipse unit of branding. Product extensions are supplied by plug-ins wishing to define one or more products. There must be one product per extension as the extension id is used in processing and identifying the product.
-<p>
-There are two possible forms of product extension, static and dynamic. Static product extensions directly contain all relevant information about the product. Dynamic product extensions identify a class (an <code>IProductProvider</code>) which is capable of defining one or more products when queried.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <choice>
- <element ref="product"/>
- <element ref="provider"/>
- </choice>
- </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="product">
- <complexType>
- <sequence>
- <element ref="property" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="application" type="string" use="required">
- <annotation>
- <documentation>
- the default application to run when running this product
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- the human-readable name of this product
- </documentation>
- </annotation>
- </attribute>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- the human-readable description of this product
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="property">
- <annotation>
- <appInfo>
- <meta.element labelAttribute="name"/>
- </appInfo>
- </annotation>
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- the key under which this property is stored
- </documentation>
- </annotation>
- </attribute>
- <attribute name="value" type="string" use="required">
- <annotation>
- <documentation>
- the value of this property
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="provider">
- <annotation>
- <documentation>
- details of a product provider
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="run"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="run">
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- the fully-qualified name of a class which implements
-<samp>org.eclipse.core.runtime.IProductProvider</samp>.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.core.runtime.IProductProvider"/>
- </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 static product declaration:
-<p>
-<pre>
- <extension id="coolProduct" point="org.eclipse.core.runtime.products">
- <product name="%coolName" application="coolApplication" description="%coolDescription">
- <property name="windowImage" value="window.gif"/>
- <property name="aboutImage" value="image.gif"/>
- <property name="aboutText" value="%aboutText"/>
- <property name="appName" value="CoolApp"/>
- <property name="welcomePage" value="$nl$/welcome.xml"/>
- <property name="preferenceCustomization" value="plugin_customization.ini"/>
- </product>
- </extension>
-</pre>
-</p>
-
-The following is an example of a dynamic product (product provider) declaration:
-Following is an example of an application declaration:
-<p>
-<pre>
- <extension id="coolProvider" point="org.eclipse.core.runtime.products">
- <provider>
- <run class="com.example.productProvider"/>
- </provider>
- </extension>
-</pre>
-</p>
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Static product extensions provided here are represented at runtime by instances of <code>IProduct</code>. Dynamic product extensions must identify an implementor of <code>IProductProvider</code>. See <code>org.eclipse.ui.branding.IProductConstants</code>
-for details of the branding related product properties defined by the Eclipse UI.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- No implementations of <code>IProductProvider</code> are supplied.
- </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/boot/PlatformURLBaseConnection.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/boot/PlatformURLBaseConnection.java
deleted file mode 100644
index 5289c07..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/boot/PlatformURLBaseConnection.java
+++ /dev/null
@@ -1,56 +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.boot;
-
-import java.io.IOException;
-import java.net.URL;
-import org.eclipse.core.internal.runtime.Messages;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Platform URL support
- * platform:/base/ maps to platform installation location
- */
-public class PlatformURLBaseConnection extends PlatformURLConnection {
-
- // platform/ protocol
- public static final String PLATFORM = "base"; //$NON-NLS-1$
- public static final String PLATFORM_URL_STRING = PlatformURLHandler.PROTOCOL + PlatformURLHandler.PROTOCOL_SEPARATOR + "/" + PLATFORM + "/"; //$NON-NLS-1$ //$NON-NLS-2$
-
- private static URL installURL;
-
- public PlatformURLBaseConnection(URL url) {
- super(url);
- }
-
- protected boolean allowCaching() {
- return true;
- }
-
- protected URL resolve() throws IOException {
- String spec = url.getFile().trim();
- if (spec.startsWith("/")) //$NON-NLS-1$
- spec = spec.substring(1);
- if (!spec.startsWith(PLATFORM + "/")) { //$NON-NLS-1$
- String message = NLS.bind(Messages.url_badVariant, url);
- throw new IOException(message);
- }
- return spec.length() == PLATFORM.length() + 1 ? installURL : new URL(installURL, spec.substring(PLATFORM.length() + 1));
- }
-
- public static void startup(URL url) {
- // register connection type for platform:/base/ handling
- if (installURL != null)
- return;
- installURL = url;
- PlatformURLHandler.register(PLATFORM, PlatformURLBaseConnection.class);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/boot/PlatformURLConnection.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/boot/PlatformURLConnection.java
deleted file mode 100644
index 48c0ab7..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/boot/PlatformURLConnection.java
+++ /dev/null
@@ -1,525 +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.boot;
-
-import java.io.*;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Enumeration;
-import java.util.Properties;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.internal.runtime.Messages;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Platform URL support
- */
-public abstract class PlatformURLConnection extends URLConnection {
-
- private static String os, ws, nl;
-
- // URL access
- private boolean isInCache = false;
- private boolean isJar = false;
-
- // protected URL url; // declared in super (platform: URL)
- private URL resolvedURL = null; // resolved file URL (eg. http: URL)
- private URL cachedURL = null; // file URL in cache (file: URL)
-
- private URLConnection connection = null; // actual connection
-
- // local cache
- private static Properties cacheIndex = new Properties();
- private static String cacheLocation;
- private static String indexName;
- private static String filePrefix;
-
- // constants
- private static final int BUF_SIZE = 32768;
- private static final Object NOT_FOUND = new Object(); // marker
- private static final String CACHE_PROP = ".cache.properties"; //$NON-NLS-1$
- private static final String CACHE_LOCATION_PROP = "location"; //$NON-NLS-1$
- private static final String CACHE_INDEX_PROP = "index"; //$NON-NLS-1$
- private static final String CACHE_PREFIX_PROP = "prefix"; //$NON-NLS-1$
- private static final String CACHE_INDEX = ".index.properties"; //$NON-NLS-1$
- private static final String CACHE_DIR = ".eclipse-" + PlatformURLHandler.PROTOCOL + File.separator; //$NON-NLS-1$
-
- // debug tracing
- private static final String OPTION_DEBUG = Platform.PI_RUNTIME + "/url/debug"; //$NON-NLS-1$;
- private static final String OPTION_DEBUG_CONNECT = OPTION_DEBUG + "/connect"; //$NON-NLS-1$;
- private static final String OPTION_DEBUG_CACHE_LOOKUP = OPTION_DEBUG + "/cachelookup"; //$NON-NLS-1$;
- private static final String OPTION_DEBUG_CACHE_COPY = OPTION_DEBUG + "/cachecopy"; //$NON-NLS-1$;
-
- public final static boolean DEBUG;
- public final static boolean DEBUG_CONNECT;
- public final static boolean DEBUG_CACHE_LOOKUP;
- public final static boolean DEBUG_CACHE_COPY;
-
- static {
- if (InternalPlatform.DEBUG) {
- DEBUG = InternalPlatform.getDefault().getBooleanOption(OPTION_DEBUG, false);
- DEBUG_CONNECT = InternalPlatform.getDefault().getBooleanOption(OPTION_DEBUG_CONNECT, true);
- DEBUG_CACHE_LOOKUP = InternalPlatform.getDefault().getBooleanOption(OPTION_DEBUG_CACHE_LOOKUP, true);
- DEBUG_CACHE_COPY = InternalPlatform.getDefault().getBooleanOption(OPTION_DEBUG_CACHE_COPY, true);
- } else
- DEBUG = DEBUG_CONNECT = DEBUG_CACHE_LOOKUP = DEBUG_CACHE_COPY = false;
- }
-
- protected PlatformURLConnection(URL url) {
- super(url);
- }
-
- protected boolean allowCaching() {
- return false;
- }
-
- public void connect() throws IOException {
- connect(false);
- }
-
- private synchronized void connect(boolean asLocal) throws IOException {
- if (connected)
- return;
-
- if (shouldCache(asLocal)) {
- try {
- URL inCache = getURLInCache();
- if (inCache != null)
- connection = inCache.openConnection();
- } catch (IOException e) {
- // failed to cache ... will use resolved URL instead
- }
- }
-
- // use resolved URL
- if (connection == null)
- connection = resolvedURL.openConnection();
- connected = true;
- if (DEBUG && DEBUG_CONNECT)
- debug("Connected as " + connection.getURL()); //$NON-NLS-1$
- }
-
- //TODO consider refactoring this method... it is too long
- //TODO avoid cryptic identifiers such as ix, tgt, tmp, srcis, tgtos...
- private void copyToCache() throws IOException {
-
- if (isInCache | cachedURL == null)
- return;
- String tmp;
- int ix;
-
- // cache entry key
- String key;
- if (isJar) {
- tmp = url.getFile();
- ix = tmp.lastIndexOf(PlatformURLHandler.JAR_SEPARATOR);
- if (ix != -1)
- tmp = tmp.substring(0, ix);
- key = tmp;
- } else
- key = url.getFile();
-
- // source url
- URL src;
- if (isJar) {
- tmp = resolvedURL.getFile();
- ix = tmp.lastIndexOf(PlatformURLHandler.JAR_SEPARATOR);
- if (ix != -1)
- tmp = tmp.substring(0, ix);
- src = new URL(tmp);
- } else
- src = resolvedURL;
- InputStream srcis = null;
-
- // cache target
- String tgt;
- if (isJar) {
- tmp = cachedURL.getFile();
- ix = tmp.indexOf(PlatformURLHandler.PROTOCOL_SEPARATOR);
- if (ix != -1)
- tmp = tmp.substring(ix + 1);
- ix = tmp.lastIndexOf(PlatformURLHandler.JAR_SEPARATOR);
- if (ix != -1)
- tmp = tmp.substring(0, ix);
- tgt = tmp;
- } else
- tgt = cachedURL.getFile();
- File tgtFile = null;
- FileOutputStream tgtos = null;
-
- boolean error = false;
- long total = 0;
-
- try {
- if (DEBUG && DEBUG_CACHE_COPY) {
- if (isJar)
- debug("Caching jar as " + tgt); //$NON-NLS-1$
- else
- debug("Caching as " + tgt); //$NON-NLS-1$
- }
-
- srcis = src.openStream();
- byte[] buf = new byte[BUF_SIZE];
- int count = srcis.read(buf);
-
- tgtFile = new File(tgt);
- tgtos = new FileOutputStream(tgtFile);
-
- while (count != -1) {
- total += count;
- tgtos.write(buf, 0, count);
- count = srcis.read(buf);
- }
-
- srcis.close();
- srcis = null;
- tgtos.flush();
- tgtos.getFD().sync();
- tgtos.close();
- tgtos = null;
-
- // add cache entry
- cacheIndex.put(key, tgt);
- isInCache = true;
- } catch (IOException e) {
- error = true;
- cacheIndex.put(key, NOT_FOUND);
- // mark cache entry for this execution
- if (DEBUG && DEBUG_CACHE_COPY)
- debug("Failed to cache due to " + e); //$NON-NLS-1$
- throw e;
- } finally {
- if (!error && DEBUG && DEBUG_CACHE_COPY)
- debug(total + " bytes copied"); //$NON-NLS-1$
- if (srcis != null)
- srcis.close();
- if (tgtos != null)
- tgtos.close();
- }
- }
-
- protected void debug(String s) {
- System.out.println("URL " + getURL().toString() + "^" + Integer.toHexString(Thread.currentThread().hashCode()) + " " + s); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- private static void debugStartup(String s) {
- System.out.println("URL " + s); //$NON-NLS-1$
- }
-
- public URL[] getAuxillaryURLs() throws IOException {
- return null;
- }
-
- public synchronized InputStream getInputStream() throws IOException {
- if (!connected)
- connect();
- return connection.getInputStream();
- }
-
- public URL getResolvedURL() {
- return resolvedURL;
- }
-
- public URL getURLAsLocal() throws IOException {
- connect(true); // connect and force caching if necessary
- URL u = connection.getURL();
- String up = u.getProtocol();
- if (!up.equals(PlatformURLHandler.FILE) && !up.equals(PlatformURLHandler.JAR) && !up.startsWith(PlatformURLHandler.BUNDLE))
- throw new IOException(NLS.bind(Messages.url_noaccess, up));
- return u;
- }
-
- //TODO consider refactoring this method... it is too long
- private URL getURLInCache() throws IOException {
-
- if (!allowCaching())
- return null; // target should not be cached
-
- if (isInCache)
- return cachedURL;
-
- if (cacheLocation == null | cacheIndex == null)
- return null; // not caching
-
- // check if we are dealing with a .jar/ .zip
- String file = ""; //$NON-NLS-1$
- String jarEntry = null;
- if (isJar) {
- file = url.getFile();
- int ix = file.lastIndexOf(PlatformURLHandler.JAR_SEPARATOR);
- if (ix != -1) {
- jarEntry = file.substring(ix + PlatformURLHandler.JAR_SEPARATOR.length());
- file = file.substring(0, ix);
- }
- } else {
- file = url.getFile();
- jarEntry = null;
- }
-
- // check for cached entry
- String tmp = (String) cacheIndex.get(file);
-
- // check for "not found" marker
- if (tmp != null && tmp == NOT_FOUND)
- throw new IOException();
-
- // validate cache entry
- if (tmp != null && !(new File(tmp)).exists()) {
- tmp = null;
- cacheIndex.remove(url.getFile());
- }
-
- // found in cache
- if (tmp != null) {
- if (isJar) {
- if (DEBUG && DEBUG_CACHE_LOOKUP)
- debug("Jar located in cache as " + tmp); //$NON-NLS-1$
- tmp = PlatformURLHandler.FILE + PlatformURLHandler.PROTOCOL_SEPARATOR + tmp + PlatformURLHandler.JAR_SEPARATOR + jarEntry;
- cachedURL = new URL(PlatformURLHandler.JAR, null, -1, tmp);
- } else {
- if (DEBUG && DEBUG_CACHE_LOOKUP)
- debug("Located in cache as " + tmp); //$NON-NLS-1$
- cachedURL = new URL(PlatformURLHandler.FILE, null, -1, tmp);
- }
- isInCache = true;
- } else {
- // attemp to cache
- int ix = file.lastIndexOf("/"); //$NON-NLS-1$
- tmp = file.substring(ix + 1);
- tmp = cacheLocation + filePrefix + Long.toString((new java.util.Date()).getTime()) + "_" + tmp; //$NON-NLS-1$
- tmp = tmp.replace(File.separatorChar, '/');
- if (isJar) {
- tmp = PlatformURLHandler.FILE + PlatformURLHandler.PROTOCOL_SEPARATOR + tmp + PlatformURLHandler.JAR_SEPARATOR + jarEntry;
- cachedURL = new URL(PlatformURLHandler.JAR, null, -1, tmp);
- } else
- cachedURL = new URL(PlatformURLHandler.FILE, null, -1, tmp);
- copyToCache();
- }
-
- return cachedURL;
- }
-
- /*
- * to be implemented by subclass
- * @return URL resolved URL
- */
- protected URL resolve() throws IOException {
- // TODO throw UnsupportedOperationException instead - this is a bug in subclass, not an actual failure
- throw new IOException();
- }
-
- private String resolvePath(String spec) {
- if (spec.length() == 0 || spec.charAt(0) != '$')
- return spec;
- int i = spec.indexOf('/', 1);
- String first = ""; //$NON-NLS-1$
- String rest = ""; //$NON-NLS-1$
- if (i == -1)
- first = spec;
- else {
- first = spec.substring(0, i);
- rest = spec.substring(i);
- }
- if (first.equalsIgnoreCase("$ws$")) //$NON-NLS-1$
- return "ws/" + PlatformURLConnection.ws + rest; //$NON-NLS-1$
- if (first.equalsIgnoreCase("$os$")) //$NON-NLS-1$
- return "os/" + PlatformURLConnection.os + rest; //$NON-NLS-1$
- if (first.equalsIgnoreCase("$nl$")) { //$NON-NLS-1$
- String nl = PlatformURLConnection.nl;
- nl = nl.replace('_', '/');
- return "nl/" + nl + rest; //$NON-NLS-1$
- }
- return spec;
- }
-
- protected String getId(String spec) {
- int i = spec.lastIndexOf('_');
- return i >= 0 ? spec.substring(0, i) : spec;
- }
-
- protected String getVersion(String spec) {
- int i = spec.lastIndexOf('_');
- return i >= 0 ? spec.substring(i + 1, spec.length()) : ""; //$NON-NLS-1$
- }
-
- void setResolvedURL(URL url) throws IOException {
- if (url == null)
- throw new IOException();
- if (resolvedURL != null)
- return;
- int ix = url.getFile().lastIndexOf(PlatformURLHandler.JAR_SEPARATOR);
- isJar = -1 != ix;
- // Resolved URLs containing !/ separator are assumed to be jar URLs.
- // If the resolved protocol is not jar, new jar URL is created.
- if (isJar && !url.getProtocol().equals(PlatformURLHandler.JAR))
- url = new URL(PlatformURLHandler.JAR, "", -1, url.toExternalForm()); //$NON-NLS-1$
- resolvedURL = url;
- }
-
- private boolean shouldCache(boolean asLocal) {
-
- // don't cache files that are known to be local
- String rp = resolvedURL.getProtocol();
- String rf = resolvedURL.getFile();
- if (rp.equals(PlatformURLHandler.FILE))
- return false;
- if (rp.equals(PlatformURLHandler.JAR) && (rf.startsWith(PlatformURLHandler.FILE)))
- return false;
-
- // for other files force caching if local connection was requested
- if (asLocal)
- return true;
-
- // for now cache all files
- // XXX: add cache policy support
- return true;
- }
-
- static void shutdown() {
- if (indexName != null && cacheLocation != null) {
- // weed out "not found" entries
- Enumeration keys = cacheIndex.keys();
- String key;
- Object value;
- while (keys.hasMoreElements()) {
- key = (String) keys.nextElement();
- value = cacheIndex.get(key);
- if (value == NOT_FOUND)
- cacheIndex.remove(key);
- }
- //if the cache index is empty we don't need to save it
- if (cacheIndex.size() == 0)
- return;
- try {
- // try to save cache index
- FileOutputStream fos = null;
- fos = new FileOutputStream(cacheLocation + indexName);
- try {
- cacheIndex.store(fos, null);
- fos.flush();
- fos.getFD().sync();
- } finally {
- fos.close();
- }
- } catch (IOException e) {
- // failed to store cache index ... ignore
- }
- }
- }
-
- //TODO consider splitting this method into two or more steps - it is too long
- static void startup(String location, String os, String ws, String nl) {
-
- PlatformURLConnection.os = os;
- PlatformURLConnection.ws = ws;
- PlatformURLConnection.nl = nl;
-
- verifyLocation(location); // check for platform location, ignore errors
- String cacheProps = location.trim();
- if (!cacheProps.endsWith(File.separator))
- cacheProps += File.separator;
- cacheProps += CACHE_PROP;
- File cachePropFile = new File(cacheProps);
- Properties props = null;
- FileInputStream fis;
-
- if (cachePropFile.exists()) {
- // load existing properties
- try {
- props = new Properties();
- fis = new FileInputStream(cachePropFile);
- try {
- props.load(fis);
- } finally {
- fis.close();
- }
- } catch (IOException e) {
- props = null;
- }
- }
-
- if (props == null) {
- // first time up, or failed to load previous settings
- props = new Properties();
-
- String tmp = System.getProperty("user.home"); //$NON-NLS-1$
- if (!tmp.endsWith(File.separator))
- tmp += File.separator;
- tmp += CACHE_DIR;
- props.put(CACHE_LOCATION_PROP, tmp);
-
- tmp = Long.toString((new java.util.Date()).getTime());
- props.put(CACHE_PREFIX_PROP, tmp);
-
- tmp += CACHE_INDEX;
- props.put(CACHE_INDEX_PROP, tmp);
-
- // save for next time around
- FileOutputStream fos = null;
- try {
- fos = new FileOutputStream(cachePropFile);
- try {
- props.store(fos, null);
- fos.flush();
- fos.getFD().sync();
- } finally {
- fos.close();
- }
- } catch (IOException e) {
- // failed to store cache location metadata ... ignore
- }
- }
-
- // remember settings for shutdown processing
- filePrefix = (String) props.get(CACHE_PREFIX_PROP);
- indexName = (String) props.get(CACHE_INDEX_PROP);
- cacheLocation = (String) props.get(CACHE_LOCATION_PROP);
-
- if (DEBUG) {
- debugStartup("Cache location: " + cacheLocation); //$NON-NLS-1$
- debugStartup("Cache index: " + indexName); //$NON-NLS-1$
- debugStartup("Cache file prefix: " + filePrefix); //$NON-NLS-1$
- }
-
- // create cache directory structure if needed
- if (!verifyLocation(cacheLocation)) {
- indexName = null;
- cacheLocation = null;
- if (DEBUG)
- debugStartup("Failed to create cache directory structure. Caching suspended"); //$NON-NLS-1$
- return;
- }
-
- // attempt to initialize cache index
- if (cacheLocation != null && indexName != null) {
- try {
- fis = new FileInputStream(cacheLocation + indexName);
- try {
- cacheIndex.load(fis);
- } finally {
- fis.close();
- }
- } catch (IOException e) {
- if (DEBUG)
- debugStartup("Failed to initialize cache"); //$NON-NLS-1$
- }
- }
- }
-
- private static boolean verifyLocation(String location) {
- // verify cache directory exists. Create if needed
- File cacheDir = new File(location);
- if (cacheDir.exists())
- return true;
- return cacheDir.mkdirs();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/boot/PlatformURLHandler.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/boot/PlatformURLHandler.java
deleted file mode 100644
index 4c7a3ab..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/boot/PlatformURLHandler.java
+++ /dev/null
@@ -1,77 +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.boot;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.net.*;
-import java.util.Hashtable;
-import org.eclipse.core.internal.runtime.Messages;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.service.url.AbstractURLStreamHandlerService;
-
-/**
- * URL handler for the "platform" protocol
- */
-public class PlatformURLHandler extends AbstractURLStreamHandlerService {
-
- private static Hashtable connectionType = new Hashtable();
-
- // URL protocol designations
- public static final String PROTOCOL = "platform"; //$NON-NLS-1$
- public static final String FILE = "file"; //$NON-NLS-1$
- public static final String JAR = "jar"; //$NON-NLS-1$
- public static final String BUNDLE = "bundle"; //$NON-NLS-1$
- public static final String JAR_SEPARATOR = "!/"; //$NON-NLS-1$
- public static final String PROTOCOL_SEPARATOR = ":"; //$NON-NLS-1$
-
- public PlatformURLHandler() {
- super();
- }
-
- public URLConnection openConnection(URL url) throws IOException {
- // Note: openConnection() method is made public (rather than protected)
- // to enable request delegation from proxy handlers
- String spec = url.getFile().trim();
- if (spec.startsWith("/")) //$NON-NLS-1$
- spec = spec.substring(1);
- int ix = spec.indexOf("/"); //$NON-NLS-1$
- if (ix == -1)
- throw new MalformedURLException(NLS.bind(Messages.url_invalidURL, url.toExternalForm()));
-
- String type = spec.substring(0, ix);
- Constructor construct = (Constructor) connectionType.get(type);
- if (construct == null)
- throw new MalformedURLException(NLS.bind(Messages.url_badVariant, type));
-
- PlatformURLConnection connection = null;
- try {
- connection = (PlatformURLConnection) construct.newInstance(new Object[] {url});
- } catch (Exception e) {
- throw new IOException(NLS.bind(Messages.url_createConnection, e.getMessage()));
- }
- connection.setResolvedURL(connection.resolve());
- return connection;
- }
-
- public static void register(String type, Class connectionClass) {
- try {
- Constructor c = connectionClass.getConstructor(new Class[] {URL.class});
- connectionType.put(type, c);
- } catch (NoSuchMethodException e) {
- //don't register connection classes that don't conform to the spec
- }
- }
-
- public static void unregister(String type) {
- connectionType.remove(type);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/BasicDescription.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/BasicDescription.java
deleted file mode 100644
index cbcbc8d..0000000
--- a/bundles/org.eclipse.core.runtime/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.runtime/src/org/eclipse/core/internal/content/ContentDescription.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentDescription.java
deleted file mode 100644
index 14f6109..0000000
--- a/bundles/org.eclipse.core.runtime/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.runtime/src/org/eclipse/core/internal/content/ContentType.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentType.java
deleted file mode 100644
index 111e772..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentType.java
+++ /dev/null
@@ -1,632 +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.*;
-import java.util.*;
-import org.eclipse.core.internal.runtime.*;
-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, Platform.PI_RUNTIME, 0, message, reason instanceof CoreException ? null : reason);
- InternalPlatform.getDefault().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(Messages.content_errorSavingSettings, id);
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, 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(Messages.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(Messages.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(Messages.content_errorSavingSettings, id);
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, 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(Messages.content_errorSavingSettings, id);
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, 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)
- Policy.debug("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.runtime/src/org/eclipse/core/internal/content/ContentTypeBuilder.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeBuilder.java
deleted file mode 100644
index c26fb33..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeBuilder.java
+++ /dev/null
@@ -1,201 +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.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.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(Messages.content_errorLoadingSettings, bse);
- }
- }
-
- /**
- * @throws CoreException if mandatory attributes are missing in the markup
- */
- private ContentType createContentType(IConfigurationElement contentTypeCE) throws CoreException {
- String namespace = contentTypeCE.getNamespace();
- String simpleId = contentTypeCE.getAttributeAsIs("id"); //$NON-NLS-1$
- String name = contentTypeCE.getAttribute("name"); //$NON-NLS-1$
- String uniqueId = namespace + '.' + simpleId;
- if (simpleId == null)
- missingMandatoryAttribute(Messages.content_missingIdentifier, uniqueId);
- if (name == null)
- missingMandatoryAttribute(Messages.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(Messages.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);
- }
-
- protected IConfigurationElement[] getConfigurationElements() {
- IExtensionRegistry registry = InternalPlatform.getDefault().getRegistry();
- IExtensionPoint contentTypesXP = registry.getExtensionPoint(Platform.PI_RUNTIME, PT_CONTENTTYPES);
- IConfigurationElement[] allContentTypeCEs = contentTypesXP.getConfigurationElements();
- return allContentTypeCEs;
- }
-
- private void missingMandatoryAttribute(String messageKey, String argument) throws CoreException {
- String message = NLS.bind(messageKey, argument);
- throw new CoreException(new Status(IStatus.ERROR, Platform.PI_RUNTIME, 0, message, null));
- }
-
- private void registerContentType(IConfigurationElement contentTypeCE) {
- try {
- ContentType contentType = createContentType(contentTypeCE);
- catalog.addContentType(contentType);
- } catch (CoreException e) {
- // failed validation
- InternalPlatform.getDefault().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.getNamespace(), 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.runtime/src/org/eclipse/core/internal/content/ContentTypeCatalog.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeCatalog.java
deleted file mode 100644
index 7b8feb6..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeCatalog.java
+++ /dev/null
@@ -1,544 +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.*;
-import java.util.*;
-import org.eclipse.core.internal.runtime.Policy;
-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};
- Platform.run(new ISafeRunnable() {
- public void handleException(Throwable exception) {
- // already logged in Platform#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 subtypes - 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 subset[0];
- if (!forceValidation && total == 1)
- // do not do validation if not forced and only one was found (caller will validate later)
- return subset[0].length == 1 ? subset[0] : subset[1];
- 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 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())
- Policy.debug("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.runtime/src/org/eclipse/core/internal/content/ContentTypeHandler.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeHandler.java
deleted file mode 100644
index 74cdad3..0000000
--- a/bundles/org.eclipse.core.runtime/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.runtime/src/org/eclipse/core/internal/content/ContentTypeManager.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeManager.java
deleted file mode 100644
index fca6eb9..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeManager.java
+++ /dev/null
@@ -1,202 +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.InputStream;
-import java.io.Reader;
-import org.eclipse.core.internal.runtime.*;
-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 = Platform.PI_RUNTIME + IPath.SEPARATOR + "content-types"; //$NON-NLS-1$
- private static final String OPTION_DEBUG_CONTENT_TYPES = Platform.PI_RUNTIME + "/contenttypes/debug"; //$NON-NLS-1$;
- static final boolean DEBUGGING = Boolean.TRUE.toString().equalsIgnoreCase(InternalPlatform.getDefault().getOption(OPTION_DEBUG_CONTENT_TYPES));
- 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>.
- * <p>
- * Since calling this method will cause the content type manager to register a registry change listener,
- * this method must be called while the extension registry is available.
- * </p>
- */
- public static void startup() {
- instance = new ContentTypeManager();
- Platform.getExtensionRegistry().addRegistryChangeListener(instance, Platform.PI_RUNTIME);
- }
-
- /**
- * Shuts down the platform's content type manager. After this call returns,
- * the content type manager will be closed for business.
- * <p>
- * Since calling this method will cause the content type manager to unregister a registry change listener,
- * this method must be called while the extension registry is available.
- * </p>
- */
- public static void shutdown() {
- Platform.getExtensionRegistry().removeRegistryChangeListener(instance);
- instance = null;
- }
-
- /**
- * Obtains this platform's content type manager.
- * <p>
- * It has to have been created first by a call to <code>create()</code>,
- * otherwise an <code>AssertionFailedException</code> will be thrown.
- * </p>
- *
- * @return the content type manager
- */
- public static ContentTypeManager getInstance() {
- Assert.isNotNull(instance);
- 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(Platform.PI_RUNTIME, 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)
- Policy.debug("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 Platform#run()
- }
-
- public void run() throws Exception {
- listener.contentTypeChanged(event);
- }
- };
- Platform.run(job);
- }
- }
-
- public IContentDescription getSpecificDescription(BasicDescription description) {
- // this is the platform content type manager, no specificities
- return description;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeMatcher.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeMatcher.java
deleted file mode 100644
index b885933..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeMatcher.java
+++ /dev/null
@@ -1,148 +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.internal.runtime.Messages;
-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(Messages.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.runtime/src/org/eclipse/core/internal/content/ContentTypeSettings.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeSettings.java
deleted file mode 100644
index de6c7da..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeSettings.java
+++ /dev/null
@@ -1,160 +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.internal.runtime.Messages;
-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(Messages.content_errorSavingSettings, contentTypeId);
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, 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(Messages.content_errorSavingSettings, contentTypeId);
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, 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(Messages.content_errorSavingSettings, contentType.getId());
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, 0, message, bse);
- throw new CoreException(status);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeVisitor.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeVisitor.java
deleted file mode 100644
index 5b1ff55..0000000
--- a/bundles/org.eclipse.core.runtime/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.runtime/src/org/eclipse/core/internal/content/DefaultDescription.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/DefaultDescription.java
deleted file mode 100644
index 6112008..0000000
--- a/bundles/org.eclipse.core.runtime/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.runtime/src/org/eclipse/core/internal/content/FileSpec.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/FileSpec.java
deleted file mode 100644
index 04805bc..0000000
--- a/bundles/org.eclipse.core.runtime/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.runtime/src/org/eclipse/core/internal/content/IContentTypeInfo.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/IContentTypeInfo.java
deleted file mode 100644
index 9d6c7e3..0000000
--- a/bundles/org.eclipse.core.runtime/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.runtime/src/org/eclipse/core/internal/content/ILazySource.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ILazySource.java
deleted file mode 100644
index e25c0aa..0000000
--- a/bundles/org.eclipse.core.runtime/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.runtime/src/org/eclipse/core/internal/content/LazyInputStream.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/LazyInputStream.java
deleted file mode 100644
index 0f48b96..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/LazyInputStream.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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.runtime/src/org/eclipse/core/internal/content/LazyReader.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/LazyReader.java
deleted file mode 100644
index 241a76f..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/LazyReader.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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.runtime/src/org/eclipse/core/internal/content/LowLevelIOException.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/LowLevelIOException.java
deleted file mode 100644
index cb5386c..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/LowLevelIOException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.content;
-
-import java.io.IOException;
-import org.eclipse.core.internal.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.runtime/src/org/eclipse/core/internal/content/TextContentDescriber.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/TextContentDescriber.java
deleted file mode 100644
index bcdf683..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/TextContentDescriber.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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.XMLRootElementContentDescriber
- * @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() & 0xFF);//converts unsigned byte to int
- int second = (input.read() & 0xFF);
- if (first == -1 || second == -1)
- return null;
- //look for the UTF-16 Byte Order Mark (BOM)
- if (first == 0xFE && second == 0xFF)
- return IContentDescription.BOM_UTF_16BE;
- if (first == 0xFF && second == 0xFE)
- return IContentDescription.BOM_UTF_16LE;
- int third = (input.read() & 0xFF);
- if (third == -1)
- return null;
- //look for the UTF-8 BOM
- if (first == 0xEF && second == 0xBB && third == 0xBF)
- return IContentDescription.BOM_UTF_8;
- return null;
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/Util.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/Util.java
deleted file mode 100644
index 2e44b69..0000000
--- a/bundles/org.eclipse.core.runtime/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.runtime/src/org/eclipse/core/internal/content/XMLContentDescriber.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/XMLContentDescriber.java
deleted file mode 100644
index 3717afa..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/XMLContentDescriber.java
+++ /dev/null
@@ -1,121 +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.*;
-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.XMLRootElementContentDescriber
- * @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.runtime/src/org/eclipse/core/internal/content/XMLRootHandler.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/XMLRootHandler.java
deleted file mode 100644
index 466b1f6..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/XMLRootHandler.java
+++ /dev/null
@@ -1,239 +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.StringReader;
-import javax.xml.parsers.*;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.osgi.framework.ServiceReference;
-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;
- private SAXParserFactory factory;
- private boolean factoryFailed = false;
-
- 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;
- }
-
- private SAXParserFactory getFactory() {
- synchronized (this) {
- if (factoryFailed)
- return null;
- if (factory != null)
- return factory;
- ServiceReference parserReference = InternalPlatform.getDefault().getBundleContext().getServiceReference("javax.xml.parsers.SAXParserFactory"); //$NON-NLS-1$
- if (parserReference == null)
- return null;
- factory = (SAXParserFactory) InternalPlatform.getDefault().getBundleContext().getService(parserReference);
- if (factory == null)
- return null;
- factory.setNamespaceAware(true);
- }
- return factory;
- }
-
- public String getRootName() {
- return elementFound;
- }
-
- public boolean parseContents(InputSource contents) throws IOException, ParserConfigurationException, SAXException {
- // Parse the file into we have what we need (or an error occurs).
- try {
- factory = 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;
- 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.runtime/src/org/eclipse/core/internal/jobs/Deadlock.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/Deadlock.java
deleted file mode 100644
index 775a695..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/Deadlock.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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.runtime/src/org/eclipse/core/internal/jobs/DeadlockDetector.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/DeadlockDetector.java
deleted file mode 100644
index e21cbd3..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/DeadlockDetector.java
+++ /dev/null
@@ -1,696 +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.jobs;
-
-import java.util.ArrayList;
-import org.eclipse.core.internal.runtime.Assert;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-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(Platform.PI_RUNTIME, Platform.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, Platform.PI_RUNTIME, Platform.PLUGIN_ERROR, buf.toString(), null);
- main.add(child);
- }
- InternalPlatform.getDefault().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 void toDebugString() {
- System.out.println(" :: "); //$NON-NLS-1$
- for (int j = 0; j < locks.size(); j++) {
- System.out.print(" " + locks.get(j) + ','); //$NON-NLS-1$
- }
- System.out.println();
- for (int i = 0; i < graph.length; i++) {
- System.out.print(" " + ((Thread) lockThreads.get(i)).getName() + " : "); //$NON-NLS-1$ //$NON-NLS-2$
- for (int j = 0; j < graph[i].length; j++) {
- System.out.print(" " + graph[i][j] + ','); //$NON-NLS-1$
- }
- System.out.println();
- }
- System.out.println("-------"); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/ImplicitJobs.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/ImplicitJobs.java
deleted file mode 100644
index 53779f4..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/ImplicitJobs.java
+++ /dev/null
@@ -1,247 +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 java.util.*;
-import org.eclipse.core.internal.runtime.Assert;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-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 (rule != null && 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-aquire 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 && rule != null)
- 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)
- return;
- String msg = "Worker thread ended job: " + lastJob + ", but still holds rule: " + threadJob; //$NON-NLS-1$ //$NON-NLS-2$
- error = new Status(IStatus.ERROR, Platform.PI_RUNTIME, 1, msg, null);
- //end the thread job
- endThreadJob(threadJob, false);
- }
- try {
- InternalPlatform.getDefault().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);
- //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);
- }
-
- /**
- * 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.isLegal(job != null);
- 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.runtime/src/org/eclipse/core/internal/jobs/InternalJob.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/InternalJob.java
deleted file mode 100644
index 69f825c..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/InternalJob.java
+++ /dev/null
@@ -1,517 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import java.util.*;
-import org.eclipse.core.internal.runtime.*;
-import org.eclipse.core.internal.runtime.Assert;
-import org.eclipse.core.internal.runtime.ListenerList;
-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;
-
- private 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;
- /*
- * 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) {
- if (previous == null) {
- previous = entry;
- entry.next = this;
- entry.previous = null;
- } else {
- Assert.isTrue(previous.next() == this);
- previous.addLast(entry);
- }
- }
-
- /* (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);
- }
-
- /* (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;
- }
-
- /* (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);
- }
-
- /* (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);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/JobChangeEvent.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/JobChangeEvent.java
deleted file mode 100644
index f2889d2..0000000
--- a/bundles/org.eclipse.core.runtime/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.runtime/src/org/eclipse/core/internal/jobs/JobListeners.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/JobListeners.java
deleted file mode 100644
index 4efa2d7..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/JobListeners.java
+++ /dev/null
@@ -1,174 +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.internal.runtime.*;
-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 inlined here for performance reasons
- if (e instanceof OperationCanceledException)
- return;
- //we have to be safe, so don't try to log if the platform is not running
- //since it will fail - last resort is to print the stack trace on stderr
- final InternalPlatform platform = InternalPlatform.getDefault();
- if (platform != null && platform.isRunning()) {
- String pluginId = platform.getBundleId(listener);
- if (pluginId == null)
- pluginId = Platform.PI_RUNTIME;
- String message = NLS.bind(Messages.meta_pluginProblems, pluginId);
- platform.log(new Status(IStatus.ERROR, pluginId, Platform.PLUGIN_ERROR, message, e));
- } else
- e.printStackTrace();
- }
-
- 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.runtime/src/org/eclipse/core/internal/jobs/JobManager.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/JobManager.java
deleted file mode 100644
index 24aa7cd..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/JobManager.java
+++ /dev/null
@@ -1,1123 +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.jobs;
-
-import java.text.*;
-import java.util.*;
-import org.eclipse.core.internal.runtime.*;
-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 {
- private static final String OPTION_DEADLOCK_ERROR = Platform.PI_RUNTIME + "/jobs/errorondeadlock"; //$NON-NLS-1$
- private static final String OPTION_DEBUG_BEGIN_END = Platform.PI_RUNTIME + "/jobs/beginend"; //$NON-NLS-1$
- private static final String OPTION_DEBUG_JOBS = Platform.PI_RUNTIME + "/jobs"; //$NON-NLS-1$
- private static final String OPTION_DEBUG_JOBS_TIMING = Platform.PI_RUNTIME + "/jobs/timing"; //$NON-NLS-1$
- private static final String OPTION_LOCKS = Platform.PI_RUNTIME + "/jobs/locks"; //$NON-NLS-1$
-
- static final boolean DEBUG = Boolean.TRUE.toString().equalsIgnoreCase(InternalPlatform.getDefault().getOption(OPTION_DEBUG_JOBS));
- static final boolean DEBUG_BEGIN_END = Boolean.TRUE.toString().equalsIgnoreCase(InternalPlatform.getDefault().getOption(OPTION_DEBUG_BEGIN_END));
- static final boolean DEBUG_DEADLOCK = Boolean.TRUE.toString().equalsIgnoreCase(InternalPlatform.getDefault().getOption(OPTION_DEADLOCK_ERROR));
- private static DateFormat DEBUG_FORMAT;
- static final boolean DEBUG_LOCKS = Boolean.TRUE.toString().equalsIgnoreCase(InternalPlatform.getDefault().getOption(OPTION_LOCKS));
-
- static final boolean DEBUG_TIMING = Boolean.TRUE.toString().equalsIgnoreCase(InternalPlatform.getDefault().getOption(OPTION_DEBUG_JOBS_TIMING));
-
- /**
- * 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;
-
- 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.
- */
- public static synchronized JobManager getInstance() {
- if (instance == null)
- new JobManager();
- return instance;
- }
-
- /**
- * 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$
- }
-
- public static void shutdown() {
- if (instance != null) {
- instance.doShutdown();
- instance = null;
- }
- }
-
- private JobManager() {
- instance = this;
- synchronized (lock) {
- waiting = new JobQueue(false);
- sleeping = new JobQueue(true);
- running = new HashSet(10);
- pool = new WorkerPool(this);
- }
- }
-
- /* (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;
- }
- //fall through for ABOUT_TO_RUN case
- default :
- changeState(job, Job.NONE);
- }
- }
- //call monitor outside sync block
- if (monitor != null) {
- if (!monitor.isCanceled())
- monitor.setCanceled(true);
- 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) {
- 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);
- 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);
- case InternalJob.BLOCKED :
- break;
- case Job.WAITING :
- waiting.enqueue(job);
- break;
- case Job.SLEEPING :
- sleeping.enqueue(job);
- break;
- case Job.RUNNING :
- case InternalJob.ABOUT_TO_RUN :
- job.setStartTime(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$
- }
- }
- }
-
- /**
- * 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, don't run it right now if the system is busy
- if (job.getPriority() == Job.DECORATE) {
- 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()));
- 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();
- }
- }
- if (toCancel != null) {
- //cancel jobs outside sync block to avoid deadlock
- for (int i = 0; i < toCancel.length; i++) {
- final Job job = toCancel[i];
- cancel(job);
- String jobName;
- if (job instanceof ThreadJob) {
- Job realJob = ((ThreadJob) job).realJob;
- if (realJob != null)
- jobName = realJob.getClass().getName();
- else
- jobName = "ThreadJob on rule: " + job.getRule(); //$NON-NLS-1$
- } else {
- jobName = job.getClass().getName();
- }
- //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$
- InternalPlatform.getDefault().log(new Status(IStatus.WARNING, Platform.PI_RUNTIME, Platform.PLUGIN_ERROR, msg, null));
- }
- 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) {
- InternalJob blocked = null;
- int blockedJobCount = 0;
- 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);
- blocked = job.previous();
- job.setPrevious(null);
-
- //add any blocked jobs back to the wait queue
- while (blocked != null) {
- InternalJob previous = blocked.previous();
- changeState(blocked, Job.WAITING);
- blockedJobCount++;
- blocked = previous;
- }
- }
- //notify queue outside sync block
- for (int i = 0; i < blockedJobCount; i++)
- pool.jobQueued(blocked);
- //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;
- }
-
- /**
- * 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) {
- 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.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;
- //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)
- return;
- //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);
- }
- //spin until all jobs are completed
- try {
- monitor.beginTask(Messages.jobs_blocked0, jobCount);
- monitor.subTask(NLS.bind(Messages.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(Messages.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 {
- 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(Messages.meta_pluginProblems, Platform.PI_RUNTIME);
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, Platform.PLUGIN_ERROR, msg, e));
- }
- }
- }
- return Policy.monitorFor(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()));
- 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, Platform.PI_RUNTIME, 1, Messages.jobs_blocked0, null);
- } else {
- String msg = NLS.bind(Messages.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(null);
- }
- }
-
- /** (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(job);
- }
-
- /**
- * 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.getProgressMonitor() == null)
- 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(job);
-
- //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.runtime/src/org/eclipse/core/internal/jobs/JobQueue.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/JobQueue.java
deleted file mode 100644
index 92029f0..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/JobQueue.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import org.eclipse.core.internal.runtime.Assert;
-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 (tail != dummy && tail.compareTo(newEntry) < 0 && (allowConflictOvertaking || !newEntry.isConflicting(tail)))
- tail = tail.next();
- //new entry is smaller than tail
- newEntry.setNext(tail);
- newEntry.setPrevious(tail.previous());
- tail.previous().setNext(newEntry);
- tail.setPrevious(newEntry);
- }
-
- /**
- * 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.runtime/src/org/eclipse/core/internal/jobs/JobStatus.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/JobStatus.java
deleted file mode 100644
index 2680ae7..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/JobStatus.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import org.eclipse.core.runtime.Platform;
-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, Platform.PI_RUNTIME, 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.runtime/src/org/eclipse/core/internal/jobs/LockManager.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/LockManager.java
deleted file mode 100644
index 0a62256..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/LockManager.java
+++ /dev/null
@@ -1,286 +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 java.util.HashMap;
-import java.util.Stack;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-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(Platform.PI_RUNTIME, Platform.PLUGIN_ERROR, "LockManager.handleException", e); //$NON-NLS-1$
- ((MultiStatus) status).merge(((CoreException) e).getStatus());
- } else {
- status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, Platform.PLUGIN_ERROR, "LockManager.handleException", e); //$NON-NLS-1$
- }
- InternalPlatform.getDefault().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);
- 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.runtime/src/org/eclipse/core/internal/jobs/OrderedLock.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/OrderedLock.java
deleted file mode 100644
index 059225e..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/OrderedLock.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.jobs;
-
-import org.eclipse.core.internal.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.
- */
- 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
- operations.remove(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 {
- //operation timed out
- //remove request semaphore from queue and update graph
- operations.remove(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);
- }
-
- /**
- * 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.runtime/src/org/eclipse/core/internal/jobs/Queue.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/Queue.java
deleted file mode 100644
index 4262b44..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/Queue.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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.runtime/src/org/eclipse/core/internal/jobs/Semaphore.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/Semaphore.java
deleted file mode 100644
index ff43402..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/Semaphore.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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.runtime/src/org/eclipse/core/internal/jobs/ThreadJob.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/ThreadJob.java
deleted file mode 100644
index 47489fe..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/ThreadJob.java
+++ /dev/null
@@ -1,318 +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.internal.jobs;
-
-import org.eclipse.core.internal.runtime.*;
-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 {
- 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, Platform.PI_RUNTIME, 1, msg, t);
- InternalPlatform.getDefault().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, Platform.PI_RUNTIME, 1, msg, new IllegalArgumentException());
- InternalPlatform.getDefault().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, Platform.PI_RUNTIME, Platform.PLUGIN_ERROR, "ThreadJob.isCanceled", e); //$NON-NLS-1$
- InternalPlatform.getDefault().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;
- //lock listener decided to grant immediate access
- try {
- 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;
- }
- if (manager.getLockManager().aboutToWait(blocker))
- return this;
- //must lock instance before calling wait
- synchronized (this) {
- try {
- 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;
- notify();
- }
- 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-aquire 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.runtime/src/org/eclipse/core/internal/jobs/Worker.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/Worker.java
deleted file mode 100644
index 0a25a3b..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/Worker.java
+++ /dev/null
@@ -1,105 +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.jobs;
-
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.internal.runtime.Messages;
-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(Messages.jobs_internalError, job.getName());
- return new Status(IStatus.ERROR, Platform.PI_RUNTIME, Platform.PLUGIN_ERROR, message, t);
- }
-
- private void log(IStatus result) {
- try {
- //if job is running after shutdown, it has already been logged
- final InternalPlatform platform = InternalPlatform.getDefault();
- if (platform.isRunning()) {
- platform.log(result);
- return;
- }
- } catch (RuntimeException e) {
- //fall through below
- }
- //failed to log, so print to console instead
- Throwable t = result.getException();
- if (t != null)
- t.printStackTrace();
- }
-
- public void run() {
- setPriority(Thread.NORM_PRIORITY);
- try {
- while ((currentJob = pool.startJob(this)) != null) {
- //if job is null we've been shutdown
- if (currentJob == null)
- return;
- 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
- 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)
- log(result);
- currentJob = null;
- }
- }
- } catch (Throwable t) {
- t.printStackTrace();
- } finally {
- currentJob = null;
- pool.endWorker(this);
- }
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/WorkerPool.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/WorkerPool.java
deleted file mode 100644
index 18c92ae..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/jobs/WorkerPool.java
+++ /dev/null
@@ -1,235 +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.internal.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;
-
- 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(InternalJob job) {
- //if there is a sleeping thread, wake it up
- if (sleepingThreads > 0) {
- notify();
- return;
- }
- //create a thread if all threads are busy and we're under the max size
- //if the job is high priority, we start a thread no matter what
- if (busyThreads >= numThreads) {
- Worker worker = new Worker(this);
- 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;
- }
-
- 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(null);
- }
- } 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.runtime/src/org/eclipse/core/internal/preferences/AbstractScope.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/AbstractScope.java
deleted file mode 100644
index ca41962..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/AbstractScope.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.preferences;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-
-/**
- * Abstract super-class for scope context object contributed
- * by the Platform.
- *
- * @since 3.0
- */
-public abstract class AbstractScope implements IScopeContext {
-
- /*
- * @see org.eclipse.core.runtime.preferences.IScopeContext#getName()
- */
- public abstract String getName();
-
- /*
- * Default path hierarchy for nodes is /<scope>/<qualifier>.
- *
- * @see org.eclipse.core.runtime.preferences.IScopeContext#getNode(java.lang.String)
- */
- public IEclipsePreferences getNode(String qualifier) {
- if (qualifier == null)
- throw new IllegalArgumentException();
- return (IEclipsePreferences) Platform.getPreferencesService().getRootNode().node(getName()).node(qualifier);
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IScopeContext#getLocation()
- */
- public abstract IPath getLocation();
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof IScopeContext))
- return false;
- IScopeContext other = (IScopeContext) obj;
- if (!getName().equals(other.getName()))
- return false;
- IPath location = getLocation();
- return location == null ? other.getLocation() == null : location.equals(other.getLocation());
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return getName().hashCode();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/Base64.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/Base64.java
deleted file mode 100644
index de85184..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/Base64.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.preferences;
-
-public class Base64 {
-
- private static final byte equalSign = (byte) '=';
-
- static char digits[] = {'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', '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', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
-
- /**
- * This method decodes the byte array in base 64 encoding into a char array
- * Base 64 encoding has to be according to the specification given by the
- * RFC 1521 (5.2).
- *
- * @param data the encoded byte array
- * @return the decoded byte array
- */
- public static byte[] decode(byte[] data) {
- if (data.length == 0)
- return data;
- int lastRealDataIndex = data.length - 1;
- while (data[lastRealDataIndex] == equalSign)
- lastRealDataIndex--;
- // original data digit is 8 bits long, but base64 digit is 6 bits long
- int padBytes = data.length - 1 - lastRealDataIndex;
- int byteLength = data.length * 6 / 8 - padBytes;
- byte[] result = new byte[byteLength];
- // Each 4 bytes of input (encoded) we end up with 3 bytes of output
- int dataIndex = 0;
- int resultIndex = 0;
- int allBits = 0;
- // how many result chunks we can process before getting to pad bytes
- int resultChunks = (lastRealDataIndex + 1) / 4;
- for (int i = 0; i < resultChunks; i++) {
- allBits = 0;
- // Loop 4 times gathering input bits (4 * 6 = 24)
- for (int j = 0; j < 4; j++)
- allBits = (allBits << 6) | decodeDigit(data[dataIndex++]);
- // Loop 3 times generating output bits (3 * 8 = 24)
- for (int j = resultIndex + 2; j >= resultIndex; j--) {
- result[j] = (byte) (allBits & 0xff); // Bottom 8 bits
- allBits = allBits >>> 8;
- }
- resultIndex += 3; // processed 3 result bytes
- }
- // Now we do the extra bytes in case the original (non-encoded) data
- // was not multiple of 3 bytes
- switch (padBytes) {
- case 1 :
- // 1 pad byte means 3 (4-1) extra Base64 bytes of input, 18
- // bits, of which only 16 are meaningful
- // Or: 2 bytes of result data
- allBits = 0;
- // Loop 3 times gathering input bits
- for (int j = 0; j < 3; j++)
- allBits = (allBits << 6) | decodeDigit(data[dataIndex++]);
- // NOTE - The code below ends up being equivalent to allBits =
- // allBits>>>2
- // But we code it in a non-optimized way for clarity
- // The 4th, missing 6 bits are all 0
- allBits = allBits << 6;
- // The 3rd, missing 8 bits are all 0
- allBits = allBits >>> 8;
- // Loop 2 times generating output bits
- for (int j = resultIndex + 1; j >= resultIndex; j--) {
- result[j] = (byte) (allBits & 0xff); // Bottom 8
- // bits
- allBits = allBits >>> 8;
- }
- break;
- case 2 :
- // 2 pad bytes mean 2 (4-2) extra Base64 bytes of input, 12 bits
- // of data, of which only 8 are meaningful
- // Or: 1 byte of result data
- allBits = 0;
- // Loop 2 times gathering input bits
- for (int j = 0; j < 2; j++)
- allBits = (allBits << 6) | decodeDigit(data[dataIndex++]);
- // NOTE - The code below ends up being equivalent to allBits =
- // allBits>>>4
- // But we code it in a non-optimized way for clarity
- // The 3rd and 4th, missing 6 bits are all 0
- allBits = allBits << 6;
- allBits = allBits << 6;
- // The 3rd and 4th, missing 8 bits are all 0
- allBits = allBits >>> 8;
- allBits = allBits >>> 8;
- result[resultIndex] = (byte) (allBits & 0xff); // Bottom
- // 8
- // bits
- break;
- }
- return result;
- }
-
- /**
- * This method converts a Base 64 digit to its numeric value.
- *
- * @param data digit (character) to convert
- * @return value for the digit
- */
- static int decodeDigit(byte data) {
- char charData = (char) data;
- if (charData <= 'Z' && charData >= 'A')
- return charData - 'A';
- if (charData <= 'z' && charData >= 'a')
- return charData - 'a' + 26;
- if (charData <= '9' && charData >= '0')
- return charData - '0' + 52;
- switch (charData) {
- case '+' :
- return 62;
- case '/' :
- return 63;
- default :
- throw new IllegalArgumentException("Invalid char to decode: " + data); //$NON-NLS-1$
- }
- }
-
- /**
- * This method encodes the byte array into a char array in base 64 according
- * to the specification given by the RFC 1521 (5.2).
- *
- * @param data the encoded char array
- * @return the byte array that needs to be encoded
- */
- public static byte[] encode(byte[] data) {
- int sourceChunks = data.length / 3;
- int len = ((data.length + 2) / 3) * 4;
- byte[] result = new byte[len];
- int extraBytes = data.length - (sourceChunks * 3);
- // Each 4 bytes of input (encoded) we end up with 3 bytes of output
- int dataIndex = 0;
- int resultIndex = 0;
- int allBits = 0;
- for (int i = 0; i < sourceChunks; i++) {
- allBits = 0;
- // Loop 3 times gathering input bits (3 * 8 = 24)
- for (int j = 0; j < 3; j++)
- allBits = (allBits << 8) | (data[dataIndex++] & 0xff);
- // Loop 4 times generating output bits (4 * 6 = 24)
- for (int j = resultIndex + 3; j >= resultIndex; j--) {
- result[j] = (byte) digits[(allBits & 0x3f)]; // Bottom
- // 6
- // bits
- allBits = allBits >>> 6;
- }
- resultIndex += 4; // processed 4 result bytes
- }
- // Now we do the extra bytes in case the original (non-encoded) data
- // is not multiple of 4 bytes
- switch (extraBytes) {
- case 1 :
- allBits = data[dataIndex++]; // actual byte
- allBits = allBits << 8; // 8 bits of zeroes
- allBits = allBits << 8; // 8 bits of zeroes
- // Loop 4 times generating output bits (4 * 6 = 24)
- for (int j = resultIndex + 3; j >= resultIndex; j--) {
- result[j] = (byte) digits[(allBits & 0x3f)]; // Bottom
- // 6
- // bits
- allBits = allBits >>> 6;
- }
- // 2 pad tags
- result[result.length - 1] = (byte) '=';
- result[result.length - 2] = (byte) '=';
- break;
- case 2 :
- allBits = data[dataIndex++]; // actual byte
- allBits = (allBits << 8) | (data[dataIndex++] & 0xff); // actual
- // byte
- allBits = allBits << 8; // 8 bits of zeroes
- // Loop 4 times generating output bits (4 * 6 = 24)
- for (int j = resultIndex + 3; j >= resultIndex; j--) {
- result[j] = (byte) digits[(allBits & 0x3f)]; // Bottom
- // 6
- // bits
- allBits = allBits >>> 6;
- }
- // 1 pad tag
- result[result.length - 1] = (byte) '=';
- break;
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/ConfigurationPreferences.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/ConfigurationPreferences.java
deleted file mode 100644
index 02495c7..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/ConfigurationPreferences.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.preferences;
-
-import java.net.URL;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-
-/**
- * @since 3.0
- */
-public class ConfigurationPreferences extends EclipsePreferences {
-
- // cached values
- private int segmentCount;
- private String qualifier;
- private IPath location;
- private IEclipsePreferences loadLevel;
- // cache which nodes have been loaded from disk
- private static Set loadedNodes = new HashSet();
- private static boolean initialized = false;
- private static IPath baseLocation;
-
- static {
- URL url = InternalPlatform.getDefault().getConfigurationLocation().getURL();
- if (url != null)
- baseLocation = new Path(url.getFile());
- }
-
- /**
- * Default constructor. Should only be called by #createExecutableExtension.
- */
- public ConfigurationPreferences() {
- this(null, null);
- }
-
- private ConfigurationPreferences(EclipsePreferences parent, String name) {
- super(parent, name);
-
- initializeChildren();
-
- // cache the segment count
- String path = absolutePath();
- segmentCount = getSegmentCount(path);
- if (segmentCount < 2)
- return;
-
- // cache the qualifier
- qualifier = getSegment(path, 1);
-
- // cache the location
- if (qualifier == null)
- return;
- if (baseLocation != null)
- location = computeLocation(baseLocation, qualifier);
- }
-
- protected IPath getLocation() {
- return location;
- }
-
- protected boolean isAlreadyLoaded(IEclipsePreferences node) {
- return loadedNodes.contains(node.name());
- }
-
- protected void loaded() {
- loadedNodes.add(name());
- }
-
- /*
- * Return the node at which these preferences are loaded/saved.
- */
- 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 = (EclipsePreferences) node.parent();
- loadLevel = node;
- }
- return loadLevel;
- }
-
- protected void initializeChildren() {
- if (initialized || parent == null)
- return;
- try {
- synchronized (this) {
- if (baseLocation == null)
- return;
- String[] names = computeChildren(baseLocation);
- for (int i = 0; i < names.length; i++)
- addChild(names[i], null);
- }
- } finally {
- initialized = true;
- }
- }
-
- protected EclipsePreferences internalCreate(EclipsePreferences nodeParent, String nodeName, Plugin context) {
- return new ConfigurationPreferences(nodeParent, nodeName);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/DefaultPreferences.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/DefaultPreferences.java
deleted file mode 100644
index ea029bf..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/DefaultPreferences.java
+++ /dev/null
@@ -1,396 +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.preferences;
-
-import java.io.*;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.*;
-import org.eclipse.core.internal.runtime.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.Bundle;
-
-/**
- * @since 3.0
- */
-public class DefaultPreferences extends EclipsePreferences {
- // cache which nodes have been loaded from disk
- private static Set loadedNodes = new HashSet();
- private static final String ELEMENT_INITIALIZER = "initializer"; //$NON-NLS-1$
- private static final String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$
- private static final String KEY_PREFIX = "%"; //$NON-NLS-1$
- private static final String KEY_DOUBLE_PREFIX = "%%"; //$NON-NLS-1$
- 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 static Properties productCustomization;
- private static Properties productTranslation;
- private static Properties commandLineCustomization;
- private EclipsePreferences loadLevel;
-
- // cached values
- private String qualifier;
- private int segmentCount;
- private Plugin plugin;
-
- /**
- * Default constructor for this class.
- */
- public DefaultPreferences() {
- this(null, null);
- }
-
- private DefaultPreferences(EclipsePreferences parent, String name, Plugin context) {
- this(parent, name);
- this.plugin = context;
- }
-
- private DefaultPreferences(EclipsePreferences parent, String name) {
- super(parent, name);
-
- if (parent instanceof DefaultPreferences)
- this.plugin = ((DefaultPreferences) parent).plugin;
-
- // cache the segment count
- String path = absolutePath();
- segmentCount = getSegmentCount(path);
- if (segmentCount < 2)
- return;
-
- // cache the qualifier
- qualifier = getSegment(path, 1);
- }
-
- /*
- * Apply the values set in the bundle's install directory.
- *
- * In Eclipse 2.1 this is equivalent to:
- * /eclipse/plugins/<pluginID>/prefs.ini
- */
- private void applyBundleDefaults() {
- Bundle bundle = Platform.getBundle(name());
- if (bundle == null)
- return;
- URL url = Platform.find(bundle, new Path(Plugin.PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME));
- if (url == null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Preference default override file not found for bundle: " + bundle.getSymbolicName()); //$NON-NLS-1$
- return;
- }
- URL transURL = Platform.find(bundle, NL_DIR.append(Plugin.PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME).addFileExtension(PROPERTIES_FILE_EXTENSION));
- if (transURL == null && InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Preference translation file not found for bundle: " + bundle.getSymbolicName()); //$NON-NLS-1$
- applyDefaults(name(), loadProperties(url), loadProperties(transURL));
- }
-
- /*
- * Apply the default values as specified in the file
- * as an argument on the command-line.
- */
- private void applyCommandLineDefaults() {
- // prime the cache the first time
- if (commandLineCustomization == null) {
- String filename = InternalPlatform.pluginCustomizationFile;
- if (filename == null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Command-line preferences customization file not specified."); //$NON-NLS-1$
- return;
- }
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Using command-line preference customization file: " + filename); //$NON-NLS-1$
- commandLineCustomization = loadProperties(filename);
- }
- applyDefaults(null, commandLineCustomization, null);
- }
-
- /*
- * If the qualifier is null then the file is of the format:
- * pluginID/key=value
- * otherwise the file is of the format:
- * key=value
- */
- private void applyDefaults(String id, Properties defaultValues, Properties translations) {
- for (Enumeration e = defaultValues.keys(); e.hasMoreElements();) {
- String fullKey = (String) e.nextElement();
- String value = defaultValues.getProperty(fullKey);
- if (value == null)
- continue;
- IPath childPath = new Path(fullKey);
- String key = childPath.lastSegment();
- childPath = childPath.removeLastSegments(1);
- String localQualifier = id;
- if (id == null) {
- localQualifier = childPath.segment(0);
- childPath = childPath.removeFirstSegments(1);
- }
- if (name().equals(localQualifier)) {
- value = translatePreference(value, translations);
- if (InternalPlatform.DEBUG_PREFERENCE_SET)
- Policy.debug("Setting default preference: " + (new Path(absolutePath()).append(childPath).append(key)) + '=' + value); //$NON-NLS-1$
- ((EclipsePreferences) internalNode(childPath.toString(), false, null)).internalPut(key, value);
- }
- }
- }
-
- private void runInitializer(IConfigurationElement element) {
- AbstractPreferenceInitializer initializer = null;
- try {
- initializer = (AbstractPreferenceInitializer) element.createExecutableExtension(ATTRIBUTE_CLASS);
- initializer.initializeDefaultPreferences();
- } catch (ClassCastException e) {
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, Messages.preferences_invalidExtensionSuperclass, e);
- log(status);
- } catch (CoreException e) {
- log(e.getStatus());
- }
- }
-
- public IEclipsePreferences node(String childName, Plugin context) {
- return internalNode(childName, true, context);
- }
-
- /*
- * Runtime defaults are the ones which are specified in code at runtime.
- *
- * In the Eclipse 2.1 world they were the ones which were specified in the
- * over-ridden Plugin#initializeDefaultPluginPreferences() method.
- *
- * In Eclipse 3.0 they are set in the code which is indicated by the
- * extension to the plug-in default customizer extension point.
- */
- private void applyRuntimeDefaults() {
- // access the extension point
- IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Platform.PI_RUNTIME, Platform.PT_PREFERENCES);
- if (point == null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("No extensions for " + Platform.PI_RUNTIME + '.' + Platform.PT_PREFERENCES + " extension point. Skipping runtime default preference customization."); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- IExtension[] extensions = point.getExtensions();
- boolean foundInitializer = false;
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] elements = extensions[i].getConfigurationElements();
- for (int j = 0; j < elements.length; j++)
- if (ELEMENT_INITIALIZER.equals(elements[j].getName())) {
- if (name().equals(elements[j].getNamespace())) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Running default preference customization as defined by: " + elements[j].getDeclaringExtension().getDeclaringPluginDescriptor()); //$NON-NLS-1$
- runInitializer(elements[j]);
- // don't return yet in case we have multiple initializers registered
- foundInitializer = true;
- }
- }
- }
- if (foundInitializer)
- return;
-
- // 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(CompatibilityHelper.PI_RUNTIME_COMPATIBILITY) != null)
- plugin = Platform.getPlugin(name());
- if (plugin == null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("No plug-in object available to set plug-in default preference overrides for:" + name()); //$NON-NLS-1$
- return;
- }
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Applying plug-in default preference overrides for plug-in: " + plugin.getDescriptor().getUniqueIdentifier()); //$NON-NLS-1$
- plugin.internalInitializeDefaultPluginPreferences();
- }
-
- /*
- * Apply the default values as specified by the file
- * in the product extension.
- *
- * In Eclipse 2.1 this is equivalent to the plugin_customization.ini
- * file in the primary feature's plug-in directory.
- */
- private void applyProductDefaults() {
- // prime the cache the first time
- if (productCustomization == null) {
- IProduct product = Platform.getProduct();
- if (product == null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Product not available to set product default preference overrides."); //$NON-NLS-1$
- return;
- }
- String id = product.getId();
- if (id == null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Product ID not available to apply product-level preference defaults."); //$NON-NLS-1$
- return;
- }
- Bundle bundle = product.getDefiningBundle();
- if (bundle == null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Bundle not available to apply product-level preference defaults for product id: " + id); //$NON-NLS-1$
- return;
- }
- String value = product.getProperty(PRODUCT_KEY);
- URL url = null;
- URL transURL = null;
- if (value == null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Product : " + id + " does not define preference customization file. Using legacy file: plugin_customization.ini"); //$NON-NLS-1$//$NON-NLS-2$
- value = LEGACY_PRODUCT_CUSTOMIZATION_FILENAME;
- url = Platform.find(bundle, new Path(LEGACY_PRODUCT_CUSTOMIZATION_FILENAME));
- transURL = Platform.find(bundle, NL_DIR.append(value).removeFileExtension().addFileExtension(PROPERTIES_FILE_EXTENSION));
- } else {
- // try to convert the key to a URL
- try {
- url = new URL(value);
- } catch (MalformedURLException e) {
- // didn't work so treat it as a filename
- url = Platform.find(bundle, new Path(value));
- if (url != null)
- transURL = Platform.find(bundle, NL_DIR.append(value).removeFileExtension().addFileExtension(PROPERTIES_FILE_EXTENSION));
- }
- }
- if (url == null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Product preference customization file: " + value + " not found for bundle: " + id); //$NON-NLS-1$//$NON-NLS-2$
- return;
- }
- if (transURL == null && InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("No preference translations found for product/file: " + bundle.getSymbolicName() + '/' + value); //$NON-NLS-1$
-
- productCustomization = loadProperties(url);
- productTranslation = loadProperties(transURL);
- }
- applyDefaults(null, productCustomization, productTranslation);
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.prefs.Preferences#flush()
- */
- public void flush() {
- // default values are not persisted
- }
-
- 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.
- EclipsePreferences node = this;
- for (int i = 2; i < segmentCount; i++)
- node = (EclipsePreferences) node.parent();
- loadLevel = node;
- }
- return loadLevel;
- }
-
- protected EclipsePreferences internalCreate(EclipsePreferences nodeParent, String nodeName, Plugin context) {
- return new DefaultPreferences(nodeParent, nodeName, context);
- }
-
- protected boolean isAlreadyLoaded(IEclipsePreferences node) {
- return loadedNodes.contains(node.name());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.internal.preferences.EclipsePreferences#load()
- */
- protected void load() {
- loadDefaults();
- }
-
- private void loadDefaults() {
- applyRuntimeDefaults();
- applyBundleDefaults();
- applyProductDefaults();
- applyCommandLineDefaults();
- }
-
- 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_PREFERENCE_GENERAL) {
- Policy.debug("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;
- }
-
- private Properties loadProperties(String filename) {
- Properties result = new Properties();
- InputStream input = null;
- try {
- input = new BufferedInputStream(new FileInputStream(filename));
- result.load(input);
- } catch (FileNotFoundException e) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Preference customization file not found: " + filename); //$NON-NLS-1$
- } catch (IOException e) {
- String message = NLS.bind(Messages.preferences_loadException, filename);
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, message, e);
- InternalPlatform.getDefault().log(status);
- } finally {
- if (input != null)
- try {
- input.close();
- } catch (IOException e) {
- // ignore
- }
- }
- return result;
- }
-
- protected void loaded() {
- loadedNodes.add(name());
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.prefs.Preferences#sync()
- */
- public void sync() {
- // default values are not persisted
- }
-
- /**
- * Takes a preference value and a related resource bundle and
- * returns the translated version of this value (if one exists).
- */
- private String translatePreference(String value, Properties props) {
- value = value.trim();
- if (props == null || value.startsWith(KEY_DOUBLE_PREFIX))
- return value;
- if (value.startsWith(KEY_PREFIX)) {
- int ix = value.indexOf(" "); //$NON-NLS-1$
- String key = ix == -1 ? value.substring(1) : value.substring(1, ix);
- String dflt = ix == -1 ? value : value.substring(ix + 1);
- return props.getProperty(key, dflt);
- }
- return value;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/EclipsePreferences.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
deleted file mode 100644
index 0f391d8..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
+++ /dev/null
@@ -1,1160 +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
- * Julian Chen - fix for bug #92572, jclRM
- *******************************************************************************/
-package org.eclipse.core.internal.preferences;
-
-import java.io.*;
-import java.util.*;
-import org.eclipse.core.internal.runtime.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.preferences.*;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * Represents a node in the Eclipse preference node hierarchy. This class
- * is used as a default implementation/super class for those nodes which
- * belong to scopes which are contributed by the Platform.
- *
- * Implementation notes:
- *
- * - For thread safety, we always synchronize on the node object when writing
- * the children or properties fields. Must ensure we don't synchronize when calling
- * client code such as listeners.
- *
- * @since 3.0
- */
-public class EclipsePreferences implements IEclipsePreferences, IScope {
-
- public static final String DEFAULT_PREFERENCES_DIRNAME = ".settings"; //$NON-NLS-1$
- public static final String PREFS_FILE_EXTENSION = "prefs"; //$NON-NLS-1$
- protected static final IEclipsePreferences[] EMPTY_NODE_ARRAY = new IEclipsePreferences[0];
- protected static final String[] EMPTY_STRING_ARRAY = new String[0];
- private static final String FALSE = "false"; //$NON-NLS-1$
- private static final String TRUE = "true"; //$NON-NLS-1$
- protected static final String VERSION_KEY = "eclipse.preferences.version"; //$NON-NLS-1$
- protected static final String VERSION_VALUE = "1"; //$NON-NLS-1$
- protected static final String PATH_SEPARATOR = String.valueOf(IPath.SEPARATOR);
- protected static final String DOUBLE_SLASH = "//"; //$NON-NLS-1$
- protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
-
- private String cachedPath;
- protected Map children;
- protected boolean dirty = false;
- protected boolean loading = false;
- protected final String name;
- // the parent of an EclipsePreference node is always an EclipsePreference node. (or null)
- protected final EclipsePreferences parent;
- protected HashMapOfString properties;
- protected boolean removed = false;
- private ListenerList nodeChangeListeners;
- private ListenerList preferenceChangeListeners;
-
- public EclipsePreferences() {
- this(null, null);
- }
-
- protected EclipsePreferences(EclipsePreferences parent, String name) {
- super();
- this.parent = parent;
- this.name = name;
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#absolutePath()
- */
- public String absolutePath() {
- if (cachedPath == null) {
- if (parent == null)
- cachedPath = PATH_SEPARATOR;
- else {
- String parentPath = parent.absolutePath();
- // if the parent is the root then we don't have to add a separator
- // between the parent path and our path
- if (parentPath.length() == 1)
- cachedPath = parentPath + name();
- else
- cachedPath = parentPath + PATH_SEPARATOR + name();
- }
- }
- return cachedPath;
- }
-
- public void accept(IPreferenceNodeVisitor visitor) throws BackingStoreException {
- if (!visitor.visit(this))
- return;
- IEclipsePreferences[] toVisit = getChildren(true);
- for (int i = 0; i < toVisit.length; i++)
- toVisit[i].accept(visitor);
- }
-
- protected synchronized IEclipsePreferences addChild(String childName, IEclipsePreferences child) {
- //Thread safety: synchronize method to protect modification of children field
- if (children == null)
- children = Collections.synchronizedMap(new HashMap());
- children.put(childName, child == null ? (Object) childName : child);
- return child;
- }
-
- /*
- * @see org.eclipse.core.runtime.IEclipsePreferences#addNodeChangeListener(org.eclipse.core.runtime.IEclipsePreferences.INodeChangeListener)
- */
- public void addNodeChangeListener(INodeChangeListener listener) {
- checkRemoved();
- if (nodeChangeListeners == null)
- nodeChangeListeners = new ListenerList();
- nodeChangeListeners.add(listener);
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Added preference node change listener: " + listener + " to: " + absolutePath()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * @see org.eclipse.core.runtime.IEclipsePreferences#addPreferenceChangeListener(org.eclipse.core.runtime.IEclipsePreferences.IPreferenceChangeListener)
- */
- public void addPreferenceChangeListener(IPreferenceChangeListener listener) {
- checkRemoved();
- if (preferenceChangeListeners == null)
- preferenceChangeListeners = new ListenerList();
- preferenceChangeListeners.add(listener);
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Added preference property change listener: " + listener + " to: " + absolutePath()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- private IEclipsePreferences calculateRoot() {
- IEclipsePreferences result = this;
- while (result.parent() != null)
- result = (IEclipsePreferences) result.parent();
- return result;
- }
-
- /*
- * Convenience method for throwing an exception when methods
- * are called on a removed node.
- */
- protected void checkRemoved() {
- if (removed) {
- throw new IllegalStateException(NLS.bind(Messages.preferences_removedNode, name));
- }
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#childrenNames()
- */
- public String[] childrenNames() {
- // illegal state if this node has been removed
- checkRemoved();
- return internalChildNames();
- }
-
- protected String[] internalChildNames() {
- Map temp = children;
- if (temp == null || temp.size() == 0)
- return EMPTY_STRING_ARRAY;
- return (String[]) temp.keySet().toArray(EMPTY_STRING_ARRAY);
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#clear()
- */
- public void clear() {
- // illegal state if this node has been removed
- checkRemoved();
- // call each one separately (instead of Properties.clear) so
- // clients get change notification
- String[] keys;
- synchronized (this) {
- if (properties == null)
- return;
- keys = properties.keys();
- }
- for (int i = 0; i < keys.length; i++)
- remove(keys[i]);
- makeDirty();
- }
-
- protected String[] computeChildren(IPath root) {
- if (root == null)
- return EMPTY_STRING_ARRAY;
- IPath dir = root.append(DEFAULT_PREFERENCES_DIRNAME);
- final ArrayList result = new ArrayList();
- final String extension = '.' + PREFS_FILE_EXTENSION;
- File file = dir.toFile();
- File[] totalFiles = file.listFiles();
- if (totalFiles != null) {
- for (int i = 0; i < totalFiles.length; i++) {
- if (totalFiles[i].isFile()) {
- String filename = totalFiles[i].getName();
- if (filename.endsWith(extension)) {
- String shortName = filename.substring(0, filename.length() - extension.length());
- result.add(shortName);
- }
- }
- }
- }
- return (String[]) result.toArray(EMPTY_STRING_ARRAY);
- }
-
- protected IPath computeLocation(IPath root, String qualifier) {
- return root == null ? null : root.append(DEFAULT_PREFERENCES_DIRNAME).append(qualifier).addFileExtension(PREFS_FILE_EXTENSION);
- }
-
- /*
- * Version 1 (current version)
- * path/key=value
- */
- protected static void convertFromProperties(EclipsePreferences node, Properties table, boolean notify) {
- String version = table.getProperty(VERSION_KEY);
- if (version == null || !VERSION_VALUE.equals(version)) {
- // ignore for now
- }
- table.remove(VERSION_KEY);
- for (Iterator i = table.keySet().iterator(); i.hasNext();) {
- String fullKey = (String) i.next();
- String value = table.getProperty(fullKey);
- if (value != null) {
- String[] splitPath = decodePath(fullKey);
- String path = splitPath[0];
- path = makeRelative(path);
- String key = splitPath[1];
- if (InternalPlatform.DEBUG_PREFERENCE_SET)
- Policy.debug("Setting preference: " + path + '/' + key + '=' + value); //$NON-NLS-1$
- //use internal methods to avoid notifying listeners
- EclipsePreferences childNode = (EclipsePreferences) node.internalNode(path, false, null);
- String oldValue = childNode.internalPut(key, value);
- // notify listeners if applicable
- if (notify && !value.equals(oldValue))
- node.firePreferenceEvent(key, oldValue, value);
- }
- }
- PreferencesService.getDefault().shareStrings();
- }
-
- /*
- * Helper method to convert this node to a Properties file suitable
- * for persistence.
- */
- protected Properties convertToProperties(Properties result, String prefix) throws BackingStoreException {
- // add the key/value pairs from this node
- boolean addSeparator = prefix.length() != 0;
- synchronized (this) {
- if (properties != null) {
- String[] keys = properties.keys();
- for (int i = 0; i < keys.length; i++) {
- String value = properties.get(keys[i]);
- if (value != null)
- result.put(encodePath(prefix, keys[i]), value);
- }
- }
- }
- // recursively add the child information
- IEclipsePreferences[] childNodes = getChildren(true);
- for (int i = 0; i < childNodes.length; i++) {
- EclipsePreferences child = (EclipsePreferences) childNodes[i];
- String fullPath = addSeparator ? prefix + PATH_SEPARATOR + child.name() : child.name();
- child.convertToProperties(result, fullPath);
- }
- PreferencesService.getDefault().shareStrings();
- return result;
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IScope#create(org.eclipse.core.runtime.preferences.IEclipsePreferences)
- */
- public IEclipsePreferences create(IEclipsePreferences nodeParent, String nodeName) {
- return create((EclipsePreferences) nodeParent, nodeName, null);
- }
-
- protected boolean isLoading() {
- return loading;
- }
-
- protected void setLoading(boolean isLoading) {
- loading = isLoading;
- }
-
- public IEclipsePreferences create(EclipsePreferences nodeParent, String nodeName, Plugin context) {
- EclipsePreferences result = internalCreate(nodeParent, nodeName, context);
- nodeParent.addChild(nodeName, result);
- IEclipsePreferences loadLevel = result.getLoadLevel();
-
- // if this node or a parent node is not the load level then return
- if (loadLevel == null)
- return result;
-
- // if the result node is not a load level, then a child must be
- if (result != loadLevel)
- return result;
-
- // the result node is a load level
- if (isAlreadyLoaded(result) || result.isLoading())
- return result;
- try {
- result.setLoading(true);
- result.loadLegacy();
- result.load();
- result.loaded();
- result.flush();
- } catch (BackingStoreException e) {
- IPath location = result.getLocation();
- String message = NLS.bind(Messages.preferences_loadException, location == null ? EMPTY_STRING : location.toString());
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, message, e);
- InternalPlatform.getDefault().log(status);
- } finally {
- result.setLoading(false);
- }
- return result;
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#flush()
- */
- public void flush() throws BackingStoreException {
- // illegal state if this node has been removed
- checkRemoved();
-
- IEclipsePreferences loadLevel = getLoadLevel();
-
- // if this node or a parent is not the load level, then flush the children
- if (loadLevel == null) {
- String[] childrenNames = childrenNames();
- for (int i = 0; i < childrenNames.length; i++)
- node(childrenNames[i]).flush();
- return;
- }
-
- // a parent is the load level for this node
- if (this != loadLevel) {
- loadLevel.flush();
- return;
- }
-
- // this node is a load level
- // any work to do?
- if (!dirty)
- return;
- //remove dirty bit before saving, to ensure that concurrent
- //changes during save mark the store as dirty
- dirty = false;
- try {
- save();
- } catch (BackingStoreException e) {
- //mark it dirty again because the save failed
- dirty = true;
- throw e;
- }
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#get(java.lang.String, java.lang.String)
- */
- public String get(String key, String defaultValue) {
- String value = internalGet(key);
- return value == null ? defaultValue : value;
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#getBoolean(java.lang.String, boolean)
- */
- public boolean getBoolean(String key, boolean defaultValue) {
- String value = internalGet(key);
- return value == null ? defaultValue : TRUE.equalsIgnoreCase(value);
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#getByteArray(java.lang.String, byte[])
- */
- public byte[] getByteArray(String key, byte[] defaultValue) {
- String value = internalGet(key);
- return value == null ? defaultValue : Base64.decode(value.getBytes());
- }
-
- /*
- * Return a boolean value indicating whether or not a child with the given
- * name is known to this node.
- */
- protected synchronized boolean childExists(String childName) {
- if (children == null)
- return false;
- return children.get(childName) != null;
- }
-
- /**
- * Thread safe way to obtain a child for a given key. Returns the child
- * that matches the given key, or null if there is no matching child.
- */
- protected IEclipsePreferences getChild(String key, Plugin context, boolean create) {
- synchronized (this) {
- if (children == null)
- return null;
- Object value = children.get(key);
- if (value == null)
- return null;
- if (value instanceof IEclipsePreferences)
- return (IEclipsePreferences) value;
- // if we aren't supposed to create this node, then
- // just return null
- if (!create)
- return null;
- }
- return addChild(key, create(this, key, context));
- }
-
- /**
- * Thread safe way to obtain all children of this node. Never returns null.
- */
- protected IEclipsePreferences[] getChildren(boolean create) {
- ArrayList result = new ArrayList();
- String[] names = internalChildNames();
- for (int i = 0; i < names.length; i++) {
- IEclipsePreferences child = getChild(names[i], null, create);
- if (child != null)
- result.add(child);
- }
- return (IEclipsePreferences[]) result.toArray(EMPTY_NODE_ARRAY);
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#getDouble(java.lang.String, double)
- */
- public double getDouble(String key, double defaultValue) {
- String value = internalGet(key);
- double result = defaultValue;
- if (value != null)
- try {
- result = Double.parseDouble(value);
- } catch (NumberFormatException e) {
- // use default
- }
- return result;
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#getFloat(java.lang.String, float)
- */
- public float getFloat(String key, float defaultValue) {
- String value = internalGet(key);
- float result = defaultValue;
- if (value != null)
- try {
- result = Float.parseFloat(value);
- } catch (NumberFormatException e) {
- // use default
- }
- return result;
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#getInt(java.lang.String, int)
- */
- public int getInt(String key, int defaultValue) {
- String value = internalGet(key);
- int result = defaultValue;
- if (value != null)
- try {
- result = Integer.parseInt(value);
- } catch (NumberFormatException e) {
- // use default
- }
- return result;
- }
-
- protected IEclipsePreferences getLoadLevel() {
- return null;
- }
-
- /*
- * Subclasses to over-ride
- */
- protected IPath getLocation() {
- return null;
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#getLong(java.lang.String, long)
- */
- public long getLong(String key, long defaultValue) {
- String value = internalGet(key);
- long result = defaultValue;
- if (value != null)
- try {
- result = Long.parseLong(value);
- } catch (NumberFormatException e) {
- // use default
- }
- return result;
- }
-
- protected EclipsePreferences internalCreate(EclipsePreferences nodeParent, String nodeName, Plugin context) {
- return new EclipsePreferences(nodeParent, nodeName);
- }
-
- /**
- * Returns the existing value at the given key, or null if
- * no such value exists.
- */
- protected String internalGet(String key) {
- // throw NPE if key is null
- if (key == null)
- throw new NullPointerException();
- // illegal state if this node has been removed
- checkRemoved();
- String result;
- synchronized (this) {
- result = properties == null ? null : properties.get(key);
- }
- if (InternalPlatform.DEBUG_PREFERENCE_GET)
- Policy.debug("Getting preference value: " + absolutePath() + '/' + key + "->" + result); //$NON-NLS-1$ //$NON-NLS-2$
- return result;
- }
-
- /**
- * Implements the node(String) method, and optionally notifies listeners.
- */
- protected IEclipsePreferences internalNode(String path, boolean notify, Plugin context) {
-
- // illegal state if this node has been removed
- checkRemoved();
-
- // short circuit this node
- if (path.length() == 0)
- return this;
-
- // if we have an absolute path use the root relative to
- // this node instead of the global root
- // in case we have a different hierarchy. (e.g. export)
- if (path.charAt(0) == IPath.SEPARATOR)
- return (IEclipsePreferences) calculateRoot().node(path.substring(1));
-
- int index = path.indexOf(IPath.SEPARATOR);
- String key = index == -1 ? path : path.substring(0, index);
- boolean added = false;
- IEclipsePreferences child = getChild(key, context, true);
- if (child == null) {
- child = create(this, key, context);
- added = true;
- }
- // notify listeners if a child was added
- if (added && notify)
- fireNodeEvent(new NodeChangeEvent(this, child), true);
- return (IEclipsePreferences) child.node(index == -1 ? EMPTY_STRING : path.substring(index + 1));
- }
-
- /**
- * Stores the given (key,value) pair, performing lazy initialization of the
- * properties field if necessary. Returns the old value for the given key,
- * or null if no value existed.
- */
- protected synchronized String internalPut(String key, String newValue) {
- // illegal state if this node has been removed
- checkRemoved();
- if (properties == null)
- properties = new HashMapOfString();
- String oldValue = properties.get(key);
- if (InternalPlatform.DEBUG_PREFERENCE_SET)
- Policy.debug("Setting preference: " + absolutePath() + '/' + key + '=' + newValue); //$NON-NLS-1$
- properties.put(key, newValue);
- return oldValue;
- }
-
- /*
- * Subclasses to over-ride.
- */
- protected boolean isAlreadyLoaded(IEclipsePreferences node) {
- return true;
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#keys()
- */
- public String[] keys() {
- // illegal state if this node has been removed
- checkRemoved();
- synchronized (this) {
- return properties == null ? EMPTY_STRING_ARRAY : properties.keys();
- }
- }
-
- protected void load() throws BackingStoreException {
- load(getLocation());
- }
-
- protected static Properties loadProperties(IPath location) throws BackingStoreException {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Loading preferences from file: " + location); //$NON-NLS-1$
- InputStream input = null;
- Properties result = new Properties();
- try {
- input = new BufferedInputStream(new FileInputStream(location.toFile()));
- result.load(input);
- } catch (FileNotFoundException e) {
- // file doesn't exist but that's ok.
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Preference file does not exist: " + location); //$NON-NLS-1$
- return result;
- } catch (IOException e) {
- String message = NLS.bind(Messages.preferences_loadException, location);
- log(new Status(IStatus.INFO, Platform.PI_RUNTIME, IStatus.INFO, message, e));
- throw new BackingStoreException(message);
- } finally {
- if (input != null)
- try {
- input.close();
- } catch (IOException e) {
- // ignore
- }
- }
- return result;
- }
-
- protected void load(IPath location) throws BackingStoreException {
- if (location == null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Unable to determine location of preference file for node: " + absolutePath()); //$NON-NLS-1$
- return;
- }
- Properties fromDisk = loadProperties(location);
- convertFromProperties(this, fromDisk, false);
- }
-
- protected void loaded() {
- // do nothing
- }
-
- protected void loadLegacy() {
- // sub-classes to over-ride if necessary
- }
-
- public static void log(IStatus status) {
- InternalPlatform.getDefault().log(status);
- }
-
- protected void makeDirty() {
- EclipsePreferences node = this;
- while (node != null && !node.removed) {
- node.dirty = true;
- node = (EclipsePreferences) node.parent();
- }
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#name()
- */
- public String name() {
- return name;
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#node(java.lang.String)
- */
- public Preferences node(String pathName) {
- return internalNode(pathName, true, null);
- }
-
- protected void fireNodeEvent(final NodeChangeEvent event, final boolean added) {
- if (nodeChangeListeners == null)
- return;
- Object[] listeners = nodeChangeListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final INodeChangeListener listener = (INodeChangeListener) listeners[i];
- ISafeRunnable job = new ISafeRunnable() {
- public void handleException(Throwable exception) {
- // already logged in Platform#run()
- }
-
- public void run() throws Exception {
- if (added)
- listener.added(event);
- else
- listener.removed(event);
- }
- };
- Platform.run(job);
- }
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#nodeExists(java.lang.String)
- */
- public boolean nodeExists(String path) throws BackingStoreException {
- // short circuit for checking this node
- if (path.length() == 0)
- return !removed;
-
- // illegal state if this node has been removed.
- // do this AFTER checking for the empty string.
- checkRemoved();
-
- // use the root relative to this node instead of the global root
- // in case we have a different hierarchy. (e.g. export)
- if (path.charAt(0) == IPath.SEPARATOR)
- return calculateRoot().nodeExists(path.substring(1));
-
- int index = path.indexOf(IPath.SEPARATOR);
- boolean noSlash = index == -1;
-
- // if we are looking for a simple child then just look in the table and return
- if (noSlash)
- return childExists(path);
-
- // otherwise load the parent of the child and then recursively ask
- String childName = path.substring(0, index);
- if (!childExists(childName))
- return false;
- IEclipsePreferences child = getChild(childName, null, true);
- if (child == null)
- return false;
- return child.nodeExists(path.substring(index + 1));
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#parent()
- */
- public Preferences parent() {
- // illegal state if this node has been removed
- checkRemoved();
- return parent;
- }
-
- /*
- * Convenience method for notifying preference change listeners.
- */
- protected void firePreferenceEvent(String key, Object oldValue, Object newValue) {
- if (preferenceChangeListeners == null)
- return;
- Object[] listeners = preferenceChangeListeners.getListeners();
- final PreferenceChangeEvent event = new PreferenceChangeEvent(this, key, oldValue, newValue);
- for (int i = 0; i < listeners.length; i++) {
- final IPreferenceChangeListener listener = (IPreferenceChangeListener) listeners[i];
- ISafeRunnable job = new ISafeRunnable() {
- public void handleException(Throwable exception) {
- // already logged in Platform#run()
- }
-
- public void run() throws Exception {
- listener.preferenceChange(event);
- }
- };
- Platform.run(job);
- }
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#put(java.lang.String, java.lang.String)
- */
- public void put(String key, String newValue) {
- if (key == null || newValue == null)
- throw new NullPointerException();
- String oldValue = internalPut(key, newValue);
- if (!newValue.equals(oldValue)) {
- makeDirty();
- firePreferenceEvent(key, oldValue, newValue);
- }
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#putBoolean(java.lang.String, boolean)
- */
- public void putBoolean(String key, boolean value) {
- if (key == null)
- throw new NullPointerException();
- String newValue = value ? TRUE : FALSE;
- String oldValue = internalPut(key, newValue);
- if (!newValue.equals(oldValue)) {
- makeDirty();
- firePreferenceEvent(key, oldValue, newValue);
- }
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#putByteArray(java.lang.String, byte[])
- */
- public void putByteArray(String key, byte[] value) {
- if (key == null || value == null)
- throw new NullPointerException();
- String newValue = new String(Base64.encode(value));
- String oldValue = internalPut(key, newValue);
- if (!newValue.equals(oldValue)) {
- makeDirty();
- firePreferenceEvent(key, oldValue, newValue);
- }
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#putDouble(java.lang.String, double)
- */
- public void putDouble(String key, double value) {
- if (key == null)
- throw new NullPointerException();
- String newValue = Double.toString(value);
- String oldValue = internalPut(key, newValue);
- if (!newValue.equals(oldValue)) {
- makeDirty();
- firePreferenceEvent(key, oldValue, newValue);
- }
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#putFloat(java.lang.String, float)
- */
- public void putFloat(String key, float value) {
- if (key == null)
- throw new NullPointerException();
- String newValue = Float.toString(value);
- String oldValue = internalPut(key, newValue);
- if (!newValue.equals(oldValue)) {
- makeDirty();
- firePreferenceEvent(key, oldValue, newValue);
- }
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#putInt(java.lang.String, int)
- */
- public void putInt(String key, int value) {
- if (key == null)
- throw new NullPointerException();
- String newValue = Integer.toString(value);
- String oldValue = internalPut(key, newValue);
- if (!newValue.equals(oldValue)) {
- makeDirty();
- firePreferenceEvent(key, oldValue, newValue);
- }
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#putLong(java.lang.String, long)
- */
- public void putLong(String key, long value) {
- if (key == null)
- throw new NullPointerException();
- String newValue = Long.toString(value);
- String oldValue = internalPut(key, newValue);
- if (!newValue.equals(oldValue)) {
- makeDirty();
- firePreferenceEvent(key, oldValue, newValue);
- }
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#remove(java.lang.String)
- */
- public void remove(String key) {
- String oldValue = null;
- //Thread safety: synchronize when modifying the properties field
- synchronized (this) {
- if (properties == null)
- return;
- oldValue = properties.removeKey(key);
- if (oldValue == null)
- return;
- if (properties.size() == 0)
- properties = null;
- makeDirty();
- }
- firePreferenceEvent(key, oldValue, null);
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#removeNode()
- */
- public void removeNode() throws BackingStoreException {
- // illegal state if this node has been removed
- checkRemoved();
- // clear all the property values. do it "the long way" so
- // everyone gets notification
- String[] keys = keys();
- for (int i = 0; i < keys.length; i++)
- remove(keys[i]);
- // don't remove the global root or the scope root from the
- // parent but remove all its children
- if (parent != null && !(parent instanceof RootPreferences)) {
- // remove the node from the parent's collection and notify listeners
- removed = true;
- parent.removeNode(this);
- }
- IEclipsePreferences[] childNodes = getChildren(false);
- for (int i = 0; i < childNodes.length; i++)
- try {
- childNodes[i].removeNode();
- } catch (IllegalStateException e) {
- // ignore since we only get this exception if we have already
- // been removed. no work to do.
- }
- }
-
- /*
- * Remove the child from the collection and notify the listeners if something
- * was actually removed.
- */
- protected void removeNode(IEclipsePreferences child) {
- boolean wasRemoved = false;
- synchronized (this) {
- if (children != null) {
- wasRemoved = children.remove(child.name()) != null;
- if (wasRemoved)
- makeDirty();
- if (children.isEmpty())
- children = null;
- }
- }
- if (wasRemoved)
- fireNodeEvent(new NodeChangeEvent(this, child), false);
- }
-
- /*
- * @see org.eclipse.core.runtime.IEclipsePreferences#removeNodeChangeListener(org.eclipse.core.runtime.IEclipsePreferences.removeNodeChangeListener)
- */
- public void removeNodeChangeListener(INodeChangeListener listener) {
- checkRemoved();
- if (nodeChangeListeners == null)
- return;
- nodeChangeListeners.remove(listener);
- if (nodeChangeListeners.size() == 0)
- nodeChangeListeners = null;
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Removed preference node change listener: " + listener + " from: " + absolutePath()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * @see org.eclipse.core.runtime.IEclipsePreferences#removePreferenceChangeListener(org.eclipse.core.runtime.IEclipsePreferences.IPreferenceChangeListener)
- */
- public void removePreferenceChangeListener(IPreferenceChangeListener listener) {
- checkRemoved();
- if (preferenceChangeListeners == null)
- return;
- preferenceChangeListeners.remove(listener);
- if (preferenceChangeListeners.size() == 0)
- preferenceChangeListeners = null;
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Removed preference property change listener: " + listener + " from: " + absolutePath()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- protected void save() throws BackingStoreException {
- save(getLocation());
- }
-
- protected void save(IPath location) throws BackingStoreException {
- if (location == null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Unable to determine location of preference file for node: " + absolutePath()); //$NON-NLS-1$
- return;
- }
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Saving preferences to file: " + location); //$NON-NLS-1$
- Properties table = convertToProperties(new Properties(), EMPTY_STRING);
- if (table.isEmpty()) {
- // nothing to save. delete existing file if one exists.
- if (location.toFile().exists() && !location.toFile().delete()) {
- String message = NLS.bind(Messages.preferences_failedDelete, location);
- log(new Status(IStatus.WARNING, Platform.PI_RUNTIME, IStatus.WARNING, message, null));
- }
- return;
- }
- table.put(VERSION_KEY, VERSION_VALUE);
- OutputStream output = null;
- FileOutputStream fos = null;
- try {
- // create the parent dirs if they don't exist
- File parentFile = location.toFile().getParentFile();
- if (parentFile == null)
- return;
- parentFile.mkdirs();
- // set append to be false so we overwrite current settings.
- fos = new FileOutputStream(location.toOSString(), false);
- output = new BufferedOutputStream(fos);
- table.store(output, null);
- output.flush();
- fos.getFD().sync();
- } catch (IOException e) {
- String message = NLS.bind(Messages.preferences_saveException, location);
- log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, message, e));
- throw new BackingStoreException(message);
- } finally {
- if (output != null)
- try {
- output.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
-
- /**
- * Traverses the preference hierarchy rooted at this node, and adds
- * all preference key and value strings to the provided pool. If an added
- * string was already in the pool, all references will be replaced with the
- * canonical copy of the string.
- *
- * @param pool The pool to share strings in
- */
- public void shareStrings(StringPool pool) {
- //protect access while destructively sharing strings
- synchronized (this) {
- if (properties != null)
- properties.shareStrings(pool);
- }
- IEclipsePreferences[] myChildren = getChildren(false);
- for (int i = 0; i < myChildren.length; i++)
- if (myChildren[i] instanceof EclipsePreferences)
- ((EclipsePreferences) myChildren[i]).shareStrings(pool);
- }
-
- /*
- * Encode the given path and key combo to a form which is suitable for
- * persisting or using when searching. If the key contains a slash character
- * then we must use a double-slash to indicate the end of the
- * path/the beginning of the key.
- */
- public static String encodePath(String path, String key) {
- String result;
- int pathLength = path == null ? 0 : path.length();
- if (key.indexOf(IPath.SEPARATOR) == -1) {
- if (pathLength == 0)
- result = key;
- else
- result = path + IPath.SEPARATOR + key;
- } else {
- if (pathLength == 0)
- result = DOUBLE_SLASH + key;
- else
- result = path + DOUBLE_SLASH + key;
- }
- return result;
- }
-
- /*
- * Return the segment from the given path or null.
- * "segment" parameter is 0-based.
- */
- public static String getSegment(String path, int segment) {
- int start = path.indexOf(IPath.SEPARATOR) == 0 ? 1 : 0;
- int end = path.indexOf(IPath.SEPARATOR, start);
- if (end == path.length() - 1)
- end = -1;
- for (int i = 0; i < segment; i++) {
- if (end == -1)
- return null;
- start = end + 1;
- end = path.indexOf(IPath.SEPARATOR, start);
- }
- if (end == -1)
- end = path.length();
- return path.substring(start, end);
- }
-
- public static int getSegmentCount(String path) {
- StringTokenizer tokenizer = new StringTokenizer(path, String.valueOf(IPath.SEPARATOR));
- return tokenizer.countTokens();
- }
-
- /*
- * Return a relative path
- */
- public static String makeRelative(String path) {
- String result = path;
- if (path == null)
- return EMPTY_STRING;
- if (path.length() > 0 && path.charAt(0) == IPath.SEPARATOR)
- result = path.length() == 0 ? EMPTY_STRING : path.substring(1);
- return result;
- }
-
- /*
- * Return a 2 element String array.
- * element 0 - the path
- * element 1 - the key
- * The path may be null.
- * The key is never null.
- */
- public static String[] decodePath(String fullPath) {
- String key = null;
- String path = null;
-
- // check to see if we have an indicator which tells us where the path ends
- int index = fullPath.indexOf(DOUBLE_SLASH);
- if (index == -1) {
- // we don't have a double-slash telling us where the path ends
- // so the path is up to the last slash character
- int lastIndex = fullPath.lastIndexOf(IPath.SEPARATOR);
- if (lastIndex == -1) {
- key = fullPath;
- } else {
- path = fullPath.substring(0, lastIndex);
- key = fullPath.substring(lastIndex + 1);
- }
- } else {
- // the child path is up to the double-slash and the key
- // is the string after it
- path = fullPath.substring(0, index);
- key = fullPath.substring(index + 2);
- }
-
- // adjust if we have an absolute path
- if (path != null)
- if (path.length() == 0)
- path = null;
- else if (path.charAt(0) == IPath.SEPARATOR)
- path = path.substring(1);
-
- return new String[] {path, key};
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#sync()
- */
-
- public void sync() throws BackingStoreException {
- // illegal state if this node has been removed
- checkRemoved();
- IEclipsePreferences node = getLoadLevel();
- if (node == null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Preference node is not a load root: " + absolutePath()); //$NON-NLS-1$
- return;
- }
- if (node instanceof EclipsePreferences) {
- ((EclipsePreferences) node).load();
- node.flush();
- }
- }
-
- public String toDeepDebugString() {
- final StringBuffer buffer = new StringBuffer();
- IPreferenceNodeVisitor visitor = new IPreferenceNodeVisitor() {
- public boolean visit(IEclipsePreferences node) throws BackingStoreException {
- buffer.append(node);
- buffer.append('\n');
- String[] keys = node.keys();
- for (int i = 0; i < keys.length; i++) {
- buffer.append(node.absolutePath());
- buffer.append(PATH_SEPARATOR);
- buffer.append(keys[i]);
- buffer.append('=');
- buffer.append(node.get(keys[i], "*default*")); //$NON-NLS-1$
- buffer.append('\n');
- }
- return true;
- }
- };
- try {
- accept(visitor);
- } catch (BackingStoreException e) {
- System.out.println("Exception while calling #toDeepDebugString()"); //$NON-NLS-1$
- e.printStackTrace();
- }
- return buffer.toString();
- }
-
- public String toString() {
- return absolutePath();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/ExportedPreferences.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/ExportedPreferences.java
deleted file mode 100644
index 0bb7ef3..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/ExportedPreferences.java
+++ /dev/null
@@ -1,79 +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.preferences;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.preferences.IExportedPreferences;
-
-/**
- * @since 3.0
- */
-public class ExportedPreferences extends EclipsePreferences implements IExportedPreferences {
-
- private boolean isExportRoot = false;
- private String version;
-
- public static IExportedPreferences newRoot() {
- return new ExportedPreferences(null, ""); //$NON-NLS-1$
- }
-
- protected ExportedPreferences(EclipsePreferences parent, String name) {
- super(parent, name);
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IExportedPreferences#isExportRoot()
- */
- public boolean isExportRoot() {
- return isExportRoot;
- }
-
- /*
- * Internal method called only by the import/export mechanism.
- */
- public void setExportRoot() {
- isExportRoot = true;
- }
-
- /*
- * Internal method called only by the import/export mechanism to
- * validate bundle versions.
- */
- public String getVersion() {
- return version;
- }
-
- /*
- * Internal method called only by the import/export mechanism to
- * validate bundle versions.
- */
- public void setVersion(String version) {
- this.version = version;
- }
-
- protected EclipsePreferences internalCreate(EclipsePreferences nodeParent, String nodeName, Plugin context) {
- return new ExportedPreferences(nodeParent, nodeName);
- }
-
- /*
- * Return a string representation of this object. To be used for
- * debugging purposes only.
- */
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- if (isExportRoot)
- buffer.append("* "); //$NON-NLS-1$
- buffer.append(absolutePath());
- if (version != null)
- buffer.append(" (" + version + ')'); //$NON-NLS-1$
- return buffer.toString();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/InstancePreferences.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/InstancePreferences.java
deleted file mode 100644
index e0c0ee4..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/InstancePreferences.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.internal.preferences;
-
-import java.io.*;
-import java.util.*;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.internal.runtime.Policy;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.osgi.service.datalocation.Location;
-
-/**
- * @since 3.0
- */
-public class InstancePreferences extends EclipsePreferences {
-
- // cached values
- private String qualifier;
- private int segmentCount;
- private IEclipsePreferences loadLevel;
- private IPath location;
- // cache which nodes have been loaded from disk
- private static Set loadedNodes = new HashSet();
- private static boolean initialized = false;
- private static IPath baseLocation;
-
- private static IPath getBaseLocation() {
- // If we are running with -data=@none we won't have an instance location.
- // By leaving the value of baseLocation as null we still allow the users
- // to set preferences in this scope but the values will not be persisted
- // to disk when #flush() is called.
- if (baseLocation == null) {
- Location instanceLocation = Platform.getInstanceLocation();
- if (instanceLocation != null && (instanceLocation.isSet() || instanceLocation.allowsDefault()))
- baseLocation = InternalPlatform.getDefault().getMetaArea().getStateLocation(Platform.PI_RUNTIME);
- }
- return baseLocation;
- }
-
- /**
- * Default constructor. Should only be called by #createExecutableExtension.
- */
- public InstancePreferences() {
- this(null, null);
- }
-
- private InstancePreferences(EclipsePreferences parent, String name) {
- super(parent, name);
-
- initializeChildren();
-
- // cache the segment count
- String path = absolutePath();
- segmentCount = getSegmentCount(path);
- if (segmentCount < 2)
- return;
-
- // cache the qualifier
- qualifier = getSegment(path, 1);
-
- // don't cache the location until later in case instance prefs are
- // accessed before the instance location is set.
- }
-
- protected boolean isAlreadyLoaded(IEclipsePreferences node) {
- return loadedNodes.contains(node.name());
- }
-
- protected void loaded() {
- loadedNodes.add(name());
- }
-
- /**
- * Load the Eclipse 2.1 preferences for the given bundle. If a file
- * doesn't exist then assume that conversion has already occurred
- * and do nothing.
- */
- protected void loadLegacy() {
- IPath path = new Path(absolutePath());
- if (path.segmentCount() != 2)
- return;
- // If we are running with -data=@none we won't have an instance location.
- if (Platform.getInstanceLocation() == null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Cannot load Legacy plug-in preferences since instance location is not set."); //$NON-NLS-1$
- return;
- }
- String bundleName = path.segment(1);
- // the preferences file is located in the plug-in's state area at a well-known name
- // don't need to create the directory if there are no preferences to load
- File prefFile = null;
- Location instanceLocation = Platform.getInstanceLocation();
- if (instanceLocation != null && instanceLocation.isSet())
- prefFile = InternalPlatform.getDefault().getMetaArea().getPreferenceLocation(bundleName, false).toFile();
- if (prefFile == null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Cannot load legacy values because instance location is not set."); //$NON-NLS-1$
- return;
- }
- if (!prefFile.exists()) {
- // no preference file - that's fine
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Legacy plug-in preference file not found: " + prefFile); //$NON-NLS-1$
- return;
- }
-
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Loading legacy preferences from " + prefFile); //$NON-NLS-1$
-
- // load preferences from file
- InputStream input = null;
- Properties values = new Properties();
- try {
- input = new BufferedInputStream(new FileInputStream(prefFile));
- values.load(input);
- } catch (IOException e) {
- // problems loading preference store - quietly ignore
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("IOException encountered loading legacy preference file " + prefFile); //$NON-NLS-1$
- return;
- } finally {
- if (input != null) {
- try {
- input.close();
- } catch (IOException e) {
- // ignore problems with close
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL) {
- Policy.debug("IOException encountered closing legacy preference file " + prefFile); //$NON-NLS-1$
- e.printStackTrace();
- }
- }
- }
- }
-
- // Store values in the preferences object
- for (Iterator i = values.keySet().iterator(); i.hasNext();) {
- String key = (String) i.next();
- String value = values.getProperty(key);
- // value shouldn't be null but check just in case...
- if (value != null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Loaded legacy preference: " + key + " -> " + value); //$NON-NLS-1$ //$NON-NLS-2$
- // call these 2 methods rather than #put() so we don't send out unnecessary notification
- Object oldValue = internalPut(key, value);
- if (!value.equals(oldValue))
- makeDirty();
- }
- }
-
- // Delete the old file so we don't try and load it next time.
- if (!prefFile.delete())
- //Only print out message in failure case if we are debugging.
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Unable to delete legacy preferences file: " + prefFile); //$NON-NLS-1$
- }
-
- protected IPath getLocation() {
- if (location == null)
- location = computeLocation(getBaseLocation(), qualifier);
- return location;
- }
-
- /*
- * Return the node at which these preferences are loaded/saved.
- */
- 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;
- }
-
- /*
- * Initialize the children for the root of this node. Store the names as
- * keys in the children table so we can lazily load them later.
- */
- protected void initializeChildren() {
- if (initialized || parent == null)
- return;
- try {
- synchronized (this) {
- String[] names = computeChildren(getBaseLocation());
- for (int i = 0; i < names.length; i++)
- addChild(names[i], null);
- }
- } finally {
- initialized = true;
- }
- }
-
- protected EclipsePreferences internalCreate(EclipsePreferences nodeParent, String nodeName, Plugin context) {
- return new InstancePreferences(nodeParent, nodeName);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/ListenerRegistry.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/ListenerRegistry.java
deleted file mode 100644
index 62d77e5..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/ListenerRegistry.java
+++ /dev/null
@@ -1,159 +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.preferences;
-
-import org.eclipse.core.internal.runtime.ListenerList;
-
-/**
- * A class which holds onto a listener list object for a given path.
- * Typically the path is the absolute path of a preference node.
- *
- * @since 3.1
- */
-public class ListenerRegistry {
-
- /**
- * Specialized map-like data structure for storing change listeners.
- */
- private static class ListenerMap {
- private static final int GROW_SIZE = 10;
- String[] keys;
- ListenerList[] values;
-
- /**
- * Create a map of exactly the specified size.
- */
- ListenerMap(int size) {
- super();
- this.keys = new String[size];
- this.values = new ListenerList[size];
- }
-
- /**
- * Return the listener list associated with the given key,
- * or <code>null</code> if it doesn't exist.
- */
- ListenerList get(String key) {
- if (key == null)
- throw new NullPointerException();
- for (int i = 0; i < keys.length; i++)
- if (key.equals(keys[i]))
- return values[i];
- return null;
- }
-
- /**
- * Associate the given listener list with the specified key. Overwrite
- * an existing association, if applicable.
- */
- void put(String key, ListenerList value) {
- if (key == null)
- throw new NullPointerException();
- if (value == null) {
- remove(key);
- return;
- }
- // replace if exists, keeping track of an empty position
- int emptyIndex = -1;
- for (int i = 0; i < keys.length; i++) {
- String existing = keys[i];
- if (existing == null) {
- emptyIndex = i;
- continue;
- }
- if (existing.equals(key)) {
- values[i] = value;
- return;
- }
- }
- if (emptyIndex == -1)
- emptyIndex = grow();
- keys[emptyIndex] = key;
- values[emptyIndex] = value;
- }
-
- /*
- * Make the backing arrays larger
- */
- private int grow() {
- int size = keys.length;
- String[] tempKeys = new String[size + GROW_SIZE];
- System.arraycopy(keys, 0, tempKeys, 0, size);
- keys = tempKeys;
- ListenerList[] tempValues = new ListenerList[size + GROW_SIZE];
- System.arraycopy(values, 0, tempValues, 0, size);
- values = tempValues;
- return size;
- }
-
- /**
- * Remove the association specified by the given key.
- * Do nothing if none exists.
- *
- * Note: Should consider shrinking the array. Hold off for now
- * as we don't expect #remove to be a common code path.
- */
- void remove(String key) {
- if (key == null)
- throw new NullPointerException();
- for (int i = 0; i < keys.length; i++)
- if (key.equals(keys[i])) {
- keys[i] = null;
- values[i] = null;
- return;
- }
- }
- }
-
- static final Object[] EMPTY_LIST = new Object[0];
- ListenerMap registry = new ListenerMap(25);
-
- /**
- * Return the listeners for this path or an empty list if none.
- */
- public synchronized Object[] getListeners(String path) {
- ListenerList list = registry.get(path);
- return list == null ? EMPTY_LIST : list.getListeners();
- }
-
- /**
- * Add the given listener to the listeners registered for this path.
- * If the listener already exists, then do nothing.
- */
- public synchronized void add(String path, Object listener) {
- ListenerList list = registry.get(path);
- if (list == null)
- list = new ListenerList(ListenerList.IDENTITY);
- list.add(listener);
- registry.put(path, list);
- }
-
- /**
- * Remove the given listener from this path's collection of
- * listeners. If it is not associated with this path, then do nothing.
- */
- public synchronized void remove(String path, Object listener) {
- ListenerList list = registry.get(path);
- if (list == null)
- return;
- list.remove(listener);
- if (list.isEmpty())
- registry.remove(path);
- }
-
- /**
- * Remove all of the listeners registered under the given path.
- */
- public synchronized void clear(String path) {
- registry.remove(path);
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/LookupOrder.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/LookupOrder.java
deleted file mode 100644
index 0fa0301..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/LookupOrder.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.preferences;
-
-/**
- * Object used to store the look-up order for preference
- * scope searching.
- *
- * @since 3.0
- */
-public class LookupOrder {
-
- private String[] order;
-
- LookupOrder(String[] order) {
- for (int i = 0; i < order.length; i++)
- if (order[i] == null)
- throw new IllegalArgumentException();
- this.order = order;
- }
- public String[] getOrder() {
- return order;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/PreferenceForwarder.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/PreferenceForwarder.java
deleted file mode 100644
index b769079..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/PreferenceForwarder.java
+++ /dev/null
@@ -1,848 +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.preferences;
-
-import java.io.*;
-import java.util.Iterator;
-import java.util.Properties;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.preferences.DefaultScope;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-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) Platform.getPreferencesService().getRootNode().node(Plugin.PLUGIN_PREFERENCE_SCOPE);
- private DefaultPreferences defaultsRoot = (DefaultPreferences) Platform.getPreferencesService().getRootNode().node(DefaultScope.SCOPE);
- private String pluginID;
- private Plugin 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(Plugin plugin, String pluginID) {
- super();
- this.plugin = plugin;
- this.pluginID = pluginID;
- pluginRoot.addNodeChangeListener(this);
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#added(org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent)
- */
- public void added(IEclipsePreferences.NodeChangeEvent event) {
- if (listeners.size() > 0 && pluginID.equals(event.getChild().name()))
- getPluginPreferences(true).addPreferenceChangeListener(this);
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#removed(org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent)
- */
- public void removed(IEclipsePreferences.NodeChangeEvent event) {
- // don't worry about removing the preference change listener since
- // we won't get any notification from a removed node anyways.
- }
-
- /**
- * 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 void addPropertyChangeListener(IPropertyChangeListener listener) {
- getPluginPreferences(true).addPreferenceChangeListener(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 void removePropertyChangeListener(IPropertyChangeListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * 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).dirty;
- }
-
- /**
- * 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, Platform.PI_RUNTIME, IStatus.ERROR, message, e);
- InternalPlatform.getDefault().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/PreferencesService.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/PreferencesService.java
deleted file mode 100644
index ddb7c4c..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/PreferencesService.java
+++ /dev/null
@@ -1,1119 +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.preferences;
-
-import java.io.*;
-import java.util.*;
-import org.eclipse.core.internal.runtime.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.preferences.*;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * @since 3.0
- */
-public class PreferencesService implements IPreferencesService, IRegistryChangeListener {
-
- /**
- * The interval between passes over the preference tree to canonicalize
- * strings.
- */
- private static final long STRING_SHARING_INTERVAL = 300000;
-
- // cheat here and add "project" even though we really shouldn't know about it
- // because of plug-in dependancies and it being defined in the resources plug-in
- private static final String[] DEFAULT_DEFAULT_LOOKUP_ORDER = new String[] {"project", //$NON-NLS-1$
- InstanceScope.SCOPE, //
- ConfigurationScope.SCOPE, //
- DefaultScope.SCOPE};
- private static final char EXPORT_ROOT_PREFIX = '!';
- private static final char BUNDLE_VERSION_PREFIX = '@';
- private static final float EXPORT_VERSION = 3;
- private static final String VERSION_KEY = "file_export_version"; //$NON-NLS-1$
- private static final String ATTRIBUTE_NAME = "name"; //$NON-NLS-1$
- private static final String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$
- private static final String ELEMENT_SCOPE = "scope"; //$NON-NLS-1$
- private static final String ELEMENT_MODIFIER = "modifier"; //$NON-NLS-1$
- private static final String EMPTY_STRING = ""; //$NON-NLS-1$
-
- private static PreferencesService instance;
- static final RootPreferences root = new RootPreferences();
- private static final Map defaultsRegistry = Collections.synchronizedMap(new HashMap());
- private static final Map scopeRegistry = Collections.synchronizedMap(new HashMap());
- private ListenerList modifyListeners;
- /**
- * The last time analysis was done to remove duplicate strings
- */
- private long lastStringSharing = 0;
-
- /*
- * Create and return an IStatus object with ERROR severity and the
- * given message and exception.
- */
- private static IStatus createStatusError(String message, Exception e) {
- return new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, message, e);
- }
-
- /*
- * Create and return an IStatus object with WARNING severity and the
- * given message and exception.
- */
- private static IStatus createStatusWarning(String message, Exception e) {
- return new Status(IStatus.WARNING, Platform.PI_RUNTIME, IStatus.WARNING, message, e);
- }
-
- /*
- * Return the instance.
- */
- public static PreferencesService getDefault() {
- if (instance == null)
- instance = new PreferencesService();
- return instance;
- }
-
- /**
- * See who is plugged into the extension point.
- */
- private void initializeScopes() {
- IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Platform.PI_RUNTIME, Platform.PT_PREFERENCES);
- if (point == null)
- return;
- IExtension[] extensions = point.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] elements = extensions[i].getConfigurationElements();
- for (int j = 0; j < elements.length; j++)
- if (ELEMENT_SCOPE.equalsIgnoreCase(elements[j].getName()))
- scopeAdded(elements[j]);
- }
- Platform.getExtensionRegistry().addRegistryChangeListener(this, Platform.PI_RUNTIME);
- }
-
- private void initializeModifyListeners() {
- modifyListeners = new ListenerList();
- IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Platform.PI_RUNTIME, Platform.PT_PREFERENCES);
- if (point == null)
- return;
- IExtension[] extensions = point.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] elements = extensions[i].getConfigurationElements();
- for (int j = 0; j < elements.length; j++)
- if (ELEMENT_MODIFIER.equalsIgnoreCase(elements[j].getName()))
- addModifyListener(elements[j]);
- }
- Platform.getExtensionRegistry().addRegistryChangeListener(this, Platform.PI_RUNTIME);
- }
-
- static void log(IStatus status) {
- InternalPlatform.getDefault().log(status);
- }
-
- /*
- * Abstracted into a separate method to prepare for dynamic awareness.
- */
- static void scopeAdded(IConfigurationElement element) {
- String key = element.getAttribute(ATTRIBUTE_NAME);
- if (key == null) {
- String message = NLS.bind(Messages.preferences_missingScopeAttribute, element.getDeclaringExtension().getUniqueIdentifier());
- log(createStatusWarning(message, null));
- return;
- }
- scopeRegistry.put(key, element);
- root.addChild(key, null);
- }
-
- /*
- * Abstracted into a separate method to prepare for dynamic awareness.
- */
- private void addModifyListener(IConfigurationElement element) {
- String key = element.getAttribute(ATTRIBUTE_CLASS);
- if (key == null) {
- String message = NLS.bind(Messages.preferences_missingClassAttribute, element.getDeclaringExtension().getUniqueIdentifier());
- log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, message, null));
- return;
- }
- try {
- Object listener = element.createExecutableExtension(ATTRIBUTE_CLASS);
- if (!(listener instanceof PreferenceModifyListener)) {
- log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, Messages.preferences_classCastListener, null));
- return;
- }
- modifyListeners.add(listener);
- } catch (CoreException e) {
- log(e.getStatus());
- return;
- }
- }
-
- /*
- * Abstracted into a separate method to prepare for dynamic awareness.
- */
- static void scopeRemoved(String key) {
- IEclipsePreferences node = (IEclipsePreferences) root.node(key);
- root.removeNode(node);
- scopeRegistry.remove(key);
- }
-
- private PreferencesService() {
- super();
- initializeScopes();
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#applyPreferences(org.eclipse.core.runtime.preferences.IExportedPreferences)
- */
- public IStatus applyPreferences(IExportedPreferences preferences) throws CoreException {
- // TODO investigate refactoring to merge with new #apply(IEclipsePreferences, IPreferenceFilter[]) APIs
- if (preferences == null)
- throw new IllegalArgumentException();
-
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Applying exported preferences: " + ((ExportedPreferences) preferences).toDeepDebugString()); //$NON-NLS-1$
-
- final MultiStatus result = new MultiStatus(Platform.PI_RUNTIME, IStatus.OK, Messages.preferences_applyProblems, null);
-
- IEclipsePreferences modifiedNode = firePreApplyEvent(preferences);
-
- // create a visitor to apply the given set of preferences
- IPreferenceNodeVisitor visitor = new IPreferenceNodeVisitor() {
- public boolean visit(IEclipsePreferences node) throws BackingStoreException {
- IEclipsePreferences globalNode;
- if (node.parent() == null)
- globalNode = root;
- else
- globalNode = (IEclipsePreferences) root.node(node.absolutePath());
- ExportedPreferences epNode = (ExportedPreferences) node;
-
- // if this node is an export root then we need to remove
- // it from the global preferences before continuing.
- boolean removed = false;
- if (epNode.isExportRoot()) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Found export root: " + epNode.absolutePath()); //$NON-NLS-1$
- // TODO should only have to do this if any of my children have properties to set
- globalNode.removeNode();
- removed = true;
- }
-
- // iterate over the preferences in this node and set them
- // in the global space.
- if (epNode.properties != null && !epNode.properties.isEmpty()) {
- // if this node was removed then we need to create a new one
- if (removed)
- globalNode = (IEclipsePreferences) root.node(node.absolutePath());
- String[] keys = epNode.properties.keys();
- for (int i = 0; i < keys.length; i++) {
- String key = keys[i];
- // intern strings we import because some people
- // in their property change listeners use identity
- // instead of equals. See bug 20193 and 20534.
- key = key.intern();
- String value = node.get(key, null);
- if (value != null) {
- if (InternalPlatform.DEBUG_PREFERENCE_SET)
- Policy.debug("Setting: " + globalNode.absolutePath() + '/' + key + '=' + value); //$NON-NLS-1$
- globalNode.put(key, value);
- }
- }
- }
-
- // keep visiting children
- return true;
- }
- };
-
- try {
- // start by visiting the root
- modifiedNode.accept(visitor);
- } catch (BackingStoreException e) {
- throw new CoreException(createStatusError(Messages.preferences_applyProblems, e));
- }
-
- // save the prefs
- try {
- getRootNode().node(modifiedNode.absolutePath()).flush();
- } catch (BackingStoreException e) {
- throw new CoreException(createStatusError(Messages.preferences_saveProblems, e));
- }
-
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Current list of all settings: " + ((EclipsePreferences) getRootNode()).toDeepDebugString()); //$NON-NLS-1$
- //this typically causes a major change to the preference tree, so force string sharing
- lastStringSharing = 0;
- shareStrings();
- return result;
- }
-
- /*
- * Convert the given properties file from legacy format to
- * one which is Eclipse 3.0 compliant.
- *
- * Convert the plug-in version indicator entries to export roots.
- */
- private Properties convertFromLegacy(Properties properties) {
- Properties result = new Properties();
- String prefix = IPath.SEPARATOR + Plugin.PLUGIN_PREFERENCE_SCOPE + IPath.SEPARATOR;
- for (Iterator i = properties.keySet().iterator(); i.hasNext();) {
- String key = (String) i.next();
- String value = properties.getProperty(key);
- if (value != null) {
- int index = key.indexOf(IPath.SEPARATOR);
- if (index == -1) {
- result.put(BUNDLE_VERSION_PREFIX + key, value);
- result.put(EXPORT_ROOT_PREFIX + prefix + key, EMPTY_STRING);
- } else {
- String path = key.substring(0, index);
- key = key.substring(index + 1);
- result.put(EclipsePreferences.encodePath(prefix + path, key), value);
- }
- }
- }
- return result;
- }
-
- /*
- * Convert the given properties file into a node hierarchy suitable for
- * importing.
- */
- private IExportedPreferences convertFromProperties(Properties properties) {
- IExportedPreferences result = ExportedPreferences.newRoot();
- for (Iterator i = properties.keySet().iterator(); i.hasNext();) {
- String path = (String) i.next();
- String value = properties.getProperty(path);
- if (path.charAt(0) == EXPORT_ROOT_PREFIX) {
- ExportedPreferences current = (ExportedPreferences) result.node(path.substring(1));
- current.setExportRoot();
- } else if (path.charAt(0) == BUNDLE_VERSION_PREFIX) {
- ExportedPreferences current = (ExportedPreferences) result.node(InstanceScope.SCOPE).node(path.substring(1));
- current.setVersion(value);
- } else {
- String[] decoded = EclipsePreferences.decodePath(path);
- path = decoded[0] == null ? EMPTY_STRING : decoded[0];
- ExportedPreferences current = (ExportedPreferences) result.node(path);
- String key = decoded[1];
- current.put(key, value);
- }
- }
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Converted preferences file to IExportedPreferences tree: " + ((ExportedPreferences) result).toDeepDebugString()); //$NON-NLS-1$
- return result;
- }
-
- /*
- * Return the string which is the scope for the given path.
- * Return the empty string if it cannot be determined.
- */
- String getScope(String path) {
- if (path == null || path.length() == 0)
- return EMPTY_STRING;
- int startIndex = path.indexOf(IPath.SEPARATOR);
- if (startIndex == -1)
- return path;
- if (path.length() == 1)
- return EMPTY_STRING;
- int endIndex = path.indexOf(IPath.SEPARATOR, startIndex + 1);
- if (endIndex == -1)
- endIndex = path.length();
- return path.substring(startIndex + 1, endIndex);
- }
-
- /*
- * excludesList is guarenteed not to be null
- */
- private Properties convertToProperties(IEclipsePreferences preferences, final String[] excludesList) throws BackingStoreException {
- final Properties result = new Properties();
- final int baseLength = preferences.absolutePath().length();
-
- // create a visitor to do the export
- IPreferenceNodeVisitor visitor = new IPreferenceNodeVisitor() {
- public boolean visit(IEclipsePreferences node) throws BackingStoreException {
- // don't store defaults
- String absolutePath = node.absolutePath();
- String scope = getScope(absolutePath);
- if (DefaultScope.SCOPE.equals(scope))
- return false;
- String path = absolutePath.length() <= baseLength ? EMPTY_STRING : EclipsePreferences.makeRelative(absolutePath.substring(baseLength));
- // check the excludes list to see if this node should be considered
- for (int i = 0; i < excludesList.length; i++) {
- String exclusion = EclipsePreferences.makeRelative(excludesList[i]);
- if (path.startsWith(exclusion))
- return false;
- }
- boolean needToAddVersion = InstanceScope.SCOPE.equals(scope);
- // check the excludes list for each preference
- String[] keys = node.keys();
- for (int i = 0; i < keys.length; i++) {
- String key = keys[i];
- boolean ignore = false;
- for (int j = 0; !ignore && j < excludesList.length; j++)
- if (EclipsePreferences.encodePath(path, key).startsWith(EclipsePreferences.makeRelative(excludesList[j])))
- ignore = true;
- if (!ignore) {
- String value = node.get(key, null);
- if (value != null) {
- if (needToAddVersion) {
- String bundle = getBundleName(absolutePath);
- if (bundle != null) {
- String version = getBundleVersion(bundle);
- if (version != null)
- result.put(BUNDLE_VERSION_PREFIX + bundle, version);
- }
- needToAddVersion = false;
- }
- result.put(EclipsePreferences.encodePath(absolutePath, key), value);
- }
- }
- }
- return true;
- }
- };
-
- // start by visiting the root that we were passed in
- preferences.accept(visitor);
-
- // return the properties object
- return result;
- }
-
- protected IEclipsePreferences createNode(String name) {
- IScope scope = null;
- Object value = scopeRegistry.get(name);
- if (value instanceof IConfigurationElement) {
- try {
- scope = (IScope) ((IConfigurationElement) value).createExecutableExtension(ATTRIBUTE_CLASS);
- scopeRegistry.put(name, scope);
- } catch (ClassCastException e) {
- log(createStatusError(Messages.preferences_classCastScope, e));
- return new EclipsePreferences(root, name);
- } catch (CoreException e) {
- log(e.getStatus());
- return new EclipsePreferences(root, name);
- }
- } else
- scope = (IScope) value;
- return scope.create(root, name);
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#exportPreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences, java.io.OutputStream, java.lang.String[])
- */
- public IStatus exportPreferences(IEclipsePreferences node, OutputStream output, String[] excludesList) throws CoreException {
- // TODO investigate refactoring to merge with new #export(IEclipsePreferences, IPreferenceFilter[]) APIs
- if (node == null || output == null)
- throw new IllegalArgumentException();
- Properties properties = null;
- if (excludesList == null)
- excludesList = new String[0];
- try {
- properties = convertToProperties(node, excludesList);
- if (properties.isEmpty())
- return Status.OK_STATUS;
- properties.put(VERSION_KEY, Float.toString(EXPORT_VERSION));
- properties.put(EXPORT_ROOT_PREFIX + node.absolutePath(), EMPTY_STRING);
- } catch (BackingStoreException e) {
- throw new CoreException(createStatusError(e.getMessage(), e));
- }
- try {
- properties.store(output, null);
- } catch (IOException e) {
- throw new CoreException(createStatusError(Messages.preferences_exportProblems, e));
- }
- return Status.OK_STATUS;
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#get(java.lang.String, java.lang.String, org.osgi.service.prefs.Preferences[])
- */
- public String get(String key, String defaultValue, Preferences[] nodes) {
- if (nodes == null)
- return defaultValue;
- for (int i = 0; i < nodes.length; i++) {
- Preferences node = nodes[i];
- if (node != null) {
- String result = node.get(key, null);
- if (result != null)
- return result;
- }
- }
- return defaultValue;
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#getBoolean(java.lang.String, java.lang.String, boolean, org.eclipse.core.runtime.preferences.IScope[])
- */
- public boolean getBoolean(String qualifier, String key, boolean defaultValue, IScopeContext[] scopes) {
- String result = get(EclipsePreferences.decodePath(key)[1], null, getNodes(qualifier, key, scopes));
- return result == null ? defaultValue : Boolean.valueOf(result).booleanValue();
- }
-
- /*
- * Return the version for the bundle with the given name. Return null if it
- * is not known or there is a problem.
- */
- String getBundleVersion(String bundleName) {
- Bundle bundle = Platform.getBundle(bundleName);
- if (bundle != null) {
- Object version = bundle.getHeaders(EMPTY_STRING).get(Constants.BUNDLE_VERSION);
- if (version != null && version instanceof String)
- return (String) version;
- }
- return null;
- }
-
- /*
- * Return the name of the bundle from the given path.
- * It is assumed that that path is:
- * - absolute
- * - in the instance scope
- */
- String getBundleName(String path) {
- if (path.length() == 0 || path.charAt(0) != IPath.SEPARATOR)
- return null;
- int first = path.indexOf(IPath.SEPARATOR, 1);
- if (first == -1)
- return null;
- int second = path.indexOf(IPath.SEPARATOR, first + 1);
- return second == -1 ? path.substring(first + 1) : path.substring(first + 1, second);
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#getByteArray(java.lang.String, java.lang.String, byte[], org.eclipse.core.runtime.preferences.IScope[])
- */
- public byte[] getByteArray(String qualifier, String key, byte[] defaultValue, IScopeContext[] scopes) {
- String result = get(EclipsePreferences.decodePath(key)[1], null, getNodes(qualifier, key, scopes));
- return result == null ? defaultValue : result.getBytes();
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#getDefaultLookupOrder(java.lang.String, java.lang.String)
- */
- public String[] getDefaultLookupOrder(String qualifier, String key) {
- LookupOrder order = (LookupOrder) defaultsRegistry.get(getRegistryKey(qualifier, key));
- return order == null ? null : order.getOrder();
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#getDouble(java.lang.String, java.lang.String, double, org.eclipse.core.runtime.preferences.IScope[])
- */
- public double getDouble(String qualifier, String key, double defaultValue, IScopeContext[] scopes) {
- String value = get(EclipsePreferences.decodePath(key)[1], null, getNodes(qualifier, key, scopes));
- if (value == null)
- return defaultValue;
- try {
- return Double.parseDouble(value);
- } catch (NumberFormatException e) {
- return defaultValue;
- }
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#getFloat(java.lang.String, java.lang.String, float, org.eclipse.core.runtime.preferences.IScope[])
- */
- public float getFloat(String qualifier, String key, float defaultValue, IScopeContext[] scopes) {
- String value = get(EclipsePreferences.decodePath(key)[1], null, getNodes(qualifier, key, scopes));
- if (value == null)
- return defaultValue;
- try {
- return Float.parseFloat(value);
- } catch (NumberFormatException e) {
- return defaultValue;
- }
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#getInt(java.lang.String, java.lang.String, int, org.eclipse.core.runtime.preferences.IScope[])
- */
- public int getInt(String qualifier, String key, int defaultValue, IScopeContext[] scopes) {
- String value = get(EclipsePreferences.decodePath(key)[1], null, getNodes(qualifier, key, scopes));
- if (value == null)
- return defaultValue;
- try {
- return Integer.parseInt(value);
- } catch (NumberFormatException e) {
- return defaultValue;
- }
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#getLong(java.lang.String, java.lang.String, long, org.eclipse.core.runtime.preferences.IScope[])
- */
- public long getLong(String qualifier, String key, long defaultValue, IScopeContext[] scopes) {
- String value = get(EclipsePreferences.decodePath(key)[1], null, getNodes(qualifier, key, scopes));
- if (value == null)
- return defaultValue;
- try {
- return Long.parseLong(value);
- } catch (NumberFormatException e) {
- return defaultValue;
- }
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#getLookupOrder(java.lang.String, java.lang.String)
- */
- public String[] getLookupOrder(String qualifier, String key) {
- String[] order = getDefaultLookupOrder(qualifier, key);
- // if there wasn't an exact match based on both qualifier and simple name
- // then do a lookup based only on the qualifier
- if (order == null && key != null)
- order = getDefaultLookupOrder(qualifier, null);
- if (order == null)
- order = DEFAULT_DEFAULT_LOOKUP_ORDER;
- return order;
- }
-
- private Preferences[] getNodes(String qualifier, String key, IScopeContext[] contexts) {
- String[] order = getLookupOrder(qualifier, key);
- String childPath = EclipsePreferences.makeRelative(EclipsePreferences.decodePath(key)[0]);
- ArrayList result = new ArrayList();
- for (int i = 0; i < order.length; i++) {
- String scopeString = order[i];
- boolean found = false;
- for (int j = 0; contexts != null && j < contexts.length; j++) {
- IScopeContext context = contexts[j];
- if (context != null && context.getName().equals(scopeString)) {
- Preferences node = context.getNode(qualifier);
- if (node != null) {
- found = true;
- if (childPath != null)
- node = node.node(childPath);
- result.add(node);
- }
- }
- }
- if (!found) {
- Preferences node = getRootNode().node(scopeString).node(qualifier);
- if (childPath != null)
- node = node.node(childPath);
- result.add(node);
- }
- found = false;
- }
- return (Preferences[]) result.toArray(new Preferences[result.size()]);
- }
-
- /*
- * Convert the given qualifier and key into a key to use in the look-up registry.
- */
- private String getRegistryKey(String qualifier, String key) {
- if (qualifier == null)
- throw new IllegalArgumentException();
- if (key == null)
- return qualifier;
- return qualifier + '/' + key;
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#getRootNode()
- */
-
- public IEclipsePreferences getRootNode() {
- return root;
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#getString(java.lang.String, java.lang.String, java.lang.String, org.eclipse.core.runtime.preferences.IScope[])
- */
- public String getString(String qualifier, String key, String defaultValue, IScopeContext[] scopes) {
- return get(EclipsePreferences.decodePath(key)[1], defaultValue, getNodes(qualifier, key, scopes));
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#importPreferences(java.io.InputStream)
- */
- public IStatus importPreferences(InputStream input) throws CoreException {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Importing preferences..."); //$NON-NLS-1$
- return applyPreferences(readPreferences(input));
- }
-
- /*
- * Returns a boolean value indicating whether or not the given Properties
- * object is the result of a preference export previous to Eclipse 3.0.
- *
- * Check the contents of the file. In Eclipse 3.0 we printed out a file
- * version key.
- */
- private boolean isLegacy(Properties properties) {
- return properties.getProperty(VERSION_KEY) == null;
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#readPreferences(java.io.InputStream)
- */
- public IExportedPreferences readPreferences(InputStream input) throws CoreException {
- if (input == null)
- throw new IllegalArgumentException();
-
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Reading preferences from stream..."); //$NON-NLS-1$
-
- // read the file into a properties object
- Properties properties = new Properties();
- try {
- properties.load(input);
- } catch (IOException e) {
- throw new CoreException(createStatusError(Messages.preferences_importProblems, e));
- } finally {
- try {
- input.close();
- } catch (IOException e) {
- // ignore
- }
- }
-
- // an empty file is an invalid file format
- if (properties.isEmpty())
- throw new CoreException(createStatusError(Messages.preferences_invalidFileFormat, null));
-
- // manipulate the file if it from a legacy preference export
- if (isLegacy(properties)) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Read legacy preferences file, converting to 3.0 format..."); //$NON-NLS-1$
- properties = convertFromLegacy(properties);
- } else {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Read preferences file."); //$NON-NLS-1$
- properties.remove(VERSION_KEY);
- }
-
- // convert the Properties object into an object to return
- return convertFromProperties(properties);
- }
-
- public void registryChanged(IRegistryChangeEvent event) {
- IExtensionDelta[] deltas = event.getExtensionDeltas(Platform.PI_RUNTIME, Platform.PT_PREFERENCES);
- if (deltas.length == 0)
- return;
- // dynamically adjust the registered scopes
- for (int i = 0; i < deltas.length; i++) {
- IConfigurationElement[] elements = deltas[i].getExtension().getConfigurationElements();
- for (int j = 0; j < elements.length; j++) {
- switch (deltas[i].getKind()) {
- case IExtensionDelta.ADDED :
- scopeAdded(elements[j]);
- break;
- case IExtensionDelta.REMOVED :
- String scope = elements[j].getAttribute(ATTRIBUTE_NAME);
- if (scope != null)
- scopeRemoved(scope);
- break;
- }
- }
- }
- // initialize the preference modify listeners
- initializeModifyListeners();
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#setDefaultLookupOrder(java.lang.String, java.lang.String, java.lang.String[])
- */
- public void setDefaultLookupOrder(String qualifier, String key, String[] order) {
- String registryKey = getRegistryKey(qualifier, key);
- if (order == null)
- defaultsRegistry.remove(registryKey);
- else {
- LookupOrder obj = new LookupOrder(order);
- defaultsRegistry.put(registryKey, obj);
- }
- }
-
- /**
- * Shares all duplicate equal strings referenced by the preference service.
- */
- void shareStrings() {
- long now = System.currentTimeMillis();
- if (now - lastStringSharing < STRING_SHARING_INTERVAL)
- return;
- StringPool pool = new StringPool();
- root.shareStrings(pool);
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- System.out.println("Preference string sharing saved: " + pool.getSavedStringCount()); //$NON-NLS-1$
- lastStringSharing = now;
- }
-
- public IStatus validateVersions(IPath path) {
- final MultiStatus result = new MultiStatus(Platform.PI_RUNTIME, IStatus.INFO, Messages.preferences_validate, null);
- IPreferenceNodeVisitor visitor = new IPreferenceNodeVisitor() {
- public boolean visit(IEclipsePreferences node) {
- if (!(node instanceof ExportedPreferences))
- return false;
-
- // calculate the version in the file
- ExportedPreferences realNode = (ExportedPreferences) node;
- String version = realNode.getVersion();
- if (version == null || !PluginVersionIdentifier.validateVersion(version).isOK())
- return true;
- PluginVersionIdentifier versionInFile = new PluginVersionIdentifier(version);
-
- // calculate the version of the installed bundle
- String bundleName = getBundleName(node.absolutePath());
- if (bundleName == null)
- return true;
- String stringVersion = getBundleVersion(bundleName);
- if (stringVersion == null || !PluginVersionIdentifier.validateVersion(stringVersion).isOK())
- return true;
- PluginVersionIdentifier versionInMemory = new PluginVersionIdentifier(stringVersion);
-
- // verify the versions based on the matching rules
- IStatus verification = validatePluginVersions(bundleName, versionInFile, versionInMemory);
- if (verification != null)
- result.add(verification);
-
- return true;
- }
- };
-
- InputStream input = null;
- try {
- input = new BufferedInputStream(new FileInputStream(path.toFile()));
- IExportedPreferences prefs = readPreferences(input);
- prefs.accept(visitor);
- } catch (FileNotFoundException e) {
- // ignore...if the file does not exist then all is OK
- } catch (CoreException e) {
- result.add(createStatusError(Messages.preferences_validationException, e));
- } catch (BackingStoreException e) {
- result.add(createStatusError(Messages.preferences_validationException, e));
- }
- return result;
- }
-
- /**
- * Compares two plugin version identifiers to see if their preferences
- * are compatible. If they are not compatible, a warning message is
- * added to the given multistatus, according to the following rules:
- *
- * - plugins that differ in service number: no status
- * - plugins that differ in minor version: WARNING status
- * - plugins that differ in major version:
- * - where installed plugin is newer: WARNING status
- * - where installed plugin is older: ERROR status
- * @param bundle the name of the bundle
- * @param pref The version identifer of the preferences to be loaded
- * @param installed The version identifier of the installed plugin
- */
- IStatus validatePluginVersions(String bundle, PluginVersionIdentifier pref, PluginVersionIdentifier installed) {
- if (installed.getMajorComponent() == pref.getMajorComponent() && installed.getMinorComponent() == pref.getMinorComponent())
- return null;
- int severity;
- if (installed.getMajorComponent() < pref.getMajorComponent())
- severity = IStatus.ERROR;
- else
- severity = IStatus.WARNING;
- String msg = NLS.bind(Messages.preferences_incompatible, (new Object[] {pref, bundle, installed}));
- return new Status(severity, Platform.PI_RUNTIME, 1, msg, null);
- }
-
- private IEclipsePreferences mergeTrees(IEclipsePreferences[] trees) throws BackingStoreException {
- if (trees.length == 1)
- return trees[0];
- final IEclipsePreferences result = ExportedPreferences.newRoot();
- if (trees.length == 0)
- return result;
- IPreferenceNodeVisitor visitor = new IPreferenceNodeVisitor() {
- public boolean visit(IEclipsePreferences node) throws BackingStoreException {
- Preferences destination = result.node(node.absolutePath());
- copyFromTo(node, destination, null, 0);
- return true;
- }
- };
- for (int i = 0; i < trees.length; i++)
- trees[i].accept(visitor);
- return result;
- }
-
- /*
- * Return a tree which contains only nodes and keys which are applicable to the given filter.
- */
- private IEclipsePreferences trimTree(IEclipsePreferences tree, IPreferenceFilter filter) throws BackingStoreException {
- IEclipsePreferences result = (IEclipsePreferences) ExportedPreferences.newRoot().node(tree.absolutePath());
- String[] scopes = filter.getScopes();
- if (scopes == null)
- throw new IllegalArgumentException();
- String treePath = tree.absolutePath();
- // see if this node is applicable by going over all our scopes
- for (int i = 0; i < scopes.length; i++) {
- String scope = scopes[i];
- Map mapping = filter.getMapping(scope);
- // if the mapping is null then copy everything if the scope matches
- if (mapping == null) {
- // if we are the root node then check our children
- if (tree.parent() == null && tree.nodeExists(scope))
- copyFromTo(tree.node(scope), result.node(scope), null, -1);
- // ensure we are in the correct scope
- else if (scopeMatches(scope, tree))
- copyFromTo(tree, result, null, -1);
- continue;
- }
- // iterate over the list of declared nodes
- for (Iterator iter = mapping.keySet().iterator(); iter.hasNext();) {
- String nodePath = (String) iter.next();
- String nodeFullPath = '/' + scope + '/' + nodePath;
- // if this subtree isn't in a hierarchy we are interested in, then go to the next one
- if (!nodeFullPath.startsWith(treePath))
- continue;
- // get the child node
- String childPath = nodeFullPath.substring(treePath.length());
- childPath = EclipsePreferences.makeRelative(childPath);
- if (tree.nodeExists(childPath)) {
- PreferenceFilterEntry[] entries;
- // protect against wrong classes since this is passed in by the user
- try {
- entries = (PreferenceFilterEntry[]) mapping.get(nodePath);
- } catch (ClassCastException e) {
- log(createStatusError(Messages.preferences_classCastFilterEntry, e));
- continue;
- }
- String[] keys = null;
- if (entries != null) {
- ArrayList list = new ArrayList();
- for (int j = 0; j < entries.length; j++) {
- if (entries[j] != null)
- list.add(entries[j].getKey());
- }
- keys = (String[]) list.toArray(new String[list.size()]);
- }
- // do infinite depth if there are no keys specified since the parent matched.
- copyFromTo(tree.node(childPath), result.node(childPath), keys, keys == null ? -1 : 0);
- }
- }
- }
- return result;
- }
-
- /**
- * Return true if the given node is in the specified scope and false othewise.
- */
- private boolean scopeMatches(String scope, IEclipsePreferences tree) {
- // the root isn't in any scope
- if (tree.parent() == null)
- return false;
- // fancy math to get the first segment of the path
- String path = tree.absolutePath();
- int index = path.indexOf('/', 1);
- String sub = path.substring(1, index == -1 ? path.length() : index);
- return scope.equals(sub);
- }
-
- /**
- * Copy key/value pairs from the source to the destination. If the key list is null
- * then copy all associations.
- *
- * If the depth is 0, then this operation is performed only on the source node. Otherwise
- * it is performed on the source node's subtree.
- *
- * @param depth one of 0 or -1
- */
- void copyFromTo(Preferences source, Preferences destination, String[] keys, int depth) throws BackingStoreException {
- String[] keysToCopy = keys == null ? source.keys() : keys;
- for (int i = 0; i < keysToCopy.length; i++) {
- String value = source.get(keysToCopy[i], null);
- if (value != null)
- destination.put(keysToCopy[i], value);
- }
- if (depth == 0)
- return;
- String[] children = source.childrenNames();
- for (int i = 0; i < children.length; i++)
- copyFromTo(source.node(children[i]), destination.node(children[i]), keys, depth);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#exportPreferences(IEclipsePreferences, IPreferenceFilter[], OutputStream)
- */
- public void exportPreferences(IEclipsePreferences node, IPreferenceFilter[] filters, OutputStream stream) throws CoreException {
- if (filters == null || filters.length == 0)
- return;
- try {
- internalExport(node, filters, stream);
- } catch (BackingStoreException e) {
- throw new CoreException(createStatusError(Messages.preferences_exportProblems, e));
- }
- }
-
- /**
- * Take the preference tree and trim it so it only holds values applying to the given filters.
- * Then export the resulting tree to the given output stream.
- */
- private void internalExport(IEclipsePreferences node, IPreferenceFilter filters[], OutputStream output) throws BackingStoreException, CoreException {
- ArrayList trees = new ArrayList();
- for (int i = 0; i < filters.length; i++)
- trees.add(trimTree(node, filters[i]));
- IEclipsePreferences toExport = mergeTrees((IEclipsePreferences[]) trees.toArray(new IEclipsePreferences[trees.size()]));
- exportPreferences(toExport, output, (String[]) null);
- }
-
- /* (non-Javadoc)
- * @see IPreferencesService#matches(IEclipsePreferences, IPreferenceFilter[])
- */
- public IPreferenceFilter[] matches(IEclipsePreferences tree, IPreferenceFilter[] filters) throws CoreException {
- if (filters == null || filters.length == 0)
- return new IPreferenceFilter[0];
- try {
- return internalMatches(tree, filters);
- } catch (BackingStoreException e) {
- throw new CoreException(createStatusError(Messages.preferences_matching, e));
- }
- }
-
- /*
- * Internal method that collects the matching filters for the given tree and returns them.
- */
- private IPreferenceFilter[] internalMatches(IEclipsePreferences tree, IPreferenceFilter[] filters) throws BackingStoreException {
- ArrayList result = new ArrayList();
- for (int i = 0; i < filters.length; i++)
- if (internalMatches(tree, filters[i]))
- result.add(filters[i]);
- return (IPreferenceFilter[]) result.toArray(new IPreferenceFilter[result.size()]);
- }
-
- private boolean containsKeys(IEclipsePreferences aRoot) throws BackingStoreException {
- final boolean result[] = new boolean[] {false};
- IPreferenceNodeVisitor visitor = new IPreferenceNodeVisitor() {
- public boolean visit(IEclipsePreferences node) throws BackingStoreException {
- if (node.keys().length != 0)
- result[0] = true;
- return !result[0];
- }
- };
- aRoot.accept(visitor);
- return result[0];
- }
-
- /*
- * Return true if the given tree contains information that the specified filter is interested
- * in, and false otherwise.
- */
- private boolean internalMatches(IEclipsePreferences tree, IPreferenceFilter filter) throws BackingStoreException {
- String[] scopes = filter.getScopes();
- if (scopes == null)
- throw new IllegalArgumentException();
- String treePath = tree.absolutePath();
- // see if this node is applicable by going over all our scopes
- for (int i = 0; i < scopes.length; i++) {
- String scope = scopes[i];
- Map mapping = filter.getMapping(scope);
- // if the mapping is null then we match everything
- if (mapping == null) {
- // if we are the root check to see if the scope exists
- if (tree.parent() == null && tree.nodeExists(scope))
- return containsKeys((IEclipsePreferences) tree.node(scope));
- // otherwise check to see if we are in the right scope
- if (scopeMatches(scope, tree) && containsKeys(tree))
- return true;
- continue;
- }
- // iterate over the list of declared nodes
- for (Iterator iter = mapping.keySet().iterator(); iter.hasNext();) {
- String nodePath = (String) iter.next();
- String nodeFullPath = '/' + scope + '/' + nodePath;
- // if this subtree isn't in a hierarchy we are interested in, then go to the next one
- if (!nodeFullPath.startsWith(treePath))
- continue;
- // get the child node
- String childPath = nodeFullPath.substring(treePath.length());
- childPath = EclipsePreferences.makeRelative(childPath);
- if (tree.nodeExists(childPath)) {
- PreferenceFilterEntry[] entries;
- // protect against wrong classes since this is user-code
- try {
- entries = (PreferenceFilterEntry[]) mapping.get(nodePath);
- } catch (ClassCastException e) {
- log(createStatusError(Messages.preferences_classCastFilterEntry, e));
- continue;
- }
- // if there are no entries defined then we return false even if we
- // are supposed to match on the existance of the node as a whole (bug 88820)
- Preferences child = tree.node(childPath);
- if (entries == null)
- return child.keys().length != 0 || child.childrenNames().length != 0;
- // otherwise check to see if we have any applicable keys
- for (int j = 0; j < entries.length; j++) {
- if (entries[j] != null && child.get(entries[j].getKey(), null) != null)
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.preferences.IPreferencesService#applyPreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences, org.eclipse.core.runtime.preferences.IPreferenceFilter[])
- */
- public void applyPreferences(IEclipsePreferences tree, IPreferenceFilter[] filters) throws CoreException {
- if (filters == null || filters.length == 0)
- return;
- try {
- internalApply(tree, filters);
- //this typically causes a major change to the preference tree, so force string sharing
- lastStringSharing = 0;
- shareStrings();
- } catch (BackingStoreException e) {
- throw new CoreException(createStatusError(Messages.preferences_applyProblems, e));
- }
- }
-
- /**
- * Filter the given tree so it only contains values which apply to the specified filters
- * then apply the resulting tree to the main preference tree.
- */
- private void internalApply(IEclipsePreferences tree, IPreferenceFilter[] filters) throws BackingStoreException {
- ArrayList trees = new ArrayList();
- for (int i = 0; i < filters.length; i++)
- trees.add(trimTree(tree, filters[i]));
- // merge the union of the matching filters
- IEclipsePreferences toApply = mergeTrees((IEclipsePreferences[]) trees.toArray(new IEclipsePreferences[trees.size()]));
-
- // fire an event to give people a chance to modify the tree
- toApply = firePreApplyEvent(toApply);
-
- // actually apply the settings
- IPreferenceNodeVisitor visitor = new IPreferenceNodeVisitor() {
- public boolean visit(IEclipsePreferences node) throws BackingStoreException {
- String[] keys = node.keys();
- if (keys.length == 0)
- return true;
- copyFromTo(node, getRootNode().node(node.absolutePath()), keys, 0);
- return true;
- }
- };
- toApply.accept(visitor);
- }
-
- /*
- * Give clients a chance to modify the tree before it is applied globally
- */
- private IEclipsePreferences firePreApplyEvent(IEclipsePreferences tree) {
- final IEclipsePreferences[] result = new IEclipsePreferences[] {tree};
- if (modifyListeners == null)
- initializeModifyListeners();
- Object[] listeners = modifyListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final PreferenceModifyListener listener = (PreferenceModifyListener) listeners[i];
- ISafeRunnable job = new ISafeRunnable() {
- public void handleException(Throwable exception) {
- // already logged in Platform#run()
- }
-
- public void run() throws Exception {
- result[0] = listener.preApply(result[0]);
- }
- };
- Platform.run(job);
- }
- return result[0];
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/RootPreferences.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/RootPreferences.java
deleted file mode 100644
index b356cfa..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/RootPreferences.java
+++ /dev/null
@@ -1,118 +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.preferences;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * @since 3.0
- */
-public class RootPreferences extends EclipsePreferences {
-
- /**
- * Default constructor.
- */
- public RootPreferences() {
- super(null, ""); //$NON-NLS-1$
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#flush()
- */
- public void flush() throws BackingStoreException {
- // flush all children
- BackingStoreException exception = null;
- String[] names = childrenNames();
- for (int i = 0; i < names.length; i++) {
- try {
- node(names[i]).flush();
- } catch (BackingStoreException e) {
- // store the first exception we get and still try and flush
- // the rest of the children.
- if (exception != null)
- exception = e;
- }
- }
- if (exception != null)
- throw exception;
- }
-
- /*
- * @see EclipsePreferences#getChild(String, Plugin)
- */
- protected synchronized IEclipsePreferences getChild(String key, Plugin context) {
- Object value = null;
- IEclipsePreferences child = null;
- if (children != null)
- value = children.get(key);
- if (value != null) {
- if (value instanceof IEclipsePreferences)
- return (IEclipsePreferences) value;
- //lazy initialization
- child = ((PreferencesService) Platform.getPreferencesService()).createNode(key);
- addChild(key, child);
- }
- return child;
- }
-
- /*
- * @see EclipsePreferences#getChildren()
- */
- protected synchronized IEclipsePreferences[] getChildren() {
- //must perform lazy initialization of child nodes
- String[] childNames = childrenNames();
- IEclipsePreferences[] childNodes = new IEclipsePreferences[childNames.length];
- for (int i = 0; i < childNames.length; i++)
- childNodes[i] = getChild(childNames[i], null);
- return childNodes;
- }
-
- /*
- * @see Preferences#node(String)
- */
- public Preferences node(String path) {
- if (path.length() == 0 || (path.length() == 1 && path.charAt(0) == IPath.SEPARATOR))
- return this;
- int startIndex = path.charAt(0) == IPath.SEPARATOR ? 1 : 0;
- int endIndex = path.indexOf(IPath.SEPARATOR, startIndex + 1);
- String scope = path.substring(startIndex, endIndex == -1 ? path.length() : endIndex);
- IEclipsePreferences child = getChild(scope, null);
- if (child == null) {
- child = new EclipsePreferences(this, scope);
- addChild(scope, child);
- }
- return child.node(endIndex == -1 ? "" : path.substring(endIndex + 1)); //$NON-NLS-1$
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#sync()
- */
- public void sync() throws BackingStoreException {
- // sync all children
- BackingStoreException exception = null;
- String[] names = childrenNames();
- for (int i = 0; i < names.length; i++) {
- try {
- node(names[i]).sync();
- } catch (BackingStoreException e) {
- // store the first exception we get and still try and sync
- // the rest of the children.
- if (exception != null)
- exception = e;
- }
- }
- if (exception != null)
- throw exception;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/StringPool.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/StringPool.java
deleted file mode 100644
index 5d361aa..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/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.preferences;
-
-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.runtime/src/org/eclipse/core/internal/registry/ConfigurationElement.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ConfigurationElement.java
deleted file mode 100644
index 57c94d7..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ConfigurationElement.java
+++ /dev/null
@@ -1,305 +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.registry;
-
-import java.util.Hashtable;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.internal.runtime.Messages;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.Bundle;
-
-/**
- * An object which represents the user-defined contents of an extension
- * in a plug-in manifest.
- */
-public class ConfigurationElement extends RegistryObject {
- static final ConfigurationElement[] EMPTY_ARRAY = new ConfigurationElement[0];
- static final int PLUGIN_ERROR = 1;
-
- //The id of the parent element. It can be a configuration element or an extension
- int parentId;
- byte parentType; //This value is only interesting when running from cache.
-
- //Store the properties and the value of the configuration element.
- //The format is the following:
- // [p1, v1, p2, v2, configurationElementValue]
- //If the array size is even, there is no "configurationElementValue (ie getValue returns null)".
- //The properties and their values are alternated (v1 is the value of p1).
- private String[] propertiesAndValue;
-
- //The name of the configuration element
- private String name;
-
- //The bundle from which classes will be loaded. It is never a fragment
- //This value can be null when the element is loaded from disk and the bundle has been uninstalled.
- //This happens when the configuration is obtained from a delta containing removed extension.
- private Bundle contributingBundle;
-
- ConfigurationElement() {
- //Nothing to do
- }
-
- ConfigurationElement(int self, Bundle bundle, String name, String[] propertiesAndValue, int[] children, int extraDataOffset, int parent, byte parentType) {
- setObjectId(self);
- contributingBundle = bundle;
- this.name = name;
- this.propertiesAndValue = propertiesAndValue;
- setRawChildren(children);
- this.extraDataOffset = extraDataOffset;
- parentId = parent;
- this.parentType = parentType;
- }
-
- Object createExecutableExtension(String attributeName) throws CoreException {
- String prop = null;
- String executable;
- String pluginName = null;
- String className = null;
- Object initData = null;
- int i;
-
- if (attributeName != null)
- prop = getAttribute(attributeName);
- else {
- // property not specified, try as element value
- prop = getValue();
- if (prop != null) {
- prop = prop.trim();
- if (prop.equals("")) //$NON-NLS-1$
- prop = null;
- }
- }
-
- if (prop == null) {
- // property not defined, try as a child element
- ConfigurationElement[] exec;
- ConfigurationElement[] parms;
- ConfigurationElement element;
- Hashtable initParms;
- String pname;
-
- exec = getChildren(attributeName);
- if (exec.length != 0) {
- element = exec[0]; // assumes single definition
- pluginName = element.getAttribute("plugin"); //$NON-NLS-1$
- className = element.getAttribute("class"); //$NON-NLS-1$
- parms = element.getChildren("parameter"); //$NON-NLS-1$
- if (parms.length != 0) {
- initParms = new Hashtable(parms.length + 1);
- for (i = 0; i < parms.length; i++) {
- pname = parms[i].getAttribute("name"); //$NON-NLS-1$
- if (pname != null)
- initParms.put(pname, parms[i].getAttribute("value")); //$NON-NLS-1$
- }
- if (!initParms.isEmpty())
- initData = initParms;
- }
- } else {
- // specified name is not a simple attribute nor child element
- throwException(NLS.bind(Messages.plugin_extDefNotFound, attributeName), null);
- }
- } else {
- // simple property or element value, parse it into its components
- i = prop.indexOf(':');
- if (i != -1) {
- executable = prop.substring(0, i).trim();
- initData = prop.substring(i + 1).trim();
- } else
- executable = prop;
-
- i = executable.indexOf('/');
- if (i != -1) {
- pluginName = executable.substring(0, i).trim();
- className = executable.substring(i + 1).trim();
- } else
- className = executable;
- }
-
- if (className == null || className.equals("")) //$NON-NLS-1$
- throwException(NLS.bind(Messages.plugin_extDefNoClass, attributeName), null);
- return createExecutableExtension(pluginName, className, initData, this, attributeName);
- }
-
- private Object createExecutableExtension(String pluginName, String className, Object initData, ConfigurationElement cfig, String propertyName) throws CoreException {
- if(contributingBundle==null) {
- throwException(NLS.bind(Messages.plugin_loadClassError, "UNKNOWN BUNDLE", className), new InvalidRegistryObjectException()); //$NON-NLS-1$
- }
- String id = contributingBundle.getSymbolicName(); // this plugin id check if we need to delegate to some other plugin
- if (pluginName != null && !pluginName.equals("") && !pluginName.equals(id)) { //$NON-NLS-1$
- Bundle otherBundle = null;
- otherBundle = InternalPlatform.getDefault().getBundle(pluginName);
- return createExecutableExtension(otherBundle, className, initData, cfig, propertyName);
- }
- return createExecutableExtension(contributingBundle, className, initData, cfig, propertyName);
- }
-
- private Object createExecutableExtension(Bundle bundle, String className, Object initData, ConfigurationElement cfig, String propertyName) throws CoreException {
- if(contributingBundle==null) {
- throwException(NLS.bind(Messages.plugin_loadClassError, "UNKNOWN BUNDLE", className), new InvalidRegistryObjectException()); //$NON-NLS-1$
- }
- // load the requested class from this plugin
- Class classInstance = null;
- try {
- classInstance = bundle.loadClass(className);
- } catch (Exception e1) {
- throwException(NLS.bind(Messages.plugin_loadClassError, bundle.getSymbolicName(), className), e1);
- } catch (LinkageError e) {
- throwException(NLS.bind(Messages.plugin_loadClassError, bundle.getSymbolicName(), className), e);
- }
-
- // create a new instance
- Object result = null;
- try {
- result = classInstance.newInstance();
- } catch (Exception e) {
- throwException(NLS.bind(Messages.plugin_instantiateClassError, bundle.getSymbolicName(), className), e);
- }
-
- // Check if we have extension adapter and initialize
- if (result instanceof IExecutableExtension) {
- try {
- // make the call even if the initialization string is null
- //TODO Need to change here the access to the registry manager
- IConfigurationElement cfigHandle = new ConfigurationElementHandle(((ExtensionRegistry)InternalPlatform.getDefault().getRegistry()).getObjectManager(), cfig.getObjectId());
- ((IExecutableExtension) result).setInitializationData(cfigHandle, propertyName, initData);
- } catch (CoreException ce) {
- // user code threw exception
- throw ce;
- } catch (Exception te) {
- // user code caused exception
- throwException(NLS.bind(Messages.plugin_initObjectError, bundle.getSymbolicName(), className), te);
- }
- }
-
- // Deal with executable extension factories.
- if (result instanceof IExecutableExtensionFactory) {
- result = ((IExecutableExtensionFactory) result).create();
- }
-
- return result;
- }
-
- private void throwException(String message, Throwable exception) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, Platform.PI_RUNTIME, PLUGIN_ERROR, message, exception));
- }
-
- String getValue() {
- return getValueAsIs();
- }
-
- String getValueAsIs() {
- if (propertiesAndValue.length != 0 && propertiesAndValue.length % 2 == 1)
- return propertiesAndValue[propertiesAndValue.length - 1];
- return null;
- }
-
- String getAttribute(String attrName) {
- return getAttributeAsIs(attrName);
- }
-
- String getAttributeAsIs(String attrName) {
- if (propertiesAndValue.length <= 1)
- return null;
- int size = propertiesAndValue.length - (propertiesAndValue.length % 2);
- for (int i = 0; i < size; i += 2) {
- if (propertiesAndValue[i].equals(attrName))
- return propertiesAndValue[i + 1];
- }
- return null;
- }
-
- String[] getAttributeNames() {
- if (propertiesAndValue.length <= 1)
- return RegistryObjectManager.EMPTY_STRING_ARRAY;
-
- int size = propertiesAndValue.length / 2;
- String[] result = new String[size];
- for (int i = 0; i < size; i++) {
- result[i] = propertiesAndValue[i * 2];
- }
- return result;
- }
-
- void setProperties(String[] value) {
- propertiesAndValue = value;
- }
-
- String[] getPropertiesAndValue() {
- return propertiesAndValue;
- }
-
- void setValue(String value) {
- if (propertiesAndValue.length == 0) {
- propertiesAndValue = new String[] {value};
- return;
- }
- if (propertiesAndValue.length % 2 == 1) {
- propertiesAndValue[propertiesAndValue.length - 1] = value;
- return;
- }
- String[] newPropertiesAndValue = new String[propertiesAndValue.length + 1];
- System.arraycopy(propertiesAndValue, 0, newPropertiesAndValue, 0, propertiesAndValue.length);
- newPropertiesAndValue[propertiesAndValue.length] = value;
- propertiesAndValue = newPropertiesAndValue;
- }
-
- void setContributingBundle(Bundle b) {
- contributingBundle = b;
- }
-
- Bundle getContributingBundle() {
- return contributingBundle;
- }
-
- ConfigurationElement[] getChildren(String childrenName) {
- if (getRawChildren().length == 0)
- return ConfigurationElement.EMPTY_ARRAY;
-
- ConfigurationElement[] result = new ConfigurationElement[1]; //Most of the time there is only one match
- int idx = 0;
- RegistryObjectManager objectManager = ((ExtensionRegistry)InternalPlatform.getDefault().getRegistry()).getObjectManager(); //TODO To change
- for (int i = 0; i < children.length; i++) {
- ConfigurationElement toTest = (ConfigurationElement) objectManager.getObject(children[i], extraDataOffset == -1 ? RegistryObjectManager.CONFIGURATION_ELEMENT : RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT);
- if (toTest.name.equals(childrenName)) {
- if (idx != 0) {
- ConfigurationElement[] copy = new ConfigurationElement[result.length + 1];
- System.arraycopy(result, 0, copy, 0, result.length);
- result = copy;
- }
- result[idx++] = toTest;
- }
- }
- if (idx == 0)
- result = ConfigurationElement.EMPTY_ARRAY;
- return result;
- }
-
- void setParentId(int objectId) {
- parentId = objectId;
- }
-
- String getName() {
- return name;
- }
-
- void setName(String name) {
- this.name = name;
- }
-
- void setParentType(byte type) {
- parentType = type;
- }
-
- String getNamespace() {
- return contributingBundle == null ? null : contributingBundle.getSymbolicName();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ConfigurationElementHandle.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ConfigurationElementHandle.java
deleted file mode 100644
index df50a2f..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ConfigurationElementHandle.java
+++ /dev/null
@@ -1,126 +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.registry;
-
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.*;
-
-/**
- * @since 3.1
- */
-public class ConfigurationElementHandle extends Handle implements IConfigurationElement {
- static final ConfigurationElementHandle[] EMPTY_ARRAY = new ConfigurationElementHandle[0];
-
- public ConfigurationElementHandle(IObjectManager objectManager, int id) {
- super(objectManager, id);
- }
-
- protected ConfigurationElement getConfigurationElement() {
- return (ConfigurationElement) objectManager.getObject(getId(), RegistryObjectManager.CONFIGURATION_ELEMENT);
- }
-
- public String getAttribute(String propertyName) {
- return getConfigurationElement().getAttribute(propertyName);
- }
-
- public String[] getAttributeNames() {
- return getConfigurationElement().getAttributeNames();
- }
-
- public IConfigurationElement[] getChildren() {
- ConfigurationElement actualCe = getConfigurationElement();
- if (actualCe.extraDataOffset == -1) {
- return (IConfigurationElement[]) objectManager.getHandles(actualCe.getRawChildren(), RegistryObjectManager.CONFIGURATION_ELEMENT);
- }
- return (IConfigurationElement[]) objectManager.getHandles(actualCe.getRawChildren(), RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT);
- }
-
- public Object createExecutableExtension(String propertyName) throws CoreException {
- try {
- return getConfigurationElement().createExecutableExtension(propertyName);
- } catch (InvalidRegistryObjectException e) {
- Status status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, ConfigurationElement.PLUGIN_ERROR, "Invalid registry object", e); //$NON-NLS-1$
- InternalPlatform.getDefault().getLog(InternalPlatform.getDefault().getBundleContext().getBundle()).log(status);
- throw new CoreException(status);
- }
- }
-
- public String getAttributeAsIs(String name) {
- return getConfigurationElement().getAttributeAsIs(name);
- }
-
- public IConfigurationElement[] getChildren(String name) {
- ConfigurationElement actualCE = getConfigurationElement();
- ConfigurationElement[] children = (ConfigurationElement[]) objectManager.getObjects(actualCE.getRawChildren(), actualCE.extraDataOffset == -1 ? RegistryObjectManager.CONFIGURATION_ELEMENT : RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT);
- if (children.length == 0)
- return ConfigurationElementHandle.EMPTY_ARRAY;
-
- IConfigurationElement[] result = new IConfigurationElement[1];
- int idx = 0;
- for (int i = 0; i < children.length; i++) {
- if (children[i].getName().equals(name)) {
- if (idx != 0) {
- IConfigurationElement[] copy = new IConfigurationElement[result.length + 1];
- System.arraycopy(result, 0, copy, 0, result.length);
- result = copy;
- }
- result[idx++] = (IConfigurationElement) objectManager.getHandle(children[i].getObjectId(), actualCE.extraDataOffset == -1 ? RegistryObjectManager.CONFIGURATION_ELEMENT : RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT);
- }
- }
- if (idx == 0)
- return ConfigurationElementHandle.EMPTY_ARRAY;
- return result;
- }
-
- public IExtension getDeclaringExtension() {
- Object result = this;
- while (!((result = ((ConfigurationElementHandle) result).getParent()) instanceof ExtensionHandle)) { /*do nothing*/
- }
- return (IExtension) result;
- }
-
- public String getName() {
- return getConfigurationElement().getName();
- }
-
- public Object getParent() {
- ConfigurationElement actualCe = getConfigurationElement();
- return objectManager.getHandle(actualCe.parentId, actualCe.parentType);
- }
-
- public String getValue() {
- return getConfigurationElement().getValue();
- }
-
- public String getValueAsIs() {
- return getConfigurationElement().getValueAsIs();
- }
-
- RegistryObject getObject() {
- return getConfigurationElement();
- }
-
- public String getNamespace() {
- String result = getConfigurationElement().getNamespace();
- if (result == null)
- return getDeclaringExtension().getNamespace();
- return result;
- }
-
- public boolean isValid() {
- try {
- getConfigurationElement();
- } catch (InvalidRegistryObjectException e) {
- return false;
- }
- return true;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/Contribution.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/Contribution.java
deleted file mode 100644
index 9e23897..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/Contribution.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.Platform;
-import org.osgi.framework.Bundle;
-
-// This object is used to keep track on a bundle basis of the extension and extension points being contributed.
-// It is mainly used on removal so we can quickly find objects to remove.
-// Each contribution is made in the context of a namespace. For a regular bundle, the namespace is the symbolic name of the bundle, whereas for a fragment it is the name of its host.
-public class Contribution implements KeyedElement {
- static final int[] EMPTY_CHILDREN = new int[] {0, 0};
-
- // The actual bundle contributing the object.
- private Bundle contributingBundle;
- private long contributingBundleId;
-
- // This array stores the identifiers of both the extension points and the extensions.
- // The array has always a minimum size of 2.
- // The first element of the array is the number of extension points and the second the number of extensions.
- // [numberOfExtensionPoints, numberOfExtensions, extensionPoint#1, extensionPoint#2, extensionPoint..., ext#1, ext#2, ext#3, ... ].
- // The size of the array is 2 + (numberOfExtensionPoints + numberOfExtensions).
- private int[] children = EMPTY_CHILDREN;
- static final byte EXTENSION_POINT = 0;
- static final byte EXTENSION = 1;
-
- Contribution(Bundle bundle) {
- contributingBundle = bundle;
- contributingBundleId = bundle.getBundleId();
- }
-
- Contribution(long id) {
- contributingBundleId = id;
- contributingBundle = InternalPlatform.getDefault().getBundleContext().getBundle(contributingBundleId);
- }
-
- void setRawChildren(int[] children) {
- this.children = children;
- }
-
- int[] getRawChildren() {
- return children;
- }
-
- int[] getExtensions() {
- int[] results = new int[children[EXTENSION]];
- System.arraycopy(children, 2 + children[EXTENSION_POINT], results, 0, children[EXTENSION]);
- return results;
- }
-
- Bundle getContributingBundle() {
- return contributingBundle;
- }
-
- int[] getExtensionPoints() {
- int[] results = new int[children[EXTENSION_POINT]];
- System.arraycopy(children, 2, results, 0, children[EXTENSION_POINT]);
- return results;
- }
-
- String getNamespace() {
- if (contributingBundle == null) // When restored from disk the underlying bundle may have been uninstalled
- throw new IllegalStateException("Internal error in extension registry. The bundle corresponding to this contribution has been uninstalled."); //$NON-NLS-1$
- if (Platform.isFragment(contributingBundle))
- return Platform.getHosts(contributingBundle)[0].getSymbolicName();
- return contributingBundle.getSymbolicName();
- }
-
- public String toString() {
- return "Contribution: " + contributingBundleId + " in namespace" + getNamespace(); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- Bundle getNamespaceBundle() {
- if (contributingBundle == null) // When restored from disk the underlying bundle may have been uninstalled
- throw new IllegalStateException("Internal error in extension registry. The bundle corresponding to this contribution has been uninstalled."); //$NON-NLS-1$
- if (Platform.isFragment(contributingBundle))
- return Platform.getHosts(contributingBundle)[0];
- return contributingBundle;
- }
-
- //Implements the KeyedElement interface
- public int getKeyHashCode() {
- return getKey().hashCode();
- }
-
- public Object getKey() {
- return new Long(contributingBundleId);
- }
-
- public boolean compare(KeyedElement other) {
- return contributingBundleId == ((Contribution) other).contributingBundleId;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/EclipseBundleListener.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/EclipseBundleListener.java
deleted file mode 100644
index 0bdc966..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/EclipseBundleListener.java
+++ /dev/null
@@ -1,223 +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.registry;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.*;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
-import org.eclipse.core.internal.runtime.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.ManifestElement;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.*;
-import org.osgi.util.tracker.ServiceTracker;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * A listener for bundle events. When a bundles come and go we look to see
- * if there are any extensions or extension points and update the registry accordingly.
- * Using a Synchronous listener here is important. If the
- * bundle activator code tries to access the registry to get its extension
- * points, we need to ensure that they are in the registry before the
- * bundle start is called. By listening sync we are able to ensure that
- * happens.
- */
-public class EclipseBundleListener implements SynchronousBundleListener {
- private static final String PLUGIN_MANIFEST = "plugin.xml"; //$NON-NLS-1$
- private static final String FRAGMENT_MANIFEST = "fragment.xml"; //$NON-NLS-1$
-
- private ExtensionRegistry registry;
- private ServiceTracker xmlTracker;
-
- public EclipseBundleListener(ExtensionRegistry registry) {
- this.registry = registry;
- xmlTracker = new ServiceTracker(InternalPlatform.getDefault().getBundleContext(), SAXParserFactory.class.getName(), null);
- xmlTracker.open();
- }
-
- public void bundleChanged(BundleEvent event) {
- /* Only should listen for RESOLVED and UNRESOLVED events.
- *
- * When a bundle is updated the Framework will publish an UNRESOLVED and
- * then a RESOLVED event which should cause the bundle to be removed
- * and then added back into the registry.
- *
- * When a bundle is uninstalled the Framework should publish an UNRESOLVED
- * event and then an UNINSTALLED event so the bundle will have been removed
- * by the UNRESOLVED event before the UNINSTALLED event is published.
- *
- * When a bundle is refreshed from PackageAdmin an UNRESOLVED event will be
- * published which will remove the bundle from the registry. If the bundle
- * can be RESOLVED after a refresh then a RESOLVED event will be published
- * which will add the bundle back. This is required because the classloader
- * will have been refreshed for the bundle so all extensions and extension
- * points for the bundle must be refreshed.
- */
- Bundle bundle = event.getBundle();
- switch (event.getType()) {
- case BundleEvent.RESOLVED :
- addBundle(bundle);
- break;
- case BundleEvent.UNRESOLVED :
- removeBundle(bundle);
- break;
- }
- }
-
- public void processBundles(Bundle[] bundles) {
- for (int i = 0; i < bundles.length; i++) {
- if (isBundleResolved(bundles[i]))
- addBundle(bundles[i]);
- else
- removeBundle(bundles[i]);
- }
- }
-
- private boolean isBundleResolved(Bundle bundle) {
- return (bundle.getState() & (Bundle.RESOLVED | Bundle.ACTIVE | Bundle.STARTING | Bundle.STOPPING)) != 0;
- }
-
- private void removeBundle(Bundle bundle) {
- registry.remove(bundle.getBundleId());
- }
-
- private void addBundle(Bundle bundle) {
- // if the given bundle already exists in the registry then return.
- // note that this does not work for update cases.
- if (registry.hasNamespace(bundle.getBundleId()))
- return;
- Contribution bundleModel = getBundleModel(bundle);
- if (bundleModel == null)
- return;
- // bug 70941
- // need to ensure we can find resource bundles from fragments
- if (Platform.PI_RUNTIME.equals(bundleModel.getNamespace()))
- Messages.reloadMessages();
- // Do not synchronize on registry here because the registry handles
- // the synchronization for us in registry.add
- registry.add(bundleModel);
- }
-
- private boolean isSingleton(Bundle bundle) {
- Dictionary allHeaders = bundle.getHeaders(""); //$NON-NLS-1$
- String symbolicNameHeader = (String) allHeaders.get(Constants.BUNDLE_SYMBOLICNAME);
- try {
- if (symbolicNameHeader != null) {
- ManifestElement[] symbolicNameElements = ManifestElement.parseHeader(Constants.BUNDLE_SYMBOLICNAME, symbolicNameHeader);
- if (symbolicNameElements.length > 0) {
- String singleton = symbolicNameElements[0].getDirective(Constants.SINGLETON_DIRECTIVE);
- if (singleton == null)
- singleton = symbolicNameElements[0].getAttribute(Constants.SINGLETON_DIRECTIVE);
-
- if (!"true".equalsIgnoreCase(singleton)) { //$NON-NLS-1$
- int status = IStatus.INFO;
- String manifestVersion = (String) allHeaders.get(org.osgi.framework.Constants.BUNDLE_MANIFESTVERSION);
- if (manifestVersion == null) {//the header was not defined for previous versions of the bundle
- //3.0 bundles without a singleton attributes are still being accepted
- if (InternalPlatform.getDefault().getBundle(symbolicNameElements[0].getValue()) == bundle) {
- return true;
- }
- status = IStatus.ERROR;
- }
- if (InternalPlatform.DEBUG_REGISTRY || status == IStatus.ERROR) {
- String message = NLS.bind(Messages.parse_nonSingleton, bundle.getLocation());
- InternalPlatform.getDefault().log(new Status(status, Platform.PI_RUNTIME, 0, message, null));
- }
- return false;
- }
- }
- }
- } catch (BundleException e1) {
- //This can't happen because the fwk would have rejected the bundle
- }
- return true;
- }
-
- /**
- * Tries to create a bundle model from a plugin/fragment manifest in the bundle.
- */
- private Contribution getBundleModel(Bundle bundle) {
- // bail out if system bundle
- if (bundle.getBundleId() == 0)
- return null;
- // bail out if the bundle does not have a symbolic name
- if (bundle.getSymbolicName() == null)
- return null;
-
- //If the bundle is not a singleton, then it is not added
- if (!isSingleton(bundle))
- return null;
-
- boolean isFragment = InternalPlatform.getDefault().isFragment(bundle);
-
- //If the bundle is a fragment being added to a non singleton host, then it is not added
- if (isFragment) {
- Bundle[] hosts = InternalPlatform.getDefault().getHosts(bundle);
- if (hosts != null && isSingleton(hosts[0]) == false)
- return null;
- }
-
- InputStream is = null;
- String manifestType = null;
- String manifestName = isFragment ? FRAGMENT_MANIFEST : PLUGIN_MANIFEST;
- try {
- URL url = bundle.getEntry(manifestName);
- if (url != null) {
- is = url.openStream();
- manifestType = isFragment ? ExtensionsParser.FRAGMENT : ExtensionsParser.PLUGIN;
- }
- } catch (IOException ex) {
- is = null;
- }
- if (is == null)
- return null;
- try {
- String message = NLS.bind(Messages.parse_problems, bundle.getLocation());
- MultiStatus problems = new MultiStatus(Platform.PI_RUNTIME, ExtensionsParser.PARSE_PROBLEM, message, null);
- ResourceBundle b = null;
- try {
- b = ResourceTranslator.getResourceBundle(bundle);
- } catch (MissingResourceException e) {
- //Ignore the exception
- }
- ExtensionsParser parser = new ExtensionsParser(problems);
- Contribution bundleModel = new Contribution(bundle);
- parser.parseManifest(xmlTracker, new InputSource(is), manifestType, manifestName, registry.getObjectManager(), bundleModel, b);
- if (problems.getSeverity() != IStatus.OK)
- InternalPlatform.getDefault().log(problems);
- return bundleModel;
- } catch (ParserConfigurationException e) {
- logParsingError(bundle, e);
- return null;
- } catch (SAXException e) {
- logParsingError(bundle, e);
- return null;
- } catch (IOException e) {
- logParsingError(bundle, e);
- return null;
- } finally {
- try {
- is.close();
- } catch (IOException ioe) {
- // nothing to do
- }
- }
- }
-
- private void logParsingError(Bundle bundle, Exception e) {
- String message = NLS.bind(Messages.parse_failedParsingManifest, bundle.getLocation());
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, 0, message, e));
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/Extension.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/Extension.java
deleted file mode 100644
index 0ca4cf7..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/Extension.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import java.lang.ref.SoftReference;
-import org.eclipse.core.internal.runtime.CompatibilityHelper;
-import org.eclipse.core.internal.runtime.Policy;
-import org.eclipse.core.runtime.Platform;
-import org.osgi.framework.Bundle;
-
-/**
- * An object which represents the user-defined extension in a plug-in manifest.
- */
-public class Extension extends RegistryObject {
- public static final Extension[] EMPTY_ARRAY = new Extension[0];
-
- //Extension simple identifier
- private String simpleId;
- //The namespace for the extension. For fragments the namespace is the namespace of the host bundle.
- private String namespace;
-
- // Place holder for the label and the extension point. It contains either a String[] or a SoftReference to a String[].
- //The array layout is [label, extension point name]
- private Object extraInformation;
- private static final byte LABEL = 0; //The human readable name of the extension
- private static final byte XPT_NAME = 1; // The fully qualified name of the extension point to which this extension is attached to
- private static final int EXTRA_SIZE = 2;
-
- Extension() {
- //nothing to do
- }
-
- Extension(int self, String simpleId, String namespace, int[] children, int extraData) {
- setObjectId(self);
- this.simpleId = simpleId;
- setRawChildren(children);
- this.extraDataOffset = extraData;
- this.namespace = namespace;
- }
-
- String getExtensionPointIdentifier() {
- return getExtraData()[XPT_NAME];
- }
-
- String getSimpleIdentifier() {
- return simpleId;
- }
-
- String getUniqueIdentifier() {
- return simpleId == null ? null : this.getNamespace() + '.' + simpleId;
- }
-
- void setExtensionPointIdentifier(String value) {
- ensureExtraInformationType();
- ((String[]) extraInformation)[XPT_NAME] = value;
- }
-
- void setSimpleIdentifier(String value) {
- simpleId = value;
- }
-
- private String[] getExtraData() {
- //The extension has been created by parsing, or does not have any extra data
- if (extraDataOffset == -1) {
- if (extraInformation != null)
- return (String[]) extraInformation;
- return null;
- }
-
- //The extension has been loaded from the cache.
- String[] result = null;
- if (extraInformation == null || (result = ((extraInformation instanceof SoftReference) ? (String[]) ((SoftReference) extraInformation).get() : (String[]) extraInformation)) == null) {
- result = new TableReader().loadExtensionExtraData(extraDataOffset);
- extraInformation = new SoftReference(result);
- }
- return result;
- }
-
- String getLabel() {
- String s = getExtraData()[LABEL];
- if (s == null)
- return ""; //$NON-NLS-1$
- return s;
- }
-
- void setLabel(String value) {
- ensureExtraInformationType();
- ((String[]) extraInformation)[LABEL] = value;
- }
-
- String getNamespace() {
- return namespace;
- }
-
- void setNamespace(String value) {
- namespace = value;
- }
-
- public String toString() {
- return getUniqueIdentifier() + " -> " + getExtensionPointIdentifier(); //$NON-NLS-1$
- }
-
- /**
- * @deprecated
- */
- org.eclipse.core.runtime.IPluginDescriptor getDeclaringPluginDescriptor() {
- org.eclipse.core.runtime.IPluginDescriptor result = CompatibilityHelper.getPluginDescriptor(getNamespace());
- if (result == null) {
- Bundle underlyingBundle = Platform.getBundle(getNamespace());
- if (underlyingBundle != null) {
- Bundle[] hosts = Platform.getHosts(underlyingBundle);
- if (hosts != null)
- result = CompatibilityHelper.getPluginDescriptor(hosts[0].getSymbolicName());
- }
- }
- if (CompatibilityHelper.DEBUG && result == null)
- Policy.debug("Could not obtain plug-in descriptor for bundle " + getNamespace()); //$NON-NLS-1$
- return result;
- }
-
- /**
- * At the end of this method, extra information will be a string[]
- */
- private void ensureExtraInformationType() {
- if (extraInformation instanceof SoftReference) {
- extraInformation = ((SoftReference) extraInformation).get();
- }
- if (extraInformation == null) {
- extraInformation = new String[EXTRA_SIZE];
- }
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionDelta.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionDelta.java
deleted file mode 100644
index e5068f4..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionDelta.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import org.eclipse.core.runtime.*;
-
-public class ExtensionDelta implements IExtensionDelta {
- private int kind;
- private int extension;
- private int extensionPoint;
- private RegistryDelta containingDelta;
-
- void setContainingDelta(RegistryDelta containingDelta) {
- this.containingDelta = containingDelta;
- }
- int getExtensionId() {
- return extension;
- }
-
- int getExtensionPointId() {
- return extensionPoint;
- }
-
- public IExtensionPoint getExtensionPoint() {
- return new ExtensionPointHandle(containingDelta.getObjectManager(), extensionPoint);
- }
-
- public void setExtensionPoint(int extensionPoint) {
- this.extensionPoint = extensionPoint;
- }
-
- public int getKind() {
- return kind;
- }
-
- public IExtension getExtension() {
- return new ExtensionHandle(containingDelta.getObjectManager(), extension);
- }
-
- public void setExtension(int extension) {
- this.extension = extension;
- }
-
- public void setKind(int kind) {
- this.kind = kind;
- }
-
- public String toString() {
- return "\n\t\t" + getExtensionPoint().getUniqueIdentifier() + " - " + getExtension().getNamespace() + '.' + getExtension().getSimpleIdentifier() + " (" + getKindString(this.getKind()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
-
- public static String getKindString(int kind) {
- switch (kind) {
- case ADDED :
- return "ADDED"; //$NON-NLS-1$
- case REMOVED :
- return "REMOVED"; //$NON-NLS-1$
- }
- return "UNKNOWN"; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionHandle.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionHandle.java
deleted file mode 100644
index 74653bd..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionHandle.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import org.eclipse.core.runtime.*;
-
-/**
- * @since 3.1
- */
-public class ExtensionHandle extends Handle implements IExtension {
- static final ExtensionHandle[] EMPTY_ARRAY = new ExtensionHandle[0];
-
- public ExtensionHandle(IObjectManager objectManager, int id) {
- super(objectManager, id);
- }
-
- private Extension getExtension() {
- return (Extension) objectManager.getObject(getId(), RegistryObjectManager.EXTENSION);
- }
-
- /**
- * @deprecated
- */
- public IPluginDescriptor getDeclaringPluginDescriptor() {
- return getExtension().getDeclaringPluginDescriptor();
- }
-
- public String getNamespace() {
- return getExtension().getNamespace();
- }
-
- public String getExtensionPointUniqueIdentifier() {
- return getExtension().getExtensionPointIdentifier();
- }
-
- public String getLabel() {
- return getExtension().getLabel();
- }
-
- public String getSimpleIdentifier() {
- return getExtension().getSimpleIdentifier();
- }
-
- public String getUniqueIdentifier() {
- return getExtension().getUniqueIdentifier();
- }
-
- public IConfigurationElement[] getConfigurationElements() {
- return (IConfigurationElement[]) objectManager.getHandles(getExtension().getRawChildren(), RegistryObjectManager.CONFIGURATION_ELEMENT);
- }
-
- RegistryObject getObject() {
- return getExtension();
- }
-
- public boolean isValid() {
- try {
- getExtension();
- } catch (InvalidRegistryObjectException e) {
- return false;
- }
- return true;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionPoint.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionPoint.java
deleted file mode 100644
index 3c4730b..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionPoint.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import java.io.File;
-import java.lang.ref.SoftReference;
-
-/**
- * An object which represents the user-defined extension point in a
- * plug-in manifest.
- */
-public class ExtensionPoint extends RegistryObject {
- public static final ExtensionPoint[] EMPTY_ARRAY = new ExtensionPoint[0];
-
- //Place holder for the label and the schema. It contains either a String[] or a SoftReference to a String[].
- //The array layout is [label, schemaReference, fullyQualifiedName, namespace, bundleId]
- private Object extraInformation;
- //Indexes of the various fields
- private static final byte LABEL = 0; //The human readable name for the extension point
- private static final byte SCHEMA = 1; //The schema of the extension point
- private static final byte QUALIFIED_NAME = 2; //The fully qualified name of the extension point
- private static final byte NAMESPACE = 3; //The name of the bundle contributing the extension point
- private static final byte BUNDLEID = 4; //The bundle contributing the extension point
- private static final int EXTRA_SIZE = 5;
-
- ExtensionPoint() {
- //Nothing to do
- }
-
- ExtensionPoint(int self, int[] children, int dataOffset) {
- setObjectId(self);
- setRawChildren(children);
- extraDataOffset = dataOffset;
- }
-
- String getSimpleIdentifier() {
- return getUniqueIdentifier().substring(getUniqueIdentifier().lastIndexOf('.') + 1);
- }
-
-
- private String[] getExtraData() {
- //The extension point has been created by parsing, or does not have any extra data
- if (extraDataOffset == -1) { //When this is true, the extraInformation is always a String[]. This happens when the object is created by the parser.
- if (extraInformation != null)
- return (String[]) extraInformation;
- return new String[EXTRA_SIZE];
- }
-
- //The extension point has been loaded from the cache.
- String[] result = null;
- if (extraInformation == null || (result = ((extraInformation instanceof SoftReference) ? (String[]) ((SoftReference) extraInformation).get() : (String[]) extraInformation)) == null) {
- result = new TableReader().loadExtensionPointExtraData(extraDataOffset);
- extraInformation = new SoftReference(result);
- }
- return result;
- }
-
- /**
- * At the end of this method, extra information will be a string[]
- */
- private void ensureExtraInformationType() {
- if (extraInformation instanceof SoftReference) {
- extraInformation = ((SoftReference) extraInformation).get();
- }
- if (extraInformation == null) {
- extraInformation = new String[EXTRA_SIZE];
- }
- }
-
- String getSchemaReference() {
- String[] result = getExtraData();
- return result[1] == null ? "" : result[SCHEMA].replace(File.separatorChar, '/'); //$NON-NLS-1$
- }
-
- String getLabel() {
- String[] result = getExtraData();
- return result[0] == null ? "" : result[LABEL]; //$NON-NLS-1$
- }
-
- String getUniqueIdentifier() {
- return getExtraData()[QUALIFIED_NAME];
- }
-
- String getNamespace() {
- return getExtraData()[NAMESPACE];
- }
-
- long getBundleId() {
- return Long.parseLong(getExtraData()[BUNDLEID]);
- }
-
- void setSchema(String value) {
- ensureExtraInformationType();
- ((String[]) extraInformation)[SCHEMA] = value;
- }
-
- void setLabel(String value) {
- ensureExtraInformationType();
- ((String[]) extraInformation)[LABEL] = value;
- }
-
- void setUniqueIdentifier(String value) {
- ensureExtraInformationType();
- ((String[]) extraInformation)[QUALIFIED_NAME] = value;
- }
-
- void setNamespace(String value) {
- ensureExtraInformationType();
- ((String[]) extraInformation)[NAMESPACE] = value;
- }
-
- void setBundleId(long id) {
- ensureExtraInformationType();
- ((String[]) extraInformation)[BUNDLEID] = Long.toString(id);
- }
-
- public String toString() {
- return getUniqueIdentifier();
- }
-
- /**
- * @deprecated
- */
- public org.eclipse.core.runtime.IPluginDescriptor getDeclaringPluginDescriptor() {
- return org.eclipse.core.internal.runtime.CompatibilityHelper.getPluginDescriptor(getNamespace());
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionPointHandle.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionPointHandle.java
deleted file mode 100644
index 975ea8e..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionPointHandle.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import org.eclipse.core.runtime.*;
-
-/**
- * @since 3.1
- */
-public class ExtensionPointHandle extends Handle implements IExtensionPoint {
- static final ExtensionPointHandle[] EMPTY_ARRAY = new ExtensionPointHandle[0];
-
- public ExtensionPointHandle(IObjectManager objectManager, int id) {
- super(objectManager, id);
- }
-
- public IExtension[] getExtensions() {
- return (IExtension[]) objectManager.getHandles(getExtensionPoint().getRawChildren(), RegistryObjectManager.EXTENSION);
- }
-
- /**
- * @deprecated
- */
- public IPluginDescriptor getDeclaringPluginDescriptor() {
- return getExtensionPoint().getDeclaringPluginDescriptor();
- }
-
- public String getNamespace() {
- return getExtensionPoint().getNamespace();
- }
-
- public IExtension getExtension(String extensionId) {
- if (extensionId == null)
- return null;
- int[] children = getExtensionPoint().getRawChildren();
- for (int i = 0; i < children.length; i++) {
- // Here we directly get the object because it avoids the creation of garbage and because we'll need the object anyway to compare the value
- if (extensionId.equals(((Extension) objectManager.getObject(children[i], RegistryObjectManager.EXTENSION)).getUniqueIdentifier()))
- return (ExtensionHandle) objectManager.getHandle(children[i], RegistryObjectManager.EXTENSION);
- }
- return null;
- }
-
- public IConfigurationElement[] getConfigurationElements() {
- //get the actual extension objects since we'll need to get the configuration elements information.
- Extension[] tmpExtensions = (Extension[]) objectManager.getObjects(getExtensionPoint().getRawChildren(), RegistryObjectManager.EXTENSION);
- if (tmpExtensions.length == 0)
- return ConfigurationElementHandle.EMPTY_ARRAY;
-
- ArrayList result = new ArrayList();
- for (int i = 0; i < tmpExtensions.length; i++) {
- result.addAll(Arrays.asList(objectManager.getHandles(tmpExtensions[i].getRawChildren(), RegistryObjectManager.CONFIGURATION_ELEMENT)));
- }
- return (IConfigurationElement[]) result.toArray(new IConfigurationElement[result.size()]);
- }
-
- public String getLabel() {
- return getExtensionPoint().getLabel();
- }
-
- public String getSchemaReference() {
- return getExtensionPoint().getSchemaReference();
- }
-
- public String getSimpleIdentifier() {
- return getExtensionPoint().getSimpleIdentifier();
- }
-
- public String getUniqueIdentifier() {
- return getExtensionPoint().getUniqueIdentifier();
- }
-
- RegistryObject getObject() {
- return getExtensionPoint();
- }
-
- private ExtensionPoint getExtensionPoint() {
- return (ExtensionPoint) objectManager.getObject(getId(), RegistryObjectManager.EXTENSION_POINT);
- }
-
- public boolean isValid() {
- try {
- getExtensionPoint();
- } catch (InvalidRegistryObjectException e) {
- return false;
- }
- return true;
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionRegistry.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionRegistry.java
deleted file mode 100644
index c30dc53..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionRegistry.java
+++ /dev/null
@@ -1,773 +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.registry;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Array;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.*;
-import org.eclipse.core.internal.runtime.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.adaptor.FileManager;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osgi.service.datalocation.Location;
-import org.osgi.framework.Bundle;
-
-/**
- * An implementation for the extension registry API.
- */
-public class ExtensionRegistry implements IExtensionRegistry {
- private EclipseBundleListener pluginBundleListener;
-
- private final static class ExtensionEventDispatcherJob extends Job {
- // an "identy rule" that forces extension events to be queued
- private final static ISchedulingRule EXTENSION_EVENT_RULE = new ISchedulingRule() {
- public boolean contains(ISchedulingRule rule) {
- return rule == this;
- }
-
- public boolean isConflicting(ISchedulingRule rule) {
- return rule == this;
- }
- };
- private Map deltas;
- private Object[] listenerInfos;
-
- public ExtensionEventDispatcherJob(Object[] listenerInfos, Map deltas) {
- // name not NL'd since it is a system job
- super("Registry event dispatcher"); //$NON-NLS-1$
- setSystem(true);
- this.listenerInfos = listenerInfos;
- this.deltas = deltas;
- // all extension event dispatching jobs use this rule
- setRule(EXTENSION_EVENT_RULE);
- }
-
- public IStatus run(IProgressMonitor monitor) {
- MultiStatus result = new MultiStatus(Platform.PI_RUNTIME, IStatus.OK, Messages.plugin_eventListenerError, null);
- for (int i = 0; i < listenerInfos.length; i++) {
- ListenerInfo listenerInfo = (ListenerInfo) listenerInfos[i];
- if (listenerInfo.filter != null && !deltas.containsKey(listenerInfo.filter))
- continue;
- try {
- listenerInfo.listener.registryChanged(new RegistryChangeEvent(deltas, listenerInfo.filter));
- } catch (RuntimeException re) {
- String message = re.getMessage() == null ? "" : re.getMessage(); //$NON-NLS-1$
- result.add(new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.OK, message, re));
- }
- }
- for (Iterator iter = deltas.values().iterator(); iter.hasNext();) {
- ((RegistryDelta) iter.next()).getObjectManager().close();
- }
- return result;
- }
- }
-
- class ListenerInfo {
- String filter;
- IRegistryChangeListener listener;
-
- public ListenerInfo(IRegistryChangeListener listener, String filter) {
- this.listener = listener;
- this.filter = filter;
- }
-
- /**
- * Used by ListenerList to ensure uniqueness.
- */
- public boolean equals(Object another) {
- return another instanceof ListenerInfo && ((ListenerInfo) another).listener == this.listener;
- }
- }
-
- public static boolean DEBUG;
-
- private static final String OPTION_DEBUG_EVENTS_EXTENSION = "org.eclipse.core.runtime/registry/debug/events/extension"; //$NON-NLS-1$
-
- // used to enforce concurrent access policy for readers/writers
- private ReadWriteMonitor access = new ReadWriteMonitor();
-
- // deltas not broadcasted yet. Deltas are kept organized by bundle name (fragments go with their host)
- private transient Map deltas = new HashMap(11);
-
- //file manager associated with the registry
- private FileManager currentFileManager = null;
-
- // all registry change listeners
- private transient ListenerList listeners = new ListenerList();
-
- private RegistryObjectManager registryObjects = null;
-
- RegistryObjectManager getObjectManager() {
- return registryObjects;
- }
-
- /**
- * Adds and resolves all extensions and extension points provided by the
- * plug-in.
- * <p>
- * A corresponding IRegistryChangeEvent will be broadcast to all listeners
- * interested on changes in the given plug-in.
- * </p>
- */
- public void add(Contribution element) {
- access.enterWrite();
- try {
- basicAdd(element, true);
- fireRegistryChangeEvent();
- } finally {
- access.exitWrite();
- }
- }
-
- public void add(Contribution[] elements) {
- access.enterWrite();
- try {
- for (int i = 0; i < elements.length; i++)
- basicAdd(elements[i], true);
- fireRegistryChangeEvent();
- } finally {
- access.exitWrite();
- }
- }
-
- /* Utility method to help with array concatenations */
- static Object concatArrays(Object a, Object b) {
- Object[] result = (Object[]) Array.newInstance(a.getClass().getComponentType(), Array.getLength(a) + Array.getLength(b));
- System.arraycopy(a, 0, result, 0, Array.getLength(a));
- System.arraycopy(b, 0, result, Array.getLength(a), Array.getLength(b));
- return result;
- }
-
- private String addExtension(int extension) {
- Extension addedExtension = (Extension) registryObjects.getObject(extension, RegistryObjectManager.EXTENSION);
- String extensionPointToAddTo = addedExtension.getExtensionPointIdentifier();
- ExtensionPoint extPoint = registryObjects.getExtensionPointObject(extensionPointToAddTo);
- //orphan extension
- if (extPoint == null) {
- registryObjects.addOrphan(extensionPointToAddTo, extension);
- return null;
- }
- // otherwise, link them
- int[] newExtensions;
- int[] existingExtensions = extPoint.getRawChildren();
- newExtensions = new int[existingExtensions.length + 1];
- System.arraycopy(existingExtensions, 0, newExtensions, 0, existingExtensions.length);
- newExtensions[newExtensions.length - 1] = extension;
- link(extPoint, newExtensions);
- return recordChange(extPoint, extension, IExtensionDelta.ADDED);
- }
-
- /**
- * Looks for existing orphan extensions to connect to the given extension
- * point. If none is found, there is nothing to do. Otherwise, link them.
- */
- private String addExtensionPoint(int extPoint) {
- ExtensionPoint extensionPoint = (ExtensionPoint) registryObjects.getObject(extPoint, RegistryObjectManager.EXTENSION_POINT);
- int[] orphans = registryObjects.removeOrphans(extensionPoint.getUniqueIdentifier());
- if (orphans == null)
- return null;
- link(extensionPoint, orphans);
- return recordChange(extensionPoint, orphans, IExtensionDelta.ADDED);
- }
-
- private Set addExtensionsAndExtensionPoints(Contribution element) {
- // now add and resolve extensions and extension points
- Set affectedNamespaces = new HashSet();
- int[] extPoints = element.getExtensionPoints();
- for (int i = 0; i < extPoints.length; i++) {
- String namespace = this.addExtensionPoint(extPoints[i]);
- if (namespace != null)
- affectedNamespaces.add(namespace);
- }
- int[] extensions = element.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- String namespace = this.addExtension(extensions[i]);
- if (namespace != null)
- affectedNamespaces.add(namespace);
- }
- return affectedNamespaces;
- }
-
- public void addRegistryChangeListener(IRegistryChangeListener listener) {
- // this is just a convenience API - no need to do any sync'ing here
- addRegistryChangeListener(listener, null);
- }
-
- public void addRegistryChangeListener(IRegistryChangeListener listener, String filter) {
- synchronized (listeners) {
- listeners.add(new ListenerInfo(listener, filter));
- }
- }
-
- private void basicAdd(Contribution element, boolean link) {
- // ignore anonymous namespaces
- if (element.getNamespace() == null)
- return;
-
- registryObjects.addContribution(element);
- if (!link)
- return;
-
- Set affectedNamespaces = addExtensionsAndExtensionPoints(element);
- setObjectManagers(affectedNamespaces, registryObjects.createDelegatingObjectManager(registryObjects.getAssociatedObjects(element.getContributingBundle().getBundleId())));
- }
-
- private void setObjectManagers(Set affectedNamespaces, IObjectManager manager) {
- for (Iterator iter = affectedNamespaces.iterator(); iter.hasNext();) {
- getDelta((String) iter.next()).setObjectManager(manager);
- }
- }
-
- private void basicRemove(long bundleId) {
- // ignore anonymous namespaces
- Set affectedNamespaces = removeExtensionsAndExtensionPoints(bundleId);
- Map associatedObjects = registryObjects.getAssociatedObjects(bundleId);
- registryObjects.removeObjects(associatedObjects);
- setObjectManagers(affectedNamespaces, registryObjects.createDelegatingObjectManager(associatedObjects));
-
- registryObjects.removeContribution(bundleId);
- }
-
- // allow other objects in the registry to use the same lock
- void enterRead() {
- access.enterRead();
- }
-
- // allow other objects in the registry to use the same lock
- void exitRead() {
- access.exitRead();
- }
-
- /**
- * Broadcasts (asynchronously) the event to all interested parties.
- */
- private void fireRegistryChangeEvent() {
- // if there is nothing to say, just bail out
- if (deltas.isEmpty() || listeners.isEmpty())
- return;
- // for thread safety, create tmp collections
- Object[] tmpListeners = listeners.getListeners();
- Map tmpDeltas = new HashMap(this.deltas);
- // the deltas have been saved for notification - we can clear them now
- deltas.clear();
- // do the notification asynchronously
- new ExtensionEventDispatcherJob(tmpListeners, tmpDeltas).schedule();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.IExtensionRegistry#getConfigurationElementsFor(java.lang.String)
- */
- public IConfigurationElement[] getConfigurationElementsFor(String extensionPointId) {
- // this is just a convenience API - no need to do any sync'ing here
- int lastdot = extensionPointId.lastIndexOf('.');
- if (lastdot == -1)
- return new IConfigurationElement[0];
- return getConfigurationElementsFor(extensionPointId.substring(0, lastdot), extensionPointId.substring(lastdot + 1));
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.IExtensionRegistry#getConfigurationElementsFor(java.lang.String, java.lang.String)
- */
- public IConfigurationElement[] getConfigurationElementsFor(String pluginId, String extensionPointSimpleId) {
- // this is just a convenience API - no need to do any sync'ing here
- IExtensionPoint extPoint = this.getExtensionPoint(pluginId, extensionPointSimpleId);
- if (extPoint == null)
- return new IConfigurationElement[0];
- return extPoint.getConfigurationElements();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.IExtensionRegistry#getConfigurationElementsFor(java.lang.String, java.lang.String, java.lang.String)
- */
- public IConfigurationElement[] getConfigurationElementsFor(String pluginId, String extensionPointName, String extensionId) {
- // this is just a convenience API - no need to do any sync'ing here
- IExtension extension = this.getExtension(pluginId, extensionPointName, extensionId);
- if (extension == null)
- return new IConfigurationElement[0];
- return extension.getConfigurationElements();
- }
-
- private RegistryDelta getDelta(String namespace) {
- // is there a delta for the plug-in?
- RegistryDelta existingDelta = (RegistryDelta) deltas.get(namespace);
- if (existingDelta != null)
- return existingDelta;
-
- //if not, create one
- RegistryDelta delta = new RegistryDelta();
- deltas.put(namespace, delta);
- return delta;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.IExtensionRegistry#getExtension(java.lang.String)
- */
- public IExtension getExtension(String extensionId) {
- if (extensionId == null)
- return null;
- int lastdot = extensionId.lastIndexOf('.');
- if (lastdot == -1)
- return null;
- String namespace = extensionId.substring(0, lastdot);
-
- Bundle[] allBundles = findAllBundles(namespace);
- for (int i = 0; i < allBundles.length; i++) {
- int[] extensions = registryObjects.getExtensionsFrom(allBundles[i].getBundleId());
- for (int j = 0; j < extensions.length; j++) {
- Extension ext = (Extension) registryObjects.getObject(extensions[j], RegistryObjectManager.EXTENSION);
- if (extensionId.equals(ext.getUniqueIdentifier()) && registryObjects.getExtensionPointObject(ext.getExtensionPointIdentifier()) != null) {
- return (IExtension) registryObjects.getHandle(extensions[j], RegistryObjectManager.EXTENSION);
- }
- }
-
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.IExtensionRegistry#getExtension(java.lang.String, java.lang.String)
- */
- public IExtension getExtension(String extensionPointId, String extensionId) {
- // this is just a convenience API - no need to do any sync'ing here
- int lastdot = extensionPointId.lastIndexOf('.');
- if (lastdot == -1)
- return null;
- return getExtension(extensionPointId.substring(0, lastdot), extensionPointId.substring(lastdot + 1), extensionId);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.IExtensionRegistry#getExtension(java.lang.String, java.lang.String, java.lang.String)
- */
- public IExtension getExtension(String pluginId, String extensionPointName, String extensionId) {
- // this is just a convenience API - no need to do any sync'ing here
- IExtensionPoint extPoint = getExtensionPoint(pluginId, extensionPointName);
- if (extPoint != null)
- return extPoint.getExtension(extensionId);
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.IExtensionRegistry#getExtensionPoint(java.lang.String)
- */
- public IExtensionPoint getExtensionPoint(String xptUniqueId) {
- return registryObjects.getExtensionPointHandle(xptUniqueId);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.IExtensionRegistry#getExtensionPoint(java.lang.String, java.lang.String)
- */
- public IExtensionPoint getExtensionPoint(String elementName, String xpt) {
- access.enterRead();
- try {
- return registryObjects.getExtensionPointHandle(elementName + '.' + xpt);
- } finally {
- access.exitRead();
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.IExtensionRegistry#getExtensionPoints()
- */
- public IExtensionPoint[] getExtensionPoints() {
- access.enterRead();
- try {
- return registryObjects.getExtensionPointsHandles();
- } finally {
- access.exitRead();
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.IExtensionRegistry#getExtensionPoints(java.lang.String)
- */
- public IExtensionPoint[] getExtensionPoints(String namespace) {
- access.enterRead();
- try {
- Bundle[] correspondingBundles = findAllBundles(namespace);
- IExtensionPoint[] result = ExtensionPointHandle.EMPTY_ARRAY;
- for (int i = 0; i < correspondingBundles.length; i++) {
- result = (IExtensionPoint[]) concatArrays(result, registryObjects.getHandles(registryObjects.getExtensionPointsFrom(correspondingBundles[i].getBundleId()), RegistryObjectManager.EXTENSION_POINT));
- }
- return result;
- } finally {
- access.exitRead();
- }
- }
-
- //Return all the bundles that contributes to the given namespace
- private Bundle[] findAllBundles(String namespace) {
- Bundle correspondingHost = Platform.getBundle(namespace);
- if (correspondingHost == null)
- return new Bundle[0];
- Bundle[] fragments = Platform.getFragments(correspondingHost);
- if(fragments==null)
- return new Bundle[] { correspondingHost };
- Bundle[] result = new Bundle[fragments.length + 1];
- System.arraycopy(fragments, 0, result, 0, fragments.length);
- result[fragments.length] = correspondingHost;
- return result;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.IExtensionRegistry#getExtensions(java.lang.String)
- */
- public IExtension[] getExtensions(String namespace) {
- access.enterRead();
- try {
- Bundle[] correspondingBundles = findAllBundles(namespace);
- List tmp = new ArrayList();
- for (int i = 0; i < correspondingBundles.length; i++) {
- Extension[] exts = (Extension[]) registryObjects.getObjects(registryObjects.getExtensionsFrom(correspondingBundles[i].getBundleId()), RegistryObjectManager.EXTENSION);
- for (int j = 0; j < exts.length; j++) {
- if (registryObjects.getExtensionPointObject(exts[j].getExtensionPointIdentifier()) != null)
- tmp.add(registryObjects.getHandle(exts[j].getObjectId(), RegistryObjectManager.EXTENSION));
- }
- }
- if (tmp.size() == 0)
- return ExtensionHandle.EMPTY_ARRAY;
- IExtension[] result = new IExtension[tmp.size()];
- return (IExtension[]) tmp.toArray(result);
- } finally {
- access.exitRead();
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.IExtensionRegistry#getNamespaces()
- */
- public String[] getNamespaces() {
- access.enterRead();
- try {
- Set namespaces = registryObjects.getNamespaces();
- String[] result = new String[namespaces.size()];
- return (String[]) namespaces.toArray(result);
- } finally {
- access.exitRead();
- }
- }
-
- boolean hasNamespace(long name) {
- access.enterRead();
- try {
- return registryObjects.hasContribution(name);
- } finally {
- access.exitRead();
- }
- }
-
- private void link(ExtensionPoint extPoint, int[] extensions) {
- extPoint.setRawChildren(extensions);
- registryObjects.add(extPoint, true);
- }
-
- /*
- * Records an extension addition/removal.
- */
- private String recordChange(ExtensionPoint extPoint, int extension, int kind) {
- // avoid computing deltas when there are no listeners
- if (listeners.isEmpty())
- return null;
- ExtensionDelta extensionDelta = new ExtensionDelta();
- extensionDelta.setExtension(extension);
- extensionDelta.setExtensionPoint(extPoint.getObjectId());
- extensionDelta.setKind(kind);
- getDelta(extPoint.getNamespace()).addExtensionDelta(extensionDelta);
- return extPoint.getNamespace();
- }
-
- /*
- * Records a set of extension additions/removals.
- */
- private String recordChange(ExtensionPoint extPoint, int[] extensions, int kind) {
- if (listeners.isEmpty())
- return null;
- if (extensions == null || extensions.length == 0)
- return null;
- RegistryDelta pluginDelta = getDelta(extPoint.getNamespace());
- for (int i = 0; i < extensions.length; i++) {
- ExtensionDelta extensionDelta = new ExtensionDelta();
- extensionDelta.setExtension(extensions[i]);
- extensionDelta.setExtensionPoint(extPoint.getObjectId());
- extensionDelta.setKind(kind);
- pluginDelta.addExtensionDelta(extensionDelta);
- }
- return extPoint.getNamespace();
- }
-
-// private void recordRemoval(long removedBundleId) {
-// int[] exts = registryObjects.getExtensionsFrom(removedBundleId);
-// Extension[] aexts = (Extension[]) registryObjects.getObjects(exts, RegistryObjectManager.EXTENSION);
-// IObjectManager mgr = registryObjects.getRemovedObjects(removedBundleId);
-// for (int i = 0; i < aexts.length; i++) {
-// getDelta(registryObjects.getExtensionPointObject(aexts[i].getExtensionPointIdentifier()).getNamespace()).setObjectManager(mgr);
-// }
-// }
-
- /**
- * Unresolves and removes all extensions and extension points provided by
- * the plug-in.
- * <p>
- * A corresponding IRegistryChangeEvent will be broadcast to all listeners
- * interested on changes in the given plug-in.
- * </p>
- */
- public void remove(long removedBundleId) {
- access.enterWrite();
- try {
- basicRemove(removedBundleId);
- fireRegistryChangeEvent();
- } finally {
- access.exitWrite();
- }
- }
-
- //Return the affected namespace
- private String removeExtension(int extensionId) {
- Extension extension = (Extension) registryObjects.getObject(extensionId, RegistryObjectManager.EXTENSION);
- String xptName = extension.getExtensionPointIdentifier();
- ExtensionPoint extPoint = registryObjects.getExtensionPointObject(xptName);
- if (extPoint == null) {
- registryObjects.removeOrphan(xptName, extensionId);
- return null;
- }
- // otherwise, unlink the extension from the extension point
- int[] existingExtensions = extPoint.getRawChildren();
- int[] newExtensions = RegistryObjectManager.EMPTY_INT_ARRAY;
- if (existingExtensions.length > 1) {
- if (existingExtensions.length == 1)
- newExtensions = RegistryObjectManager.EMPTY_INT_ARRAY;
-
- newExtensions = new int[existingExtensions.length - 1];
- for (int i = 0, j = 0; i < existingExtensions.length; i++)
- if (existingExtensions[i] != extension.getObjectId())
- newExtensions[j++] = existingExtensions[i];
- }
- link(extPoint, newExtensions);
- return recordChange(extPoint, extension.getObjectId(), IExtensionDelta.REMOVED);
- }
-
- private String removeExtensionPoint(int extPoint) {
- ExtensionPoint extensionPoint = (ExtensionPoint) registryObjects.getObject(extPoint, RegistryObjectManager.EXTENSION_POINT);
- int[] existingExtensions = extensionPoint.getRawChildren();
- if (existingExtensions == null || existingExtensions.length == 0) {
- return null;
- }
- //Remove the extension point from the registry object
- registryObjects.addOrphans(extensionPoint.getUniqueIdentifier(), existingExtensions);
- link(extensionPoint, RegistryObjectManager.EMPTY_INT_ARRAY);
- return recordChange(extensionPoint, existingExtensions, IExtensionDelta.REMOVED);
- }
-
- private Set removeExtensionsAndExtensionPoints(long bundleId) {
- Set affectedNamespaces = new HashSet();
- int[] extensions = registryObjects.getExtensionsFrom(bundleId);
- for (int i = 0; i < extensions.length; i++) {
- String namespace = this.removeExtension(extensions[i]);
- if (namespace != null)
- affectedNamespaces.add(namespace);
- }
-
- // remove extension points
- int[] extPoints = registryObjects.getExtensionPointsFrom(bundleId);
- for (int i = 0; i < extPoints.length; i++) {
- String namespace = this.removeExtensionPoint(extPoints[i]);
- if (namespace != null)
- affectedNamespaces.add(namespace);
- }
- return affectedNamespaces;
- }
-
- public void removeRegistryChangeListener(IRegistryChangeListener listener) {
- synchronized (listeners) {
- listeners.remove(new ListenerInfo(listener, null));
- }
- }
-
- public ExtensionRegistry() {
- boolean fromCache = false;
- registryObjects = new RegistryObjectManager();
- if (!"true".equals(System.getProperty(InternalPlatform.PROP_NO_REGISTRY_CACHE))) { //$NON-NLS-1$
- // Try to read the registry from the cache first. If that fails, create a new registry
- long start = 0;
- if (InternalPlatform.DEBUG)
- start = System.currentTimeMillis();
-
- //Find the cache in the local configuration area
- File cacheFile = null;
- try {
- currentFileManager = InternalPlatform.getDefault().getRuntimeFileManager();
- cacheFile = currentFileManager.lookup(TableReader.TABLE, false);
- } catch (IOException e) {
- //Ignore the exception. The registry will be rebuilt from the xml files.
- }
- //Find the cache in the shared configuration area
- if (cacheFile == null || !cacheFile.isFile()) {
- Location currentLocation = Platform.getConfigurationLocation();
- Location parentLocation = null;
- if (currentLocation != null && (parentLocation = currentLocation.getParentLocation()) != null) {
- try {
- currentFileManager = new FileManager(new File(parentLocation.getURL().getFile() + '/' + Platform.PI_RUNTIME), null, true);
- currentFileManager.open(false);
- cacheFile = currentFileManager.lookup(TableReader.TABLE, false);
- } catch (IOException e) {
- //Ignore the exception. The registry will be rebuilt from the xml files.
- }
- }
- }
-
- //The cache is made of several files, find the real names of these other files. If all files are found, try to initialize the objectManager
- if (cacheFile != null && cacheFile.isFile()) {
- TableReader.setTableFile(cacheFile);
- try {
- TableReader.setExtraDataFile(currentFileManager.lookup(TableReader.EXTRA, false));
- TableReader.setMainDataFile(currentFileManager.lookup(TableReader.MAIN, false));
- TableReader.setContributionsFile(currentFileManager.lookup(TableReader.CONTRIBUTIONS, false));
- TableReader.setOrphansFile(currentFileManager.lookup(TableReader.ORPHANS, false));
- fromCache = registryObjects.init(computeRegistryStamp());
- } catch (IOException e) {
- // Ignore the exception. The registry will be rebuilt from the xml files.
- }
- }
-
- if (InternalPlatform.DEBUG && fromCache)
- System.out.println("Reading registry cache: " + (System.currentTimeMillis() - start)); //$NON-NLS-1$
-
- if (InternalPlatform.DEBUG_REGISTRY) {
- if (!fromCache)
- System.out.println("Reloading registry from manifest files..."); //$NON-NLS-1$
- else
- System.out.println("Using registry cache..."); //$NON-NLS-1$
- }
- }
-
- String debugOption = InternalPlatform.getDefault().getOption(OPTION_DEBUG_EVENTS_EXTENSION);
- DEBUG = debugOption == null ? false : debugOption.equalsIgnoreCase("true"); //$NON-NLS-1$
- if (DEBUG)
- addRegistryChangeListener(new IRegistryChangeListener() {
- public void registryChanged(IRegistryChangeEvent event) {
- System.out.println(event);
- }
- });
-
- // register a listener to catch new bundle installations/resolutions.
- pluginBundleListener = new EclipseBundleListener(this);
- InternalPlatform.getDefault().getBundleContext().addBundleListener(pluginBundleListener);
-
- // populate the registry with all the currently installed bundles.
- // There is a small window here while processBundles is being
- // called where the pluginBundleListener may receive a BundleEvent
- // to add/remove a bundle from the registry. This is ok since
- // the registry is a synchronized object and will not add the
- // same bundle twice.
- if (!fromCache)
- pluginBundleListener.processBundles(InternalPlatform.getDefault().getBundleContext().getBundles());
-
- InternalPlatform.getDefault().getBundleContext().registerService(IExtensionRegistry.class.getName(), this, new Hashtable());
-
- }
-
- public void stop() {
- InternalPlatform.getDefault().getBundleContext().removeBundleListener(this.pluginBundleListener);
- if (!registryObjects.isDirty())
- return;
- if (currentFileManager == null)
- return;
- if (currentFileManager.isReadOnly()) {
- if (currentFileManager != InternalPlatform.getDefault().getRuntimeFileManager())
- currentFileManager.close();
- return;
- }
-
- File tableFile = null;
- File mainFile = null;
- File extraFile = null;
- File contributionsFile = null;
- File orphansFile = null;
- try {
- currentFileManager.lookup(TableReader.TABLE, true);
- currentFileManager.lookup(TableReader.MAIN, true);
- currentFileManager.lookup(TableReader.EXTRA, true);
- currentFileManager.lookup(TableReader.CONTRIBUTIONS, true);
- currentFileManager.lookup(TableReader.ORPHANS, true);
- tableFile = File.createTempFile(TableReader.TABLE, ".new", currentFileManager.getBase()); //$NON-NLS-1$
- mainFile = File.createTempFile(TableReader.MAIN, ".new", currentFileManager.getBase()); //$NON-NLS-1$
- extraFile = File.createTempFile(TableReader.EXTRA, ".new", currentFileManager.getBase()); //$NON-NLS-1$
- contributionsFile = File.createTempFile(TableReader.CONTRIBUTIONS, ".new", currentFileManager.getBase()); //$NON-NLS-1$
- orphansFile = File.createTempFile(TableReader.ORPHANS, ".new", currentFileManager.getBase()); //$NON-NLS-1$
- TableWriter.setTableFile(tableFile);
- TableWriter.setExtraDataFile(extraFile);
- TableWriter.setMainDataFile(mainFile);
- TableWriter.setContributionsFile(contributionsFile);
- TableWriter.setOrphansFile(orphansFile);
- } catch (IOException e) {
- return; //Ignore the exception since we can recompute the cache
- }
- try {
- if (new TableWriter().saveCache(registryObjects, computeRegistryStamp()))
- currentFileManager.update(new String[] {TableReader.TABLE, TableReader.MAIN, TableReader.EXTRA, TableReader.CONTRIBUTIONS, TableReader.ORPHANS}, new String[] {tableFile.getName(), mainFile.getName(), extraFile.getName(), contributionsFile.getName(), orphansFile.getName()});
- } catch (IOException e) {
- //Ignore the exception since we can recompute the cache
- }
- if (currentFileManager != InternalPlatform.getDefault().getRuntimeFileManager())
- currentFileManager.close();
- }
-
- /*
- * Clear the registry cache files from the file manager so on next start-up we recompute it.
- */
- public void clearRegistryCache() {
- String[] keys = new String[] {TableReader.TABLE, TableReader.MAIN, TableReader.EXTRA, TableReader.CONTRIBUTIONS, TableReader.ORPHANS};
- for (int i=0; i<keys.length; i++)
- try {
- currentFileManager.remove(keys[i]);
- } catch (IOException e) {
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, Messages.meta_registryCacheReadProblems, e));
- }
- }
-
- private long computeRegistryStamp() {
- // If the check config prop is false or not set then exit
- if (!"true".equalsIgnoreCase(System.getProperty(InternalPlatform.PROP_CHECK_CONFIG))) //$NON-NLS-1$
- return 0;
- Bundle[] allBundles = InternalPlatform.getDefault().getBundleContext().getBundles();
- long result = 0;
- for (int i = 0; i < allBundles.length; i++) {
- URL pluginManifest = allBundles[i].getEntry("plugin.xml"); //$NON-NLS-1$
- if (pluginManifest == null)
- pluginManifest = allBundles[i].getEntry("fragment.xml"); //$NON-NLS-1$
- if (pluginManifest == null)
- continue;
- try {
- URLConnection connection = pluginManifest.openConnection();
- result ^= connection.getLastModified() + allBundles[i].getBundleId();
- } catch (IOException e) {
- return 0;
- }
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionsParser.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionsParser.java
deleted file mode 100644
index ea4cebd..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionsParser.java
+++ /dev/null
@@ -1,592 +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.registry;
-
-import java.io.IOException;
-import java.util.*;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
-import org.eclipse.core.internal.runtime.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.util.tracker.ServiceTracker;
-import org.xml.sax.*;
-import org.xml.sax.helpers.DefaultHandler;
-
-public class ExtensionsParser extends DefaultHandler {
- // Introduced for backward compatibility
- private final static String NO_EXTENSION_MUNGING = "eclipse.noExtensionMunging"; //$NON-NLS-1$ //System property
- private static Map extensionPointMap;
-
- static {
- initializeExtensionPointMap();
- }
-
- /**
- * Initialize the list of renamed extension point ids
- */
- private static void initializeExtensionPointMap() {
- Map map = new HashMap(13);
- map.put("org.eclipse.ui.markerImageProvider", "org.eclipse.ui.ide.markerImageProvider"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("org.eclipse.ui.markerHelp", "org.eclipse.ui.ide.markerHelp"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("org.eclipse.ui.markerImageProviders", "org.eclipse.ui.ide.markerImageProviders"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("org.eclipse.ui.markerResolution", "org.eclipse.ui.ide.markerResolution"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("org.eclipse.ui.projectNatureImages", "org.eclipse.ui.ide.projectNatureImages"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("org.eclipse.ui.resourceFilters", "org.eclipse.ui.ide.resourceFilters"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("org.eclipse.ui.markerUpdaters", "org.eclipse.ui.editors.markerUpdaters"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("org.eclipse.ui.documentProviders", "org.eclipse.ui.editors.documentProviders"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("org.eclipse.ui.workbench.texteditor.markerAnnotationSpecification", "org.eclipse.ui.editors.markerAnnotationSpecification"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("org.eclipse.help.browser", "org.eclipse.help.base.browser"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("org.eclipse.help.luceneAnalyzer", "org.eclipse.help.base.luceneAnalyzer"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("org.eclipse.help.webapp", "org.eclipse.help.base.webapp"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("org.eclipse.help.support", "org.eclipse.ui.helpSupport"); //$NON-NLS-1$ //$NON-NLS-2$
- extensionPointMap = map;
- }
-
- private static long cumulativeTime = 0;
-
- // is in compatibility mode
- private boolean compatibilityMode;
-
- // File name for this extension manifest
- // This to help with error reporting
- private String locationName = null;
-
- // Current State Information
- private Stack stateStack = new Stack();
-
- // Current object stack (used to hold the current object we are
- // populating in this plugin descriptor
- private Stack objectStack = new Stack();
-
- private String schemaVersion = null;
-
- // A status for holding results.
- private MultiStatus status;
-
- // Resource bundle used to translate the content of the plugin.xml
- private ResourceBundle resources;
-
- // Keep track of the object encountered.
- private RegistryObjectManager objectManager;
-
- private Contribution namespace;
-
- //This keeps tracks of the value of the configuration element in case the value comes in several pieces (see characters()). See as well bug 75592.
- private String configurationElementValue;
-
- /**
- * Status code constant (value 1) indicating a problem in a bundle extensions
- * manifest (<code>extensions.xml</code>) file.
- */
- public static final int PARSE_PROBLEM = 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 FRAGMENT = "fragment"; //$NON-NLS-1$
- public static final String BUNDLE_UID = "id"; //$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$
-
- // Valid States
- private static final int IGNORED_ELEMENT_STATE = 0;
- private static final int INITIAL_STATE = 1;
- private static final int BUNDLE_STATE = 2;
- private static final int BUNDLE_EXTENSION_POINT_STATE = 5;
- private static final int BUNDLE_EXTENSION_STATE = 6;
- private static final int CONFIGURATION_ELEMENT_STATE = 10;
-
- // Keep a group of vectors as a temporary scratch space. These
- // vectors will be used to populate arrays in the bundle model
- // 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 ArrayList scratchVectors[] = new ArrayList[LAST_INDEX + 1];
-
- private String manifestType;
-
- private Locator locator = null;
-
- public ExtensionsParser(MultiStatus status) {
- super();
- this.status = status;
- }
-
- /**
- * @see ContentHandler#setDocumentLocator
- */
- 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
- ConfigurationElement currentConfigElement = (ConfigurationElement) objectStack.peek();
- String value = new String(ch, start, length);
- if (configurationElementValue == null) {
- if (value.trim().length() != 0) {
- configurationElementValue = value;
- }
- } else {
- configurationElementValue = configurationElementValue + value;
- }
- if (configurationElementValue != null)
- currentConfigElement.setValue(translate(configurationElementValue));
- }
- }
-
- public void endDocument() {
- // do nothing
- }
-
- 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 BUNDLE_STATE :
- if (elementName.equals(manifestType)) {
- stateStack.pop();
-
- ArrayList extensionPoints = scratchVectors[EXTENSION_POINT_INDEX];
- ArrayList extensions = scratchVectors[EXTENSION_INDEX];
- int[] namespaceChildren = new int[2 + extensionPoints.size() + extensions.size()];
- int position = 2;
- // Put the extension points into this namespace
- if (extensionPoints.size() > 0) {
- namespaceChildren[Contribution.EXTENSION_POINT] = extensionPoints.size();
- for (Iterator iter = extensionPoints.iterator(); iter.hasNext();) {
- namespaceChildren[position++] = ((RegistryObject) iter.next()).getObjectId();
- }
- extensionPoints.clear();
- }
-
- // Put the extensions into this namespace too
- if (extensions.size() > 0) {
- Extension[] renamedExtensions = fixRenamedExtensionPoints((Extension[]) extensions.toArray(new Extension[extensions.size()]));
- namespaceChildren[Contribution.EXTENSION] = renamedExtensions.length;
- for (int i = 0; i < renamedExtensions.length; i++) {
- namespaceChildren[position++] = renamedExtensions[i].getObjectId();
- }
- extensions.clear();
- }
- namespace.setRawChildren(namespaceChildren);
- }
- break;
- case BUNDLE_EXTENSION_POINT_STATE :
- if (elementName.equals(EXTENSION_POINT)) {
- stateStack.pop();
- }
- break;
- case BUNDLE_EXTENSION_STATE :
- if (elementName.equals(EXTENSION)) {
- stateStack.pop();
- // Finish up extension object
- Extension currentExtension = (Extension) objectStack.pop();
- currentExtension.setNamespace(namespace.getNamespace());
- scratchVectors[EXTENSION_INDEX].add(currentExtension);
- }
- break;
- case CONFIGURATION_ELEMENT_STATE :
- // We don't care what the element name was
- stateStack.pop();
- // Now finish up the configuration element object
- configurationElementValue = null;
- ConfigurationElement currentConfigElement = (ConfigurationElement) objectStack.pop();
-
- String value = currentConfigElement.getValueAsIs();
- if (value != null) {
- currentConfigElement.setValue(value.trim());
- }
-
- RegistryObject parent = (RegistryObject) objectStack.peek();
- // Want to add this configuration element to the subelements of an extension
- int[] oldValues = parent.getRawChildren();
- int size = oldValues.length;
- int[] newValues = new int[size + 1];
- for (int i = 0; i < size; i++) {
- newValues[i] = oldValues[i];
- }
- newValues[size] = currentConfigElement.getObjectId();
- parent.setRawChildren(newValues);
- currentConfigElement.setParentId(parent.getObjectId());
- currentConfigElement.setParentType(parent instanceof ConfigurationElement ? RegistryObjectManager.CONFIGURATION_ELEMENT : RegistryObjectManager.EXTENSION);
- break;
- }
- }
-
- public void error(SAXParseException ex) {
- logStatus(ex);
- }
-
- public void fatalError(SAXParseException ex) throws SAXException {
- logStatus(ex);
- throw ex;
- }
-
- private void handleExtensionPointState(String elementName) {
- // We ignore all elements under extension points (if there are any)
- stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
- unknownElement(EXTENSION_POINT, elementName);
- }
-
- private 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));
-
- configurationElementValue = null;
-
- // create a new Configuration Element and push it onto the object stack
- ConfigurationElement currentConfigurationElement = new ConfigurationElement();
- currentConfigurationElement.setContributingBundle(namespace.getNamespaceBundle());
- 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);
- objectManager.add(currentConfigurationElement, true);
- }
-
- private void handleInitialState(String elementName, Attributes attributes) {
- if (!elementName.equals(manifestType)) {
- stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
- internalError(NLS.bind(Messages.parse_unknownTopElement, elementName));
- return;
- }
- // new manifests should have the plugin (or fragment) element empty
- // in compatibility mode, any extraneous elements will be silently ignored
- compatibilityMode = attributes.getLength() > 0;
- stateStack.push(new Integer(BUNDLE_STATE));
- objectStack.push(namespace);
- }
-
- private void handleBundleState(String elementName, Attributes attributes) {
- if (elementName.equals(EXTENSION_POINT)) {
- stateStack.push(new Integer(BUNDLE_EXTENSION_POINT_STATE));
- parseExtensionPointAttributes(attributes);
- return;
- }
- if (elementName.equals(EXTENSION)) {
- stateStack.push(new Integer(BUNDLE_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));
- if (!compatibilityMode)
- unknownElement(manifestType, elementName);
- }
-
- 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 Object[] {name, Integer.toString(ex.getLineNumber()), Integer.toString(ex.getColumnNumber()), ex.getMessage()}));
- error(new Status(IStatus.WARNING, Platform.PI_RUNTIME, PARSE_PROBLEM, msg, ex));
- }
-
- public Contribution parseManifest(ServiceTracker factoryTracker, InputSource in, String manifestKind, String manifestName, RegistryObjectManager registryObjects, Contribution currentNamespace, ResourceBundle bundle) throws ParserConfigurationException, SAXException, IOException {
- long start = 0;
- this.resources = bundle;
- this.objectManager = registryObjects;
- //initialize the parser with this object
- this.namespace = currentNamespace;
- if (InternalPlatform.DEBUG)
- start = System.currentTimeMillis();
-
- SAXParserFactory factory = (SAXParserFactory) factoryTracker.getService();
-
- if (factory == null)
- throw new SAXException(Messages.parse_xmlParserNotAvailable);
-
- try {
- if (manifestKind == null)
- throw new NullPointerException();
- if (!(manifestKind.equals(PLUGIN) || manifestKind.equals(FRAGMENT)))
- throw new IllegalArgumentException("Invalid manifest type: " + manifestType); //$NON-NLS-1$
- this.manifestType = manifestKind;
- locationName = in.getSystemId();
- if (locationName == null)
- locationName = manifestName;
- 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 (Contribution) objectStack.pop();
- } finally {
- if (InternalPlatform.DEBUG) {
- cumulativeTime = cumulativeTime + (System.currentTimeMillis() - start);
- InternalPlatform.getDefault().setOption("org.eclipse.core.runtime/registry/parsing/timing/value", Long.toString(cumulativeTime)); //$NON-NLS-1$
- }
- }
- }
-
- private void parseConfigurationElementAttributes(Attributes attributes) {
- ConfigurationElement parentConfigurationElement = (ConfigurationElement) objectStack.peek();
-
- // process attributes
- int len = (attributes != null) ? attributes.getLength() : 0;
- if (len == 0) {
- parentConfigurationElement.setProperties(RegistryObjectManager.EMPTY_STRING_ARRAY);
- return;
- }
- String[] properties = new String[len * 2];
- for (int i = 0; i < len; i++) {
- properties[i * 2] = attributes.getLocalName(i);
- properties[i * 2 + 1] = translate(attributes.getValue(i));
- }
- parentConfigurationElement.setProperties(properties);
- properties = null;
- }
-
- private void parseExtensionAttributes(Attributes attributes) {
- Extension currentExtension = new Extension();
- 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.setLabel(translate(attrValue));
- else if (attrName.equals(EXTENSION_ID))
- currentExtension.setSimpleIdentifier(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 = namespace.getNamespace();
- targetName = baseId + '.' + attrValue;
- } else
- targetName = attrValue;
- currentExtension.setExtensionPointIdentifier(targetName);
- } else
- unknownAttribute(EXTENSION, attrName);
- }
- if (currentExtension.getExtensionPointIdentifier() == null) {
- missingAttribute(EXTENSION_TARGET, EXTENSION);
- stateStack.pop();
- stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
- objectStack.pop();
- return;
- }
-
- objectManager.add(currentExtension, true);
- }
-
- //todo: Are all three methods needed??
- private void missingAttribute(String attribute, String element) {
- if (locator == null)
- internalError(NLS.bind(Messages.parse_missingAttribute, attribute, element));
- else
- internalError(NLS.bind(Messages.parse_missingAttributeLine, (new String[] {attribute, element, Integer.toString(locator.getLineNumber())})));
- }
-
- private void unknownAttribute(String attribute, String element) {
- if (locator == null)
- internalError(NLS.bind(Messages.parse_unknownAttribute, attribute, element));
- else
- internalError(NLS.bind(Messages.parse_unknownAttributeLine, (new String[] {attribute, element, Integer.toString(locator.getLineNumber())})));
- }
-
- private void unknownElement(String element, String parent) {
- if (locator == null)
- internalError(NLS.bind(Messages.parse_unknownElement, parent, element));
- else
- internalError(NLS.bind(Messages.parse_unknownElementLine, (new String[] {parent, element, Integer.toString(locator.getLineNumber())})));
- }
-
- private void parseExtensionPointAttributes(Attributes attributes) {
- ExtensionPoint currentExtPoint = new ExtensionPoint();
-
- // 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.setLabel(translate(attrValue));
- else if (attrName.equals(EXTENSION_POINT_ID)) {
- currentExtPoint.setUniqueIdentifier(namespace.getNamespace() + '.' + attrValue);
- } else if (attrName.equals(EXTENSION_POINT_SCHEMA))
- currentExtPoint.setSchema(attrValue);
- else
- unknownAttribute(EXTENSION_POINT, attrName);
- }
- if (currentExtPoint.getSimpleIdentifier() == null || currentExtPoint.getLabel() == null) {
- String attribute = currentExtPoint.getSimpleIdentifier() == null ? EXTENSION_POINT_ID : EXTENSION_POINT_NAME;
- missingAttribute(attribute, EXTENSION_POINT);
- stateStack.pop();
- stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
- return;
- }
-
- objectManager.addExtensionPoint(currentExtPoint, true);
- currentExtPoint.setNamespace(namespace.getNamespace());
- currentExtPoint.setBundleId(namespace.getNamespaceBundle().getBundleId());
-
- // Now populate the the vector just below us on the objectStack with this extension point
- scratchVectors[EXTENSION_POINT_INDEX].add(currentExtPoint);
- }
-
- public void startDocument() {
- stateStack.push(new Integer(INITIAL_STATE));
- for (int i = 0; i <= LAST_INDEX; i++) {
- scratchVectors[i] = new ArrayList();
- }
- }
-
- public void startElement(String uri, String elementName, String qName, Attributes attributes) {
- switch (((Integer) stateStack.peek()).intValue()) {
- case INITIAL_STATE :
- handleInitialState(elementName, attributes);
- break;
- case BUNDLE_STATE :
- handleBundleState(elementName, attributes);
- break;
- case BUNDLE_EXTENSION_POINT_STATE :
- handleExtensionPointState(elementName);
- break;
- case BUNDLE_EXTENSION_STATE :
- case CONFIGURATION_ELEMENT_STATE :
- handleExtensionState(elementName, attributes);
- break;
- default :
- stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
- if (!compatibilityMode)
- internalError(NLS.bind(Messages.parse_unknownTopElement, elementName));
- }
- }
-
- public void warning(SAXParseException ex) {
- logStatus(ex);
- }
-
- private void internalError(String message) {
- error(new Status(IStatus.WARNING, Platform.PI_RUNTIME, PARSE_PROBLEM, message, null));
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.ContentHandler#processingInstruction
- * @since 3.0
- */
- public void processingInstruction(String target, String data) throws SAXException {
- // Since 3.0, a processing instruction of the form <?eclipse version="3.0"?> at
- // the start of the manifest file is used to indicate the plug-in manifest
- // schema version in effect. Pre-3.0 (i.e., 2.1) plug-in manifest files do not
- // have one of these, and this is how we can distinguish the manifest of a
- // pre-3.0 plug-in from a post-3.0 one (for compatibility tranformations).
- if (target.equalsIgnoreCase("eclipse")) { //$NON-NLS-1$
- // just the presence of this processing instruction indicates that this
- // plug-in is at least 3.0
- schemaVersion = "3.0"; //$NON-NLS-1$
- StringTokenizer tokenizer = new StringTokenizer(data, "=\""); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- String token = tokenizer.nextToken();
- if (token.equalsIgnoreCase("version")) { //$NON-NLS-1$
- if (!tokenizer.hasMoreTokens()) {
- break;
- }
- schemaVersion = tokenizer.nextToken();
- break;
- }
- }
- }
- }
-
- /**
- * 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);
- }
-
- private String translate(String key) {
- return ResourceTranslator.getResourceString(null, key, resources);
- }
-
- /**
- * Fixes up the extension declarations in the given pre-3.0 plug-in or fragment to compensate
- * for extension points that were renamed between release 2.1 and 3.0.
- */
- private Extension[] fixRenamedExtensionPoints(Extension[] extensions) {
- if (extensions == null || (schemaVersion != null && schemaVersion.equals("3.0")) || System.getProperties().get(NO_EXTENSION_MUNGING) != null) //$NON-NLS-1$
- return extensions;
- for (int i = 0; i < extensions.length; i++) {
- Extension extension = extensions[i];
- String oldPointId = extension.getExtensionPointIdentifier();
- String newPointId = (String) extensionPointMap.get(oldPointId);
- if (newPointId != null) {
- extension.setExtensionPointIdentifier(newPointId);
- }
- }
- return extensions;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/Handle.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/Handle.java
deleted file mode 100644
index 7868da6..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/Handle.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
-
-/**
- * A handle is the super class to all registry objects that are now served to users.
- * The handles never hold on to any "real" content of the object being represented.
- * A handle can become stale if its referenced object has been removed from the registry.
- * @since 3.1.
- */
-public abstract class Handle {
- protected IObjectManager objectManager;
-
- private int objectId;
-
- protected int getId() {
- return objectId;
- }
-
- Handle(IObjectManager objectManager, int value) {
- objectId = value;
- this.objectManager = objectManager;
- }
-
- /**
- * Return the actual object corresponding to this handle.
- * @throws InvalidRegistryObjectException when the handle is stale.
- */
- abstract RegistryObject getObject();
-
- public boolean equals(Object object) {
- if (object instanceof Handle) {
- return objectId == ((Handle) object).objectId;
- }
- return false;
- }
-
- public int hashCode() {
- return objectId;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/HashtableOfInt.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/HashtableOfInt.java
deleted file mode 100644
index b66810b..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/HashtableOfInt.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import java.io.*;
-
-/**
- * Hashtable for non-zero int keys.
- */
-
-public final class HashtableOfInt {
- private int[] keyTable;
- private int[] valueTable;
- private static final float GROWTH_FACTOR = 1.33f;
-
- private int elementSize; // number of elements in the table
- private int threshold;
-
- public HashtableOfInt() {
- this(13);
- }
-
- public HashtableOfInt(int size) {
- this.elementSize = 0;
- this.threshold = size; // size represents the expected number of elements
- int extraRoom = (int) (size * 1.33f);
- if (this.threshold == extraRoom)
- extraRoom++;
- this.keyTable = new int[extraRoom];
- this.valueTable = new int[extraRoom];
- }
-
- public boolean containsKey(int key) {
- int index = key % valueTable.length;
- int currentKey;
- while ((currentKey = keyTable[index]) != 0) {
- if (currentKey == key)
- return true;
- index = (index + 1) % keyTable.length;
- }
- return false;
- }
-
- public int get(int key) {
- int index = key % valueTable.length;
- int currentKey;
- while ((currentKey = keyTable[index]) != 0) {
- if (currentKey == key)
- return valueTable[index];
- index = (index + 1) % keyTable.length;
- }
- return Integer.MIN_VALUE;
- }
-
- public int removeKey(int key) {
- int index = key % valueTable.length;
- int currentKey;
- while ((currentKey = keyTable[index]) != 0) {
- if (currentKey == key) {
- return valueTable[index];
- }
- index = (index + 1) % keyTable.length;
- }
- return Integer.MIN_VALUE;
- }
-
- public int put(int key, int value) {
- int index = key % valueTable.length;
- int currentKey;
- while ((currentKey = keyTable[index]) != 0) {
- if (currentKey == key)
- return valueTable[index] = value;
- index = (index + 1) % keyTable.length;
- }
- keyTable[index] = key;
- valueTable[index] = value;
-
- // assumes the threshold is never equal to the size of the table
- if (++elementSize > threshold)
- rehash();
- return value;
- }
-
- private void rehash() {
- HashtableOfInt newHashtable = new HashtableOfInt((int) (elementSize * GROWTH_FACTOR)); // double the number of expected elements
- int currentKey;
- for (int i = keyTable.length; --i >= 0;)
- if ((currentKey = keyTable[i]) != 0)
- newHashtable.put(currentKey, valueTable[i]);
-
- this.keyTable = newHashtable.keyTable;
- this.valueTable = newHashtable.valueTable;
- this.threshold = newHashtable.threshold;
- }
-
- public int size() {
- return elementSize;
- }
-
- public String toString() {
- String s = ""; //$NON-NLS-1$
- int object;
- for (int i = 0, length = valueTable.length; i < length; i++)
- if ((object = valueTable[i]) != Integer.MIN_VALUE)
- s += keyTable[i] + " -> " + object + "\n"; //$NON-NLS-2$ //$NON-NLS-1$
- return s;
- }
-
- public void save(DataOutputStream out) throws IOException {
- out.writeInt(elementSize);
- int tableSize = keyTable.length;
- out.writeInt(tableSize);
- out.writeInt(threshold);
- for (int i = 0; i < tableSize; i++) {
- out.writeInt(keyTable[i]);
- out.writeInt(valueTable[i]);
- }
- }
-
- public void load(DataInputStream in) throws IOException {
- elementSize = in.readInt();
- int tableSize = in.readInt();
- threshold = in.readInt();
- boolean fastMode = true;
- if (((double) tableSize / elementSize) < GROWTH_FACTOR) {
- keyTable = new int[(int) (elementSize * GROWTH_FACTOR)];
- valueTable = new int[(int) (elementSize * GROWTH_FACTOR)];
- elementSize = 0;
- fastMode = false;
- } else {
- keyTable = new int[tableSize];
- valueTable = new int[tableSize];
- }
- for (int i = 0; i < tableSize; i++) {
- int key = in.readInt();
- int value = in.readInt();
- if (fastMode) {
- keyTable[i] = key;
- valueTable[i] = value;
- } else {
- put(key, value);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/HashtableOfStringAndInt.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/HashtableOfStringAndInt.java
deleted file mode 100644
index 1cdc8e0..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/HashtableOfStringAndInt.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import java.io.*;
-
-/**
- * Hashtable of {String --> int }
- */
-public final class HashtableOfStringAndInt implements Cloneable {
- public static final int MISSING_ELEMENT = Integer.MIN_VALUE;
-
- // to avoid using Enumerations, walk the individual tables skipping nulls
- private String keyTable[];
- private int valueTable[];
-
- private int elementSize; // number of elements in the table
- private int threshold;
- private static final float GROWTH_FACTOR = 1.33f;
-
- public HashtableOfStringAndInt() {
- this(13);
- }
-
- public HashtableOfStringAndInt(int size) {
- this.elementSize = 0;
- this.threshold = size; // size represents the expected number of elements
- int extraRoom = (int) (size * 1.75f);
- if (this.threshold == extraRoom)
- extraRoom++;
- this.keyTable = new String[extraRoom];
- this.valueTable = new int[extraRoom];
- }
-
- public Object clone() throws CloneNotSupportedException {
- throw new CloneNotSupportedException();
- // HashtableOfStringAndInt result = (HashtableOfStringAndInt) super.clone();
- // result.elementSize = this.elementSize;
- // result.threshold = this.threshold;
- //
- // int length = this.keyTable.length;
- // result.keyTable = new char[length][];
- // System.arraycopy(this.keyTable, 0, result.keyTable, 0, length);
- //
- // length = this.valueTable.length;
- // result.valueTable = new Object[length];
- // System.arraycopy(this.valueTable, 0, result.valueTable, 0, length);
- // return result;
- }
-
- public boolean containsKey(String key) {
- int index = (key.hashCode() & 0x7FFFFFFF) % valueTable.length;
- int keyLength = key.length();
- String currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length() == keyLength && currentKey.equals(key))
- return true;
- index = (index + 1) % keyTable.length;
- }
- return false;
- }
-
- public int get(String key) {
- int index = (key.hashCode() & 0x7FFFFFFF) % valueTable.length;
- int keyLength = key.length();
- String currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length() == keyLength && currentKey.equals(key))
- return valueTable[index];
- index = (index + 1) % keyTable.length;
- }
- return MISSING_ELEMENT;
- }
-
- public int put(String key, int value) {
- int index = (key.hashCode() & 0x7FFFFFFF) % valueTable.length;
- int keyLength = key.length();
- String currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length() == keyLength && currentKey.equals(key))
- return valueTable[index] = value;
- index = (index + 1) % keyTable.length;
- }
- keyTable[index] = key;
- valueTable[index] = value;
-
- // assumes the threshold is never equal to the size of the table
- if (++elementSize > threshold)
- rehash();
- return value;
- }
-
- public int removeKey(String key) {
- int index = (key.hashCode() & 0x7FFFFFFF) % valueTable.length;
- int keyLength = key.length();
- String currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length() == keyLength && currentKey.equals(key)) {
- int value = valueTable[index];
- elementSize--;
- keyTable[index] = null;
- valueTable[index] = MISSING_ELEMENT;
- rehash();
- return value;
- }
- index = (index + 1) % keyTable.length;
- }
- return MISSING_ELEMENT;
- }
-
- private void rehash() {
- HashtableOfStringAndInt newHashtable = new HashtableOfStringAndInt((int) (elementSize * GROWTH_FACTOR));
- String currentKey;
- for (int i = keyTable.length; --i >= 0;)
- if ((currentKey = keyTable[i]) != null)
- newHashtable.put(currentKey, valueTable[i]);
-
- this.keyTable = newHashtable.keyTable;
- this.valueTable = newHashtable.valueTable;
- this.threshold = newHashtable.threshold;
- }
-
- public int size() {
- return elementSize;
- }
-
- public String toString() {
- String s = ""; //$NON-NLS-1$
- int object;
- for (int i = 0, length = valueTable.length; i < length; i++)
- if ((object = valueTable[i]) != MISSING_ELEMENT)
- s += new String(keyTable[i]) + " -> " + object + "\n"; //$NON-NLS-2$ //$NON-NLS-1$
- return s;
- }
-
- public int[] getValues() {
- int keyTableLength = keyTable.length;
- int[] result = new int[size()];
- int j = 0;
- for (int i = 0; i < keyTableLength; i++) {
- if (keyTable[i] != null)
- result[j++] = valueTable[i];
- }
- return result;
- }
-
- public void save(DataOutputStream out) throws IOException {
- out.writeInt(elementSize);
- int tableSize = keyTable.length;
- out.writeInt(tableSize);
- out.writeInt(threshold);
- for (int i = 0; i < tableSize; i++) {
- writeStringOrNull(keyTable[i], out);
- out.writeInt(valueTable[i]);
- }
- }
-
- public void load(DataInputStream in) throws IOException {
- elementSize = in.readInt();
- int tableSize = in.readInt();
- threshold = in.readInt();
- boolean fastMode = true;
- if (((double) tableSize / elementSize) < GROWTH_FACTOR) {
- keyTable = new String[(int) (elementSize * GROWTH_FACTOR)];
- valueTable = new int[(int) (elementSize * GROWTH_FACTOR)];
- elementSize = 0;
- fastMode = false;
- } else {
- keyTable = new String[tableSize];
- valueTable = new int[tableSize];
- }
- for (int i = 0; i < tableSize; i++) {
- String key = readStringOrNull(in);
- int value = in.readInt();
- if (fastMode) {
- keyTable[i] = key;
- valueTable[i] = value;
- } else {
- if (key != null)
- put(key, value);
- }
- }
- }
-
- private static final byte NULL = 0;
- private static final byte OBJECT = 1;
-
- private void writeStringOrNull(String string, DataOutputStream out) throws IOException {
- if (string == null)
- out.writeByte(NULL);
- else {
- out.writeByte(OBJECT);
- out.writeUTF(string);
- }
- }
-
- private String readStringOrNull(DataInputStream in) throws IOException {
- byte type = in.readByte();
- if (type == NULL)
- return null;
- return in.readUTF();
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/IObjectManager.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/IObjectManager.java
deleted file mode 100644
index 98bb015..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/IObjectManager.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-/**
- * @since 3.1
- */
-public interface IObjectManager {
- Handle getHandle(int id, byte type);
-
- Handle[] getHandles(int[] ids, byte type);
-
- Object getObject(int id, byte type);
-
- RegistryObject[] getObjects(int[] values, byte type);
-
- void close();
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/KeyedElement.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/KeyedElement.java
deleted file mode 100644
index f587740..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/KeyedElement.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-public interface KeyedElement {
- public int getKeyHashCode();
-
- public boolean compare(KeyedElement other);
-
- public Object getKey();
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/KeyedHashSet.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/KeyedHashSet.java
deleted file mode 100644
index 0e0c579..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/KeyedHashSet.java
+++ /dev/null
@@ -1,316 +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.registry;
-
-/**
- * Note this is a copy of a data structure from OSGi, package
- * org.eclipse.osgi.framework.internal.core. Unused methods were removed
- * from this copy.
- */
-public class KeyedHashSet {
- protected static final int MINIMUM_SIZE = 7;
- private int capacity;
- protected int elementCount = 0;
- protected KeyedElement[] elements;
- protected boolean replace;
-
- public KeyedHashSet() {
- this(MINIMUM_SIZE, true);
- }
-
- public KeyedHashSet(int capacity) {
- this(capacity, true);
- }
-
- public KeyedHashSet(int capacity, boolean replace) {
- elements = new KeyedElement[Math.max(MINIMUM_SIZE, capacity * 2)];
- this.replace = replace;
- this.capacity = capacity;
- }
-
- /**
- * Adds an element to this set. If an element with the same key already exists,
- * replaces it depending on the replace flag.
- * @return true if the element was added/stored, false otherwise
- */
- public boolean add(KeyedElement element) {
- int hash = hash(element);
-
- // search for an empty slot at the end of the array
- for (int i = hash; i < elements.length; i++) {
- if (elements[i] == null) {
- elements[i] = element;
- elementCount++;
- // grow if necessary
- if (shouldGrow())
- expand();
- return true;
- }
- if (elements[i].compare(element)) {
- if (replace)
- elements[i] = element;
- return replace;
- }
- }
-
- // search for an empty slot at the beginning of the array
- for (int i = 0; i < hash - 1; i++) {
- if (elements[i] == null) {
- elements[i] = element;
- elementCount++;
- // grow if necessary
- if (shouldGrow())
- expand();
- return true;
- }
- if (elements[i].compare(element)) {
- if (replace)
- elements[i] = element;
- return replace;
- }
- }
-
- // if we didn't find a free slot, then try again with the expanded set
- expand();
- return add(element);
- }
-
- public void clear() {
- elements = new KeyedElement[Math.max(MINIMUM_SIZE, capacity * 2)];
- elementCount = 0;
- }
-
- public KeyedElement[] elements() {
- return (KeyedElement[]) elements(new KeyedElement[elementCount]);
- }
-
- public Object[] elements(Object[] result) {
- int j = 0;
- for (int i = 0; i < elements.length; i++) {
- KeyedElement element = elements[i];
- if (element != null)
- result[j++] = element;
- }
- return result;
- }
-
- /**
- * The array isn't large enough so double its size and rehash
- * all its current values.
- */
- protected void expand() {
- KeyedElement[] oldElements = elements;
- elements = new KeyedElement[elements.length * 2];
-
- int maxArrayIndex = elements.length - 1;
- for (int i = 0; i < oldElements.length; i++) {
- KeyedElement element = oldElements[i];
- if (element != null) {
- int hash = hash(element);
- while (elements[hash] != null) {
- hash++;
- if (hash > maxArrayIndex)
- hash = 0;
- }
- elements[hash] = element;
- }
- }
- }
-
- /**
- * Returns the set element with the given id, or null
- * if not found.
- */
- public KeyedElement get(KeyedElement key) {
- if (elementCount == 0)
- return null;
- int hash = hash(key);
-
- // search the last half of the array
- for (int i = hash; i < elements.length; i++) {
- KeyedElement element = elements[i];
- if (element == null)
- return null;
- if (element.compare(key))
- return element;
- }
-
- // search the beginning of the array
- for (int i = 0; i < hash - 1; i++) {
- KeyedElement element = elements[i];
- if (element == null)
- return null;
- if (element.compare(key))
- return element;
- }
-
- // nothing found so return null
- return null;
- }
-
- /**
- * Returns the set element with the given id, or null
- * if not found.
- */
- public KeyedElement getByKey(Object key) {
- if (elementCount == 0)
- return null;
- int hash = keyHash(key);
-
- // search the last half of the array
- for (int i = hash; i < elements.length; i++) {
- KeyedElement element = elements[i];
- if (element == null)
- return null;
- if (element.getKey().equals(key))
- return element;
- }
-
- // search the beginning of the array
- for (int i = 0; i < hash - 1; i++) {
- KeyedElement element = elements[i];
- if (element == null)
- return null;
- if (element.getKey().equals(key))
- return element;
- }
-
- // nothing found so return null
- return null;
- }
-
- private int hash(KeyedElement element) {
- return Math.abs(element.getKeyHashCode()) % elements.length;
- }
-
- public boolean isEmpty() {
- return elementCount == 0;
- }
-
- private int keyHash(Object key) {
- return Math.abs(key.hashCode()) % elements.length;
- }
-
- /**
- * The element at the given index has been removed so move
- * elements to keep the set properly hashed.
- */
- protected void rehashTo(int anIndex) {
-
- int target = anIndex;
- int index = anIndex + 1;
- if (index >= elements.length)
- index = 0;
- KeyedElement element = elements[index];
- while (element != null) {
- int hashIndex = hash(element);
- boolean match;
- if (index < target)
- match = !(hashIndex > target || hashIndex <= index);
- else
- match = !(hashIndex > target && hashIndex <= index);
- if (match) {
- elements[target] = element;
- target = index;
- }
- index++;
- if (index >= elements.length)
- index = 0;
- element = elements[index];
- }
- elements[target] = null;
- }
-
- public boolean remove(KeyedElement toRemove) {
- if (elementCount == 0)
- return false;
-
- int hash = hash(toRemove);
-
- for (int i = hash; i < elements.length; i++) {
- KeyedElement element = elements[i];
- if (element == null)
- return false;
- if (element.compare(toRemove)) {
- rehashTo(i);
- elementCount--;
- return true;
- }
- }
-
- for (int i = 0; i < hash - 1; i++) {
- KeyedElement element = elements[i];
- if (element == null)
- return false;
- if (element.compare(toRemove)) {
- rehashTo(i);
- elementCount--;
- return true;
- }
- }
- return false;
- }
-
- public boolean removeByKey(Object key) {
- if (elementCount == 0)
- return false;
- int hash = keyHash(key);
-
- for (int i = hash; i < elements.length; i++) {
- KeyedElement element = elements[i];
- if (element == null)
- return false;
- if (element.getKey().equals(key)) {
- rehashTo(i);
- elementCount--;
- return true;
- }
- }
-
- for (int i = 0; i < hash - 1; i++) {
- KeyedElement element = elements[i];
- if (element == null)
- return false;
- if (element.getKey().equals(key)) {
- rehashTo(i);
- elementCount--;
- return true;
- }
- }
-
- return true;
- }
-
- private boolean shouldGrow() {
- return elementCount > elements.length * 0.75;
- }
-
- public int size() {
- return elementCount;
- }
-
- public String toString() {
- StringBuffer result = new StringBuffer(100);
- result.append("{"); //$NON-NLS-1$
- boolean first = true;
- for (int i = 0; i < elements.length; i++) {
- if (elements[i] != null) {
- if (first)
- first = false;
- else
- result.append(", "); //$NON-NLS-1$
- result.append(elements[i]);
- }
- }
- result.append("}"); //$NON-NLS-1$
- return result.toString();
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ReadWriteMonitor.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ReadWriteMonitor.java
deleted file mode 100644
index 2c93ee9..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ReadWriteMonitor.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-/**
- * Monitor ensuring no more than one writer working concurrently.
- * Multiple readers are allowed to perform simultaneously.
- *
- * This class was borrowed from org.eclipse.jdt.internal.core.search.indexing.
- */
-public class ReadWriteMonitor {
-
- /**
- * <0 : writing (cannot go beyond -1, i.e one concurrent writer)
- * =0 : idle
- * >0 : reading (number of concurrent readers)
- */
- private int status = 0;
-
- private Thread writeLockowner;
-
- /**
- * Concurrent reading is allowed
- * Blocking only when already writing.
- */
- public synchronized void enterRead() {
- if (writeLockowner == Thread.currentThread())
- return;
- while (status < 0) {
- try {
- wait();
- } catch (InterruptedException e) {
- // ignore
- }
- }
- status++;
- }
-
- /**
- * Only one writer at a time is allowed to perform
- * Blocking only when already writing or reading.
- */
- public synchronized void enterWrite() {
- if (writeLockowner != Thread.currentThread()) {
- while (status != 0) {
- try {
- wait();
- } catch (InterruptedException e) {
- // ignore
- }
- }
-// System.out.println(this + "lockowner:" + Thread.currentThread());
- writeLockowner = Thread.currentThread();
- }
- status--;
- }
-
- /**
- * Only notify waiting writer(s) if last reader
- */
- public synchronized void exitRead() {
- if (writeLockowner == Thread.currentThread())
- return;
- if (--status == 0)
- notifyAll();
- }
-
- /**
- * When writing is over, all readers and possible
- * writers are granted permission to restart concurrently
- */
- public synchronized void exitWrite() {
- if (writeLockowner != Thread.currentThread())
- throw new IllegalStateException("Current owner is " + writeLockowner); //$NON-NLS-1$
- if (++status == 0) {
-// System.out.println(this + "exitWrite:" + Thread.currentThread());
- writeLockowner = null;
- notifyAll();
- }
- }
-
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append(this.hashCode());
- if (status == 0) {
- buffer.append("Monitor idle "); //$NON-NLS-1$
- } else if (status < 0) {
- buffer.append("Monitor writing "); //$NON-NLS-1$
- } else if (status > 0) {
- buffer.append("Monitor reading "); //$NON-NLS-1$
- }
- buffer.append("(status = "); //$NON-NLS-1$
- buffer.append(this.status);
- buffer.append(")"); //$NON-NLS-1$
- return buffer.toString();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ReferenceHashSet.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ReferenceHashSet.java
deleted file mode 100644
index 83c4ef0..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ReferenceHashSet.java
+++ /dev/null
@@ -1,324 +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.registry;
-
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.SoftReference;
-import java.lang.ref.WeakReference;
-
-/**
- * A hashset whose values can be garbage collected.
- * This API is EXPERIMENTAL and provided as early access.
- * @since 3.1
- */
-public class ReferenceHashSet {
-
- private interface HashedReference {
- int hashCode();
- Object get();
- }
-
- private class HashableWeakReference extends WeakReference implements HashedReference {
- public int hashCode;
-
- public HashableWeakReference(Object referent, ReferenceQueue queue) {
- super(referent, queue);
- this.hashCode = referent.hashCode();
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof HashableWeakReference))
- return false;
- Object referent = get();
- Object other = ((HashableWeakReference) obj).get();
- if (referent == null)
- return other == null;
- return referent.equals(other);
- }
-
- public int hashCode() {
- return this.hashCode;
- }
-
- public String toString() {
- Object referent = get();
- if (referent == null)
- return "[hashCode=" + this.hashCode + "] <referent was garbage collected>"; //$NON-NLS-1$ //$NON-NLS-2$
- return "[hashCode=" + this.hashCode + "] " + referent.toString(); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- private class HashableSoftReference extends SoftReference implements HashedReference {
- public int hashCode;
-
- public HashableSoftReference(Object referent, ReferenceQueue queue) {
- super(referent, queue);
- this.hashCode = referent.hashCode();
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof HashableWeakReference))
- return false;
- Object referent = get();
- Object other = ((HashableWeakReference) obj).get();
- if (referent == null)
- return other == null;
- return referent.equals(other);
- }
-
- public int hashCode() {
- return this.hashCode;
- }
-
- public String toString() {
- Object referent = get();
- if (referent == null)
- return "[hashCode=" + this.hashCode + "] <referent was garbage collected>"; //$NON-NLS-1$ //$NON-NLS-2$
- return "[hashCode=" + this.hashCode + "] " + referent.toString(); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- private class StrongReference implements HashedReference {
- private Object referent;
-
- public StrongReference(Object referent, ReferenceQueue queue) {
- this.referent = referent;
- }
-
- public int hashCode() {
- return referent.hashCode();
- }
-
- public Object get() {
- return referent;
- }
-
- public boolean equals(Object obj) {
- return referent.equals(obj);
- }
- }
-
- HashedReference[] values;
-
- public int elementSize; // number of elements in the table
-
- int threshold;
-
- ReferenceQueue referenceQueue = new ReferenceQueue();
-
- public ReferenceHashSet() {
- this(5);
- }
-
- public ReferenceHashSet(int size) {
- this.elementSize = 0;
- this.threshold = size; // size represents the expected
- // number of elements
- int extraRoom = (int) (size * 1.75f);
- if (this.threshold == extraRoom)
- extraRoom++;
- this.values = new HashedReference[extraRoom];
- }
-
- /**
- * Constant indicating that hard references should be used.
- */
- final public static int HARD = 0;
-
- /**
- * Constant indiciating that soft references should be used.
- */
- final public static int SOFT = 1;
-
- /**
- * Constant indicating that weak references should be used.
- */
- final public static int WEAK = 2;
-
- private HashedReference toReference(int type, Object referent) {
- switch (type) {
- case HARD:
- return new StrongReference(referent, referenceQueue);
- case SOFT:
- return new HashableSoftReference(referent, referenceQueue);
- case WEAK:
- return new HashableWeakReference(referent, referenceQueue);
- default:
- throw new Error();
- }
- }
-
- /*
- * Adds the given object to this set. If an object that is equals to the
- * given object already exists, do nothing. Returns the existing object or
- * the new object if not found.
- */
- public Object add(Object obj, int referenceType) {
- cleanupGarbageCollectedValues();
- int index = (obj.hashCode() & 0x7FFFFFFF) % this.values.length;
- HashedReference currentValue;
- while ((currentValue = this.values[index]) != null) {
- Object referent;
- if (obj.equals(referent = currentValue.get())) {
- return referent;
- }
- index = (index + 1) % this.values.length;
- }
- this.values[index] = toReference(referenceType, obj);
-
- // assumes the threshold is never equal to the size of the table
- if (++this.elementSize > this.threshold)
- rehash();
-
- return obj;
- }
-
- private void addValue(HashedReference value) {
- Object obj = value.get();
- if (obj == null)
- return;
- int valuesLength = this.values.length;
- int index = (value.hashCode() & 0x7FFFFFFF) % valuesLength;
- HashedReference currentValue;
- while ((currentValue = this.values[index]) != null) {
- if (obj.equals(currentValue.get())) {
- return;
- }
- index = (index + 1) % valuesLength;
- }
- this.values[index] = value;
-
- // assumes the threshold is never equal to the size of the table
- if (++this.elementSize > this.threshold)
- rehash();
- }
-
- private void cleanupGarbageCollectedValues() {
- HashedReference toBeRemoved;
- while ((toBeRemoved = (HashedReference) this.referenceQueue.poll()) != null) {
- int hashCode = toBeRemoved.hashCode();
- int valuesLength = this.values.length;
- int index = (hashCode & 0x7FFFFFFF) % valuesLength;
- HashedReference currentValue;
- while ((currentValue = this.values[index]) != null) {
- if (currentValue == toBeRemoved) {
- // replace the value at index with the last value with the
- // same hash
- int sameHash = index;
- int current;
- while ((currentValue = this.values[current = (sameHash + 1) % valuesLength]) != null && currentValue.hashCode() == hashCode)
- sameHash = current;
- this.values[index] = this.values[sameHash];
- this.values[sameHash] = null;
- this.elementSize--;
- break;
- }
- index = (index + 1) % valuesLength;
- }
- }
- }
-
- public boolean contains(Object obj) {
- return get(obj) != null;
- }
-
- /*
- * Return the object that is in this set and that is equals to the given
- * object. Return null if not found.
- */
- public Object get(Object obj) {
- cleanupGarbageCollectedValues();
- int valuesLength = this.values.length;
- int index = (obj.hashCode() & 0x7FFFFFFF) % valuesLength;
- HashedReference currentValue;
- while ((currentValue = this.values[index]) != null) {
- Object referent;
- if (obj.equals(referent = currentValue.get())) {
- return referent;
- }
- index = (index + 1) % valuesLength;
- }
- return null;
- }
-
- private void rehash() {
- ReferenceHashSet newHashSet = new ReferenceHashSet(this.elementSize * 2); // double the number of expected elements
- newHashSet.referenceQueue = this.referenceQueue;
- HashedReference currentValue;
- for (int i = 0, length = this.values.length; i < length; i++)
- if ((currentValue = this.values[i]) != null)
- newHashSet.addValue(currentValue);
-
- this.values = newHashSet.values;
- this.threshold = newHashSet.threshold;
- this.elementSize = newHashSet.elementSize;
- }
-
- /*
- * Removes the object that is in this set and that is equals to the given
- * object. Return the object that was in the set, or null if not found.
- */
- public Object remove(Object obj) {
- cleanupGarbageCollectedValues();
- int valuesLength = this.values.length;
- int index = (obj.hashCode() & 0x7FFFFFFF) % valuesLength;
- HashedReference currentValue;
- while ((currentValue = this.values[index]) != null) {
- Object referent;
- if (obj.equals(referent = currentValue.get())) {
- this.elementSize--;
- this.values[index] = null;
- rehash();
- return referent;
- }
- index = (index + 1) % valuesLength;
- }
- return null;
- }
-
- public int size() {
- return this.elementSize;
- }
-
- public String toString() {
- StringBuffer buffer = new StringBuffer("{"); //$NON-NLS-1$
- for (int i = 0, length = this.values.length; i < length; i++) {
- HashedReference value = this.values[i];
- if (value != null) {
- Object ref = value.get();
- if (ref != null) {
- buffer.append(ref.toString());
- buffer.append(", "); //$NON-NLS-1$
- }
- }
- }
- buffer.append("}"); //$NON-NLS-1$
- return buffer.toString();
- }
-
- public Object[] toArray() {
- cleanupGarbageCollectedValues();
- Object[] result = new Object[elementSize];
- int resultSize = 0;
- for (int i = 0; i < values.length; i++) {
- if (values[i] == null)
- continue;
- Object tmp = values[i].get();
- if (tmp != null)
- result[resultSize++] = tmp;
- }
- if (result.length == resultSize)
- return result;
- Object[] finalResult = new Object[resultSize];
- System.arraycopy(result, 0, finalResult, 0, resultSize);
- return finalResult;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ReferenceMap.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ReferenceMap.java
deleted file mode 100644
index 2da387c..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ReferenceMap.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/**
- * Copyright 2001-2004 The Apache Software Foundation
- * Portions (modifications) Copyright 2004-2005 IBM Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * Apache Software Foundation - Initial implementation
- * Pascal Rapicault, IBM - Pascal remove the entrySet() implementation because it relied on another class.
- * IBM - change to int keys, remove support for weak references, and remove unused methods
- */
-package org.eclipse.core.internal.registry;
-
-import java.lang.ref.*;
-
-/**
- * Hashtable-based map with integer keys that allows values to be removed
- * by the garbage collector.<P>
- *
- * When you construct a <Code>ReferenceMap</Code>, you can
- * specify what kind of references are used to store the
- * map's values. If non-hard references are
- * used, then the garbage collector can remove mappings
- * if a value becomes unreachable, or if the
- * JVM's memory is running low. For information on how
- * the different reference types behave, see
- * {@link Reference}.<P>
- *
- * The algorithms used are basically the same as those
- * in {@link java.util.HashMap}. In particular, you
- * can specify a load factor and capacity to suit your
- * needs.
- *
- * This map does <I>not</I> allow null values. Attempting to add a null
- * value to the map will raise a <Code>NullPointerException</Code>.<P>
- *
- * This data structure is not synchronized.
- *
- * @see java.lang.ref.Reference
- */
-public class ReferenceMap {
-
- /**
- * IEntry implementation that acts as a hard reference.
- * The value of a hard reference entry is never garbage
- * collected until it is explicitly removed from the map.
- */
- private static class HardRef implements IEntry {
-
- private int key;
- private IEntry next;
- /**
- * Reference value. Note this can never be null.
- */
- private Object value;
-
- public HardRef(int key, Object value, IEntry next) {
- this.key = key;
- this.value = value;
- this.next = next;
- }
-
- public int getKey() {
- return key;
- }
-
- public IEntry getNext() {
- return next;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setNext(IEntry next) {
- this.next = next;
- }
-
- public String toString() {
- return "HardRef(" + key + ',' + value + ')'; //$NON-NLS-1$
- }
- }
-
- /**
- * The common interface for all elements in the map. Both
- * hard and soft map values conform to this interface.
- */
- private static interface IEntry {
- /**
- * Returns the integer key for this entry.
- * @return The integer key
- */
- public int getKey();
-
- /**
- * Returns the next entry in the linked list of entries
- * with the same hash value, or <code>null</code>
- * if there is no next entry.
- * @return The next entry, or <code>null</code>.
- */
- public IEntry getNext();
-
- /**
- * Returns the value of this entry.
- * @return The entry value.
- */
- public Object getValue();
-
- /**
- * Sets the next entry in the linked list of map entries
- * with the same hash value.
- *
- * @param next The next entry, or <code>null</code>.
- */
- public void setNext(IEntry next);
- }
-
- /**
- * Augments a normal soft reference with additional information
- * required to implement the IEntry interface.
- */
- private static class SoftRef extends SoftReference implements IEntry {
- private int key;
- /**
- * For chained collisions
- */
- private IEntry next;
-
- public SoftRef(int key, Object value, IEntry next, ReferenceQueue q) {
- super(value, q);
- this.key = key;
- this.next = next;
- }
-
- public int getKey() {
- return key;
- }
-
- public IEntry getNext() {
- return next;
- }
-
- public Object getValue() {
- return super.get();
- }
-
- public void setNext(IEntry next) {
- this.next = next;
- }
- }
-
- /**
- * Constant indicating that hard references should be used.
- */
- final public static int HARD = 0;
-
- /**
- * Constant indiciating that soft references should be used.
- */
- final public static int SOFT = 1;
-
- private int entryCount;
-
- /**
- * The threshold variable is calculated by multiplying
- * table.length and loadFactor.
- * Note: I originally marked this field as final, but then this class
- * didn't compile under JDK1.2.2.
- * @serial
- */
- private float loadFactor;
-
- /**
- * ReferenceQueue used to eliminate stale mappings.
- */
- private transient ReferenceQueue queue = new ReferenceQueue();
-
- /**
- * Number of mappings in this map.
- */
- private transient int size;
-
- /**
- * The hash table. Its length is always a power of two.
- */
- private transient IEntry[] table;
-
- /**
- * When size reaches threshold, the map is resized.
- * @see #resize()
- */
- private transient int threshold;
-
- /**
- * The reference type for values. Must be HARD or SOFT
- * Note: I originally marked this field as final, but then this class
- * didn't compile under JDK1.2.2.
- * @serial
- */
- int valueType;
-
- /**
- * Constructs a new <Code>ReferenceMap</Code> with the
- * specified reference type, load factor and initial
- * capacity.
- *
- * @param referenceType the type of reference to use for values;
- * must be {@link #HARD} or {@link #SOFT}
- * @param capacity the initial capacity for the map
- * @param loadFactor the load factor for the map
- */
- public ReferenceMap(int referenceType, int capacity, float loadFactor) {
- super();
- if (referenceType != HARD && referenceType != SOFT)
- throw new IllegalArgumentException(" must be HARD or SOFT."); //$NON-NLS-1$
- if (capacity <= 0)
- throw new IllegalArgumentException("capacity must be positive"); //$NON-NLS-1$
- if ((loadFactor <= 0.0f) || (loadFactor >= 1.0f))
- throw new IllegalArgumentException("Load factor must be greater than 0 and less than 1."); //$NON-NLS-1$
-
- this.valueType = referenceType;
-
- int initialSize = 1;
- while (initialSize < capacity)
- initialSize *= 2;
-
- this.table = new IEntry[initialSize];
- this.loadFactor = loadFactor;
- this.threshold = (int) (initialSize * loadFactor);
- }
-
- /**
- * @param key
- * @return
- */
- private Object doRemove(int key) {
- int index = indexFor(key);
- IEntry previous = null;
- IEntry entry = table[index];
- while (entry != null) {
- if (key == entry.getKey()) {
- if (previous == null)
- table[index] = entry.getNext();
- else
- previous.setNext(entry.getNext());
- this.size--;
- return entry.getValue();
- }
- previous = entry;
- entry = entry.getNext();
- }
- return null;
- }
-
- /**
- * Returns the value associated with the given key, if any.
- *
- * @return the value associated with the given key, or <Code>null</Code>
- * if the key maps to no value
- */
- public Object get(int key) {
- purge();
- for (IEntry entry = table[indexFor(key)]; entry != null; entry = entry.getNext())
- if (entry.getKey() == key)
- return entry.getValue();
- return null;
- }
-
- /**
- * Converts the given hash code into an index into the
- * hash table.
- */
- private int indexFor(int hash) {
- // mix the bits to avoid bucket collisions...
- hash += ~(hash << 15);
- hash ^= (hash >>> 10);
- hash += (hash << 3);
- hash ^= (hash >>> 6);
- hash += ~(hash << 11);
- hash ^= (hash >>> 16);
- return hash & (table.length - 1);
- }
-
- /**
- * Constructs a new table entry for the given data
- *
- * @param key The entry key
- * @param value The entry value
- * @param next The next value in the entry's collision chain
- * @return The new table entry
- */
- private IEntry newEntry(int key, Object value, IEntry next) {
- entryCount++;
- switch (valueType) {
- case HARD :
- return new HardRef(key, value, next);
- case SOFT :
- return new SoftRef(key, value, next, queue);
- default :
- throw new Error();
- }
- }
-
- /**
- * Purges stale mappings from this map.<P>
- *
- * Ordinarily, stale mappings are only removed during
- * a write operation; typically a write operation will
- * occur often enough that you'll never need to manually
- * invoke this method.<P>
- *
- * Note that this method is not synchronized! Special
- * care must be taken if, for instance, you want stale
- * mappings to be removed on a periodic basis by some
- * background thread.
- */
- private void purge() {
- Reference ref = queue.poll();
- while (ref != null) {
- doRemove(((IEntry) ref).getKey());
- ref.clear();
- ref = queue.poll();
- }
- }
-
- /**
- * Associates the given key with the given value.<P>
- * Neither the key nor the value may be null.
- *
- * @param key the key of the mapping
- * @param value the value of the mapping
- * @throws NullPointerException if either the key or value
- * is null
- */
- public void put(int key, Object value) {
- if (value == null)
- throw new NullPointerException("null values not allowed"); //$NON-NLS-1$
-
- purge();
-
- if (size + 1 > threshold)
- resize();
-
- int index = indexFor(key);
- IEntry previous = null;
- IEntry entry = table[index];
- while (entry != null) {
- if (key == entry.getKey()) {
- if (previous == null)
- table[index] = newEntry(key, value, entry.getNext());
- else
- previous.setNext(newEntry(key, value, entry.getNext()));
- return;
- }
- previous = entry;
- entry = entry.getNext();
- }
- this.size++;
- table[index] = newEntry(key, value, table[index]);
- }
-
- /**
- * Removes the key and its associated value from this map.
- *
- * @param key the key to remove
- * @return the value associated with that key, or null if
- * the key was not in the map
- */
- public Object remove(int key) {
- purge();
- return doRemove(key);
- }
-
- /**
- * Resizes this hash table by doubling its capacity.
- * This is an expensive operation, as entries must
- * be copied from the old smaller table to the new
- * bigger table.
- */
- private void resize() {
- IEntry[] old = table;
- table = new IEntry[old.length * 2];
-
- for (int i = 0; i < old.length; i++) {
- IEntry next = old[i];
- while (next != null) {
- IEntry entry = next;
- next = next.getNext();
- int index = indexFor(entry.getKey());
- entry.setNext(table[index]);
- table[index] = entry;
- }
- old[i] = null;
- }
- threshold = (int) (table.length * loadFactor);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryChangeEvent.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryChangeEvent.java
deleted file mode 100644
index 54bf27e..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryChangeEvent.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import java.util.Arrays;
-import java.util.Map;
-import org.eclipse.core.runtime.IExtensionDelta;
-import org.eclipse.core.runtime.IRegistryChangeEvent;
-
-/**
- * A registry change event implementation. A filter can be specified. In that case, only
- * deltas for the selected host will be available to clients.
- */
-public final class RegistryChangeEvent implements IRegistryChangeEvent {
- private String filter;
- private Map deltas;
-
- RegistryChangeEvent(Map deltas, String filter) {
- this.deltas = deltas;
- this.filter = filter;
- }
-
- private RegistryDelta[] getHostDeltas() {
- // if there is a filter, return only the delta for the selected plug-in
- if (filter != null) {
- RegistryDelta singleDelta = getHostDelta(filter);
- return singleDelta == null ? new RegistryDelta[0] : new RegistryDelta[] {singleDelta};
- }
- // there is no filter - return all deltas
- return (RegistryDelta[]) deltas.values().toArray(new RegistryDelta[deltas.size()]);
- }
-
- private RegistryDelta getHostDelta(String pluginId) {
- if (filter != null && !pluginId.equals(filter))
- return null;
- return (RegistryDelta) deltas.get(pluginId);
- }
-
- public IExtensionDelta[] getExtensionDeltas() {
- RegistryDelta[] hostDeltas = getHostDeltas();
- if (hostDeltas.length == 0)
- return new IExtensionDelta[0];
- int extensionDeltasSize = 0;
- for (int i = 0; i < hostDeltas.length; i++)
- extensionDeltasSize += hostDeltas[i].getExtensionDeltasCount();
- IExtensionDelta[] extensionDeltas = new IExtensionDelta[extensionDeltasSize];
- for (int i = 0, offset = 0; i < hostDeltas.length; i++) {
- IExtensionDelta[] hostExtDeltas = hostDeltas[i].getExtensionDeltas();
- System.arraycopy(hostExtDeltas, 0, extensionDeltas, offset, hostExtDeltas.length);
- offset += hostExtDeltas.length;
- }
- return extensionDeltas;
- }
-
- public IExtensionDelta[] getExtensionDeltas(String hostName) {
- RegistryDelta hostDelta = getHostDelta(hostName);
- if (hostDelta == null)
- return new IExtensionDelta[0];
- return hostDelta.getExtensionDeltas();
- }
-
- public IExtensionDelta[] getExtensionDeltas(String hostName, String extensionPoint) {
- RegistryDelta hostDelta = getHostDelta(hostName);
- if (hostDelta == null)
- return new IExtensionDelta[0];
- return hostDelta.getExtensionDeltas(hostName + '.' + extensionPoint);
- }
-
- public IExtensionDelta getExtensionDelta(String hostName, String extensionPoint, String extension) {
- RegistryDelta hostDelta = getHostDelta(hostName);
- if (hostDelta == null)
- return null;
- return hostDelta.getExtensionDelta(hostName + '.' + extensionPoint, extension);
- }
-
- public String toString() {
- return "RegistryChangeEvent: " + Arrays.asList(getHostDeltas()); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryDelta.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryDelta.java
deleted file mode 100644
index 86024a2..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryDelta.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import java.util.*;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionDelta;
-
-/**
- * The extension deltas are grouped by namespace. There is one registry delta by namespace.
- */
-public class RegistryDelta {
- private Set extensionDeltas = new HashSet(); //the extension deltas (each element indicate the type of the delta)
- private IObjectManager objectManager; //The object manager from which all the objects contained in the deltas will be found.
-
- RegistryDelta() {
- //Nothing to do
- }
-
- public int getExtensionDeltasCount() {
- return extensionDeltas.size();
- }
-
- public IExtensionDelta[] getExtensionDeltas() {
- return (IExtensionDelta[]) extensionDeltas.toArray(new ExtensionDelta[extensionDeltas.size()]);
- }
-
- public IExtensionDelta[] getExtensionDeltas(String extensionPoint) {
- Collection selectedExtDeltas = new LinkedList();
- for (Iterator extDeltasIter = extensionDeltas.iterator(); extDeltasIter.hasNext();) {
- IExtensionDelta extensionDelta = (IExtensionDelta) extDeltasIter.next();
- if (extensionDelta.getExtension().getExtensionPointUniqueIdentifier().equals(extensionPoint))
- selectedExtDeltas.add(extensionDelta);
- }
- return (IExtensionDelta[]) selectedExtDeltas.toArray(new IExtensionDelta[selectedExtDeltas.size()]);
- }
-
- /**
- * @param extensionPointId
- * @param extensionId must not be null
- */
- public IExtensionDelta getExtensionDelta(String extensionPointId, String extensionId) {
- for (Iterator extDeltasIter = extensionDeltas.iterator(); extDeltasIter.hasNext();) {
- IExtensionDelta extensionDelta = (IExtensionDelta) extDeltasIter.next();
- IExtension extension = extensionDelta.getExtension();
- if (extension.getExtensionPointUniqueIdentifier().equals(extensionPointId) && extension.getUniqueIdentifier() != null && extension.getUniqueIdentifier().equals(extensionId))
- return extensionDelta;
- }
- return null;
- }
-
- void addExtensionDelta(IExtensionDelta extensionDelta) {
- this.extensionDeltas.add(extensionDelta);
- ((ExtensionDelta) extensionDelta).setContainingDelta(this);
- }
-
- public String toString() {
- return "\n\tHost " + ": " + extensionDeltas; //$NON-NLS-1$//$NON-NLS-2$
- }
-
- void setObjectManager(IObjectManager objectManager) {
- this.objectManager = objectManager;
- //TODO May want to add into the existing one here... if it is possible to have batching
- }
-
- IObjectManager getObjectManager() {
- return objectManager;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryObject.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryObject.java
deleted file mode 100644
index 4bc8004..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryObject.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-/**
- * An object which has the general characteristics of all the nestable elements
- * in a plug-in manifest.
- */
-public abstract class RegistryObject implements KeyedElement {
- //Object identifier
- private int objectId = RegistryObjectManager.UNKNOWN;
- //The children of the element
- protected int[] children = RegistryObjectManager.EMPTY_INT_ARRAY;
- //The position of the extra data when available
- protected int extraDataOffset = -1;
-
- void setRawChildren(int[] values) {
- children = values;
- }
-
- //This can not return null. It returns the singleton empty array or an array
- int[] getRawChildren() {
- return children;
- }
-
- void setObjectId(int value) {
- objectId = value;
- }
-
- int getObjectId() {
- return objectId;
- }
-
- //Implementation of the KeyedElement interface
- public int getKeyHashCode() {
- return objectId;
- }
-
- public Object getKey() {
- return new Integer(objectId);
- }
-
- public boolean compare(KeyedElement other) {
- return objectId == ((RegistryObject) other).objectId;
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryObjectManager.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryObjectManager.java
deleted file mode 100644
index f733511..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/RegistryObjectManager.java
+++ /dev/null
@@ -1,516 +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.registry;
-
-import java.lang.ref.SoftReference;
-import java.util.*;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
-
-/**
- * This class manage all the object from the registry but does not deal with their dependencies.
- * It serves the objects which are either directly obtained from memory or read from a cache.
- * It also returns handles for objects.
- */
-public class RegistryObjectManager implements IObjectManager {
- //Constants used to get the objects and their handles
- static final byte CONFIGURATION_ELEMENT = 1;
- static final byte EXTENSION = 2;
- static final byte EXTENSION_POINT = 3;
- static final byte THIRDLEVEL_CONFIGURATION_ELEMENT = 4;
-
- static final int CACHE_INITIAL_SIZE = 512; //This value has been picked because it is the minimal size required to startup an RCP app. (FYI, eclipse requires 3 growths).
- static final float DEFAULT_LOADFACTOR = 0.75f; //This is the default factor used in reference map.
-
- static final int[] EMPTY_INT_ARRAY = new int[0];
- static final String[] EMPTY_STRING_ARRAY = new String[0];
-
- static int UNKNOWN = -1;
-
- // key: extensionPointName, value: object id
- private HashtableOfStringAndInt extensionPoints; //This is loaded on startup. Then entries can be added when loading a new plugin from the xml.
- // key: object id, value: an object
- private ReferenceMap cache; //Entries are added by getter. The structure is not thread safe.
- //key: int, value: int
- private HashtableOfInt fileOffsets; //This is read once on startup when loading from the cache. Entries are never added here. They are only removed to prevent "removed" objects to be reloaded.
-
- private int nextId = 1; //This is only used to get the next number available.
-
- //Those two data structures are only used when the addition or the removal of a plugin occurs.
- //They are used to keep track on a bundle basis of the extension being added or removed
- private KeyedHashSet newContributions; //represents the bundles added during this session.
- private Object formerContributions; //represents the bundles encountered in previous sessions. This is loaded lazily.
-
- // Map key: extensionPointFullyQualifiedName, value int[] of orphan extensions.
- // The orphan access does not need to be synchronized because the it is protected by the lock in extension registry.
- private Object orphanExtensions;
-
- private KeyedHashSet heldObjects = new KeyedHashSet(); //strong reference to the objects that must be hold on to
-
- //Indicate if objects have been removed or added from the table. This only needs to be set in a couple of places (addNamespace and removeNamespace)
- private boolean isDirty = false;
-
- private boolean fromCache = false;
-
- public RegistryObjectManager() {
- extensionPoints = new HashtableOfStringAndInt();
- if ("true".equalsIgnoreCase(System.getProperty(InternalPlatform.PROP_NO_REGISTRY_FLUSHING))) { //$NON-NLS-1$
- cache = new ReferenceMap(ReferenceMap.HARD, CACHE_INITIAL_SIZE, DEFAULT_LOADFACTOR);
- } else {
- cache = new ReferenceMap(ReferenceMap.SOFT, CACHE_INITIAL_SIZE, DEFAULT_LOADFACTOR);
- }
- newContributions = new KeyedHashSet();
- fileOffsets = new HashtableOfInt();
- }
-
- /**
- * Initialize the object manager. Return true if the initialization succeeded, false otherwise
- */
- synchronized boolean init(long timeStamp) {
- TableReader reader = new TableReader();
- Object[] results = reader.loadTables(timeStamp);
- if (results == null) {
- return false;
- }
- fileOffsets = (HashtableOfInt) results[0];
- extensionPoints = (HashtableOfStringAndInt) results[1];
- nextId = ((Integer) results[2]).intValue();
- fromCache = true;
-
- if ("true".equalsIgnoreCase(System.getProperty(InternalPlatform.PROP_NO_LAZY_CACHE_LOADING))) { //$NON-NLS-1$
- //TODO Here we could grow all the tables to the right size (ReferenceMap)
- reader.setHoldObjects(true);
- markOrphansHasDirty(getOrphans());
- fromCache = reader.readAllCache(this);
- formerContributions = getFormerContributions();
- }
- return fromCache;
- }
-
- synchronized void addContribution(Contribution contribution) {
- isDirty = true;
- newContributions.add(contribution);
- }
-
- synchronized int[] getExtensionPointsFrom(long id) {
- KeyedElement tmp = newContributions.getByKey(new Long(id));
- if (tmp == null)
- tmp = getFormerContributions().getByKey(new Long(id));
- if (tmp == null)
- return EMPTY_INT_ARRAY;
- return ((Contribution) tmp).getExtensionPoints();
- }
-
- synchronized Set getNamespaces() {
- KeyedElement[] formerElts = getFormerContributions().elements();
- KeyedElement[] newElts = newContributions.elements();
- Set tmp = new HashSet(formerElts.length + newElts.length);
- for (int i = 0; i < formerElts.length; i++) {
- tmp.add(((Contribution) formerElts[i]).getNamespace());
- }
- for (int i = 0; i < newElts.length; i++) {
- tmp.add(((Contribution) newElts[i]).getNamespace());
- }
- return tmp;
- }
-
- synchronized boolean hasContribution(long id) {
- Object result = newContributions.getByKey(new Long(id));
- if (result == null)
- result = getFormerContributions().getByKey(new Long(id));
- return result != null;
- }
-
- private KeyedHashSet getFormerContributions() {
- KeyedHashSet result;
- if (fromCache == false)
- return new KeyedHashSet(0);
-
- if (formerContributions == null || (result = ((KeyedHashSet) ((formerContributions instanceof SoftReference) ? ((SoftReference) formerContributions).get() : formerContributions))) == null) {
- TableReader reader = new TableReader();
- result = reader.loadNamespaces();
- formerContributions = new SoftReference(result);
- }
- return result;
- }
-
- synchronized public void add(RegistryObject registryObject, boolean hold) {
- if (registryObject.getObjectId() == UNKNOWN) {
- int id = nextId++;
- registryObject.setObjectId(id);
- }
- cache.put(registryObject.getObjectId(), registryObject);
- if (hold)
- hold(registryObject);
- }
-
- private void remove(RegistryObject registryObject, boolean release) {
- cache.remove(registryObject.getObjectId());
- if (release)
- release(registryObject);
- }
-
- synchronized void remove(int id, boolean release) {
- RegistryObject toRemove = (RegistryObject) cache.get(id);
- if (fileOffsets != null)
- fileOffsets.removeKey(id);
- if (toRemove != null)
- remove(toRemove, release);
- }
-
- private void hold(RegistryObject toHold) {
- heldObjects.add(toHold);
- }
-
- private void release(RegistryObject toRelease) {
- heldObjects.remove(toRelease);
- }
-
- public synchronized Object getObject(int id, byte type) {
- return basicGetObject(id, type);
- }
-
- private Object basicGetObject(int id, byte type) {
- Object result = cache.get(id);
- if (result != null)
- return result;
- if (fromCache)
- result = load(id, type);
- if (result == null)
- throw new InvalidRegistryObjectException();
- cache.put(id, result);
- return result;
- }
-
- public synchronized RegistryObject[] getObjects(int[] values, byte type) {
- if (values.length == 0) {
- switch (type) {
- case EXTENSION_POINT :
- return ExtensionPoint.EMPTY_ARRAY;
- case EXTENSION :
- return Extension.EMPTY_ARRAY;
- case CONFIGURATION_ELEMENT :
- case THIRDLEVEL_CONFIGURATION_ELEMENT :
- return ConfigurationElement.EMPTY_ARRAY;
- }
- }
-
- RegistryObject[] results = null;
- switch (type) {
- case EXTENSION_POINT :
- results = new ExtensionPoint[values.length];
- break;
- case EXTENSION :
- results = new Extension[values.length];
- break;
- case CONFIGURATION_ELEMENT :
- case THIRDLEVEL_CONFIGURATION_ELEMENT :
- results = new ConfigurationElement[values.length];
- break;
- }
- for (int i = 0; i < values.length; i++) {
- results[i] = (RegistryObject) basicGetObject(values[i], type);
- }
- return results;
- }
-
- synchronized ExtensionPoint getExtensionPointObject(String xptUniqueId) {
- int id;
- if ((id = extensionPoints.get(xptUniqueId)) == HashtableOfStringAndInt.MISSING_ELEMENT)
- return null;
- return (ExtensionPoint) getObject(id, EXTENSION_POINT);
- }
-
- public Handle getHandle(int id, byte type) {
- switch (type) {
- case EXTENSION_POINT :
- return new ExtensionPointHandle(this, id);
-
- case EXTENSION :
- return new ExtensionHandle(this, id);
-
- case CONFIGURATION_ELEMENT :
- return new ConfigurationElementHandle(this, id);
-
- case THIRDLEVEL_CONFIGURATION_ELEMENT :
- default : //avoid compiler error, type should always be known
- return new ThirdLevelConfigurationElementHandle(this, id);
- }
- }
-
- public Handle[] getHandles(int[] ids, byte type) {
- Handle[] results = null;
- int nbrId = ids.length;
- switch (type) {
- case EXTENSION_POINT :
- if (nbrId == 0)
- return ExtensionPointHandle.EMPTY_ARRAY;
- results = new ExtensionPointHandle[nbrId];
- for (int i = 0; i < nbrId; i++) {
- results[i] = new ExtensionPointHandle(this, ids[i]);
- }
- break;
-
- case EXTENSION :
- if (nbrId == 0)
- return ExtensionHandle.EMPTY_ARRAY;
- results = new ExtensionHandle[nbrId];
- for (int i = 0; i < nbrId; i++) {
- results[i] = new ExtensionHandle(this, ids[i]);
- }
- break;
-
- case CONFIGURATION_ELEMENT :
- if (nbrId == 0)
- return ConfigurationElementHandle.EMPTY_ARRAY;
- results = new ConfigurationElementHandle[nbrId];
- for (int i = 0; i < nbrId; i++) {
- results[i] = new ConfigurationElementHandle(this, ids[i]);
- }
- break;
-
- case THIRDLEVEL_CONFIGURATION_ELEMENT :
- if (nbrId == 0)
- return ConfigurationElementHandle.EMPTY_ARRAY;
- results = new ThirdLevelConfigurationElementHandle[nbrId];
- for (int i = 0; i < nbrId; i++) {
- results[i] = new ThirdLevelConfigurationElementHandle(this, ids[i]);
- }
- break;
- }
- return results;
- }
-
- synchronized ExtensionPointHandle[] getExtensionPointsHandles() {
- return (ExtensionPointHandle[]) getHandles(extensionPoints.getValues(), EXTENSION_POINT);
- }
-
- synchronized ExtensionPointHandle getExtensionPointHandle(String xptUniqueId) {
- int id = extensionPoints.get(xptUniqueId);
- if (id == HashtableOfStringAndInt.MISSING_ELEMENT)
- return null;
- return (ExtensionPointHandle) getHandle(id, EXTENSION_POINT);
- }
-
- private Object load(int id, byte type) {
- TableReader reader = new TableReader();
- int offset = fileOffsets.get(id);
- if (offset == Integer.MIN_VALUE)
- return null;
- switch (type) {
- case CONFIGURATION_ELEMENT :
- return reader.loadConfigurationElement(offset);
-
- case THIRDLEVEL_CONFIGURATION_ELEMENT :
- return reader.loadThirdLevelConfigurationElements(offset, this);
-
- case EXTENSION :
- return reader.loadExtension(offset);
-
- case EXTENSION_POINT :
- default : //avoid compile errors. type must always be known
- return reader.loadExtensionPointTree(offset, this);
- }
- }
-
- synchronized int[] getExtensionsFrom(long bundleId) {
- KeyedElement tmp = newContributions.getByKey(new Long(bundleId));
- if (tmp == null)
- tmp = getFormerContributions().getByKey(new Long(bundleId));
- if (tmp == null)
- return EMPTY_INT_ARRAY;
- return ((Contribution) tmp).getExtensions();
- }
-
- synchronized void addExtensionPoint(ExtensionPoint currentExtPoint, boolean hold) {
- add(currentExtPoint, hold);
- extensionPoints.put(currentExtPoint.getUniqueIdentifier(), currentExtPoint.getObjectId());
- }
-
- synchronized void removeExtensionPoint(String extensionPointId) {
- int pointId = extensionPoints.removeKey(extensionPointId);
- if (pointId == HashtableOfStringAndInt.MISSING_ELEMENT)
- return;
- remove(pointId, true);
- }
-
- public boolean isDirty() {
- return isDirty;
- }
-
- synchronized void removeContribution(long bundleId) {
- boolean removed = newContributions.removeByKey(new Long(bundleId));
- if (removed == false) {
- removed = getFormerContributions().removeByKey(new Long(bundleId));
- if (removed)
- formerContributions = getFormerContributions(); //This forces the removed namespace to stay around, so we do not forget about removed namespaces
- }
-
- if (removed) {
- isDirty = true;
- return;
- }
-
- }
-
- private Map getOrphans() {
- Object result = orphanExtensions;
- if (orphanExtensions == null && !fromCache) {
- result = new HashMap();
- orphanExtensions = result;
- } else if (orphanExtensions == null || (result = ((HashMap) ((orphanExtensions instanceof SoftReference) ? ((SoftReference) orphanExtensions).get() : orphanExtensions))) == null) {
- TableReader reader = new TableReader();
- result = reader.loadOrphans();
- orphanExtensions = new SoftReference(result);
- }
- return (HashMap) result;
- }
-
- void addOrphans(String extensionPoint, int[] extensions) {
- Map orphans = getOrphans();
- int[] existingOrphanExtensions = (int[]) orphans.get(extensionPoint);
-
- if (existingOrphanExtensions != null) {
- // just add
- int[] newOrphanExtensions = new int[existingOrphanExtensions.length + extensions.length];
- System.arraycopy(existingOrphanExtensions, 0, newOrphanExtensions, 0, existingOrphanExtensions.length);
- System.arraycopy(extensions, 0, newOrphanExtensions, existingOrphanExtensions.length, extensions.length);
- orphans.put(extensionPoint, newOrphanExtensions);
- } else {
- // otherwise this is the first one
- orphans.put(extensionPoint, extensions);
- }
- markOrphansHasDirty(orphans);
- }
-
- void markOrphansHasDirty(Map orphans) {
- orphanExtensions = orphans;
- }
-
- void addOrphan(String extensionPoint, int extension) {
- Map orphans = getOrphans();
- int[] existingOrphanExtensions = (int[]) orphans.get(extensionPoint);
-
- if (existingOrphanExtensions != null) {
- // just add
- int[] newOrphanExtensions = new int[existingOrphanExtensions.length + 1];
- System.arraycopy(existingOrphanExtensions, 0, newOrphanExtensions, 0, existingOrphanExtensions.length);
- newOrphanExtensions[existingOrphanExtensions.length] = extension;
- orphans.put(extensionPoint, newOrphanExtensions);
- } else {
- // otherwise this is the first one
- orphans.put(extensionPoint, new int[] {extension});
- }
- markOrphansHasDirty(orphans);
- }
-
- int[] removeOrphans(String extensionPoint) {
- Map orphans = getOrphans();
- int[] existingOrphanExtensions = (int[]) orphans.remove(extensionPoint);
- if (existingOrphanExtensions != null) {
- markOrphansHasDirty(orphans);
- }
- return existingOrphanExtensions;
- }
-
- void removeOrphan(String extensionPoint, int extension) {
- Map orphans = getOrphans();
- int[] existingOrphanExtensions = (int[]) orphans.get(extensionPoint);
-
- if (existingOrphanExtensions == null)
- return;
-
- markOrphansHasDirty(orphans);
- int newSize = existingOrphanExtensions.length - 1;
- if (newSize == 0) {
- orphans.remove(extensionPoint);
- return;
- }
-
- int[] newOrphanExtensions = new int[existingOrphanExtensions.length - 1];
- for (int i = 0, j = 0; i < existingOrphanExtensions.length; i++)
- if (extension != existingOrphanExtensions[i])
- newOrphanExtensions[j++] = existingOrphanExtensions[i];
-
- orphans.put(extensionPoint, newOrphanExtensions);
- return;
- }
-
- //This method is only used by the writer to reach in
- Map getOrphanExtensions() {
- return getOrphans();
- }
-
- // This method is only used by the writer to reach in
- int getNextId() {
- return nextId;
- }
-
- // This method is only used by the writer to reach in
- HashtableOfStringAndInt getExtensionPoints() {
- return extensionPoints;
- }
-
- // This method is only used by the writer to reach in
- KeyedHashSet[] getContributions() {
- return new KeyedHashSet[] {newContributions, getFormerContributions()};
- }
-
- /**
- * Collect all the objects that are removed by this operation and store
- * them in a IObjectManager so that they can be accessed from the appropriate
- * deltas but not from the registry.
- */
- synchronized Map getAssociatedObjects(long contributionId) {
- //Collect all the objects associated with this contribution
- int[] xpts = getExtensionPointsFrom(contributionId);
- int[] exts = getExtensionsFrom(contributionId);
- Map actualObjects = new HashMap(xpts.length + exts.length);
- for (int i = 0; i < exts.length; i++) {
- Extension tmp = (Extension) basicGetObject(exts[i], RegistryObjectManager.EXTENSION);
- actualObjects.put(new Integer(exts[i]), tmp);
- collectChildren(tmp, 0, actualObjects);
- }
- for (int i = 0; i < xpts.length; i++) {
- ExtensionPoint xpt = (ExtensionPoint) basicGetObject(xpts[i], RegistryObjectManager.EXTENSION_POINT);
- actualObjects.put(new Integer(xpts[i]), xpt);
- }
-
- return actualObjects;
- }
-
- synchronized void removeObjects(Map associatedObjects) {
- //Remove the objects from the main object manager so they can no longer be accessed.
- Collection allValues = associatedObjects.values();
- for (Iterator iter = allValues.iterator(); iter.hasNext();) {
- RegistryObject toRemove = (RegistryObject) iter.next();
- remove((toRemove).getObjectId(), true);
- if (toRemove instanceof ExtensionPoint)
- removeExtensionPoint(((ExtensionPoint) toRemove).getUniqueIdentifier());
- }
- }
-
- IObjectManager createDelegatingObjectManager(Map object) {
- return new TemporaryObjectManager(object, this);
- }
-
- private void collectChildren(RegistryObject ce, int level, Map collector) {
- ConfigurationElement[] children = (ConfigurationElement[]) getObjects(ce.getRawChildren(), level == 0 || ce.extraDataOffset == -1 ? RegistryObjectManager.CONFIGURATION_ELEMENT : RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT);
- for (int j = 0; j < children.length; j++) {
- collector.put(new Integer(children[j].getObjectId()), children[j]);
- collectChildren(children[j], level+1, collector);
- }
- }
-
- public void close() {
- //do nothing.
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/TableReader.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/TableReader.java
deleted file mode 100644
index 287c53f..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/TableReader.java
+++ /dev/null
@@ -1,530 +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.registry;
-
-import java.io.*;
-import java.util.HashMap;
-import org.eclipse.core.internal.runtime.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.Bundle;
-
-public class TableReader {
- //Markers in the cache
- static final int NULL = 0;
- static final int OBJECT = 1;
-
- //The version of the cache
- static final int CACHE_VERSION = 1;
-
- //Informations representing the MAIN file
- static final String MAIN = ".mainData"; //$NON-NLS-1$
- static File mainDataFile;
- DataInputStream mainInput = null;
- // int size;
-
- //Informations representing the EXTRA file
- static final String EXTRA = ".extraData"; //$NON-NLS-1$
- static File extraDataFile;
- DataInputStream extraInput = null;
- // int sizeExtra;
-
- //The table file
- static final String TABLE = ".table"; //$NON-NLS-1$
- static File tableFile;
-
- //The namespace file
- static final String CONTRIBUTIONS = ".contributions"; //$NON-NLS-1$
- static File contributionsFile;
-
- //The orphan file
- static final String ORPHANS = ".orphans"; //$NON-NLS-1$
- static File orphansFile;
-
- //Status code
- private static final byte fileError = 0;
- private static final boolean DEBUG = false; //TODO need to change
-
- private boolean holdObjects = false;
-
- static void setMainDataFile(File main) {
- mainDataFile = main;
- }
-
- static void setExtraDataFile(File extra) {
- extraDataFile = extra;
- }
-
- static void setTableFile(File table) {
- tableFile = table;
- }
-
- static void setContributionsFile(File namespace) {
- contributionsFile = namespace;
- }
-
- static void setOrphansFile(File orphan) {
- orphansFile = orphan;
- }
-
- public TableReader() {
- openInputFile();
- openExtraFile();
- }
-
- private void openInputFile() {
- try {
- mainInput = new DataInputStream(new BufferedInputStream(new FileInputStream(mainDataFile)));
- } catch (FileNotFoundException e) {
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, Messages.meta_unableToReadCache, e));
- InternalPlatform.getDefault().clearRegistryCache();
- throw new IllegalStateException(Messages.meta_registryCacheReadProblems);
- }
- }
-
- private void openExtraFile() {
- try {
- extraInput = new DataInputStream(new BufferedInputStream(new FileInputStream(extraDataFile)));
- } catch (FileNotFoundException e) {
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, Messages.meta_unableToReadCache, e));
- InternalPlatform.getDefault().clearRegistryCache();
- throw new IllegalStateException(Messages.meta_registryCacheReadProblems);
- }
- }
-
- private void closeInputFile() {
- try {
- mainInput.close();
- } catch (IOException e) {
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, Messages.meta_registryCacheReadProblems, e));
- }
-
- }
-
- private void closeExtraFile() {
- try {
- extraInput.close();
- } catch (IOException e) {
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, Messages.meta_registryCacheReadProblems, e));
- }
-
- }
-
- public Object[] loadTables(long expectedTimestamp) {
- HashtableOfInt offsets;
- HashtableOfStringAndInt extensionPoints;
-
- DataInputStream tableInput = null;
- try {
- tableInput = new DataInputStream(new BufferedInputStream(new FileInputStream(tableFile)));
- if (!checkCacheValidity(tableInput, expectedTimestamp))
- return null;
-
- Integer nextId = new Integer(tableInput.readInt());
- offsets = new HashtableOfInt();
- offsets.load(tableInput);
- extensionPoints = new HashtableOfStringAndInt();
- extensionPoints.load(tableInput);
- return new Object[] {offsets, extensionPoints, nextId};
- } catch (IOException e) {
- if (tableInput != null)
- try {
- tableInput.close();
- } catch (IOException e1) {
- //Ignore
- }
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, Messages.meta_registryCacheReadProblems, e));
- return null;
- }
-
- }
-
- // Check various aspect of the cache to see if it's valid
- private boolean checkCacheValidity(DataInputStream in, long expectedTimestamp) {
- int version;
- try {
- version = in.readInt();
- if (version != CACHE_VERSION)
- return false;
-
- long installStamp = in.readLong();
- long registryStamp = in.readLong();
- long mainDataFileSize = in.readLong();
- long extraDataFileSize = in.readLong();
- long contributionsFileSize = in.readLong();
- long orphansFileSize = in.readLong();
- String osStamp = in.readUTF();
- String windowsStamp = in.readUTF();
- String localeStamp = in.readUTF();
- InternalPlatform info = InternalPlatform.getDefault();
- return ((expectedTimestamp == 0 || expectedTimestamp == registryStamp) && (installStamp == info.getStateTimeStamp()) && (osStamp.equals(info.getOS())) && (windowsStamp.equals(info.getWS())) && (localeStamp.equals(info.getNL())) && mainDataFileSize == mainDataFile.length() && extraDataFileSize == extraDataFile.length() && contributionsFileSize == contributionsFile.length() && orphansFileSize == orphansFile.length());
- } catch (IOException e) {
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, Messages.meta_registryCacheInconsistent, e));
- return false;
- }
- }
-
- public Object loadConfigurationElement(int offset) {
- try {
- goToInputFile(offset);
- return basicLoadConfigurationElement(mainInput, null);
- } catch (IOException e) {
- String message = NLS.bind(Messages.meta_regCacheIOExceptionReading, mainDataFile);
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, message, e));
- if (DEBUG)
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, "Error reading a configuration element (" + offset + ") from the registry cache", e)); //$NON-NLS-1$//$NON-NLS-2$
- return null;
- } finally {
- closeInputFile();
- closeExtraFile();
- }
- }
-
- private ConfigurationElement basicLoadConfigurationElement(DataInputStream is, Bundle actualContributingBundle) throws IOException {
- int self = is.readInt();
- long contributingBundle = is.readLong();
- String name = readStringOrNull(is, false);
- int parentId = is.readInt();
- byte parentType = is.readByte();
- int misc = is.readInt();//this is set in second level CEs, to indicate where in the extra data file the children ces are
- String[] propertiesAndValue = readPropertiesAndValue(is);
- int[] children = readArray(is);
- if (actualContributingBundle == null)
- actualContributingBundle = getBundle(contributingBundle);
- return new ConfigurationElement(self, actualContributingBundle, name, propertiesAndValue, children, misc, parentId, parentType);
- }
-
- public Object loadThirdLevelConfigurationElements(int offset, RegistryObjectManager objectManager) {
- try {
- goToExtraFile(offset);
- return loadConfigurationElementAndChildren(null, extraInput, 3, Integer.MAX_VALUE, objectManager, null);
- } catch (IOException e) {
- String message = NLS.bind(Messages.meta_regCacheIOExceptionReading, extraDataFile);
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, message, e));
- if (DEBUG)
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, "Error reading a third level configuration element (" + offset + ") from the registry cache", e)); //$NON-NLS-1$//$NON-NLS-2$
- return null;
- } finally {
- closeInputFile();
- closeExtraFile();
- }
- }
-
- //Read a whole configuration element subtree
- private ConfigurationElement loadConfigurationElementAndChildren(DataInputStream is, DataInputStream extraIs, int depth, int maxDepth, RegistryObjectManager objectManager, Bundle actualContributingBundle) throws IOException {
- DataInputStream currentStream = is;
- if (depth > 2)
- currentStream = extraIs;
-
- ConfigurationElement ce = basicLoadConfigurationElement(currentStream, actualContributingBundle);
- if (actualContributingBundle == null)
- actualContributingBundle = ce.getContributingBundle();
- int[] children = ce.getRawChildren();
- if (depth + 1 > maxDepth)
- return ce;
-
- for (int i = 0; i < children.length; i++) {
- ConfigurationElement tmp = loadConfigurationElementAndChildren(currentStream, extraIs, depth + 1, maxDepth, objectManager, actualContributingBundle);
- objectManager.add(tmp, holdObjects);
- }
- return ce;
- }
-
- private String[] readPropertiesAndValue(DataInputStream inputStream) throws IOException {
- int numberOfProperties = inputStream.readInt();
- if (numberOfProperties == 0)
- return RegistryObjectManager.EMPTY_STRING_ARRAY;
- String[] properties = new String[numberOfProperties];
- for (int i = 0; i < numberOfProperties; i++) {
- properties[i] = readStringOrNull(inputStream, false);
- }
- return properties;
- }
-
- public Object loadExtension(int offset) {
- try {
- goToInputFile(offset);
- return basicLoadExtension(mainInput);
- } catch (IOException e) {
- String message = NLS.bind(Messages.meta_regCacheIOExceptionReading, mainDataFile);
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, message, e));
- if (DEBUG)
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, "Error reading an extension (" + offset + ") from the registry cache", e)); //$NON-NLS-1$//$NON-NLS-2$
- } finally {
- closeExtraFile();
- closeInputFile();
- }
- return null;
- }
-
- private Bundle getBundle(long id) {
- return InternalPlatform.getDefault().getBundleContext().getBundle(id);
- }
-
- private Extension basicLoadExtension(DataInputStream inputStream) throws IOException {
- int self = inputStream.readInt();
- String simpleId = readStringOrNull(mainInput, false);
- String namespace = readStringOrNull(mainInput, false);
- int[] children = readArray(mainInput);
- int extraData = mainInput.readInt();
- return new Extension(self, simpleId, namespace, children, extraData);
- }
-
- public ExtensionPoint loadExtensionPointTree(int offset, RegistryObjectManager objects) {
- try {
- ExtensionPoint xpt = (ExtensionPoint) loadExtensionPoint(offset);
- int[] children = xpt.getRawChildren();
- int nbrOfExtension = children.length;
- for (int i = 0; i < nbrOfExtension; i++) {
- Extension loaded = basicLoadExtension(mainInput);
- objects.add(loaded, holdObjects);
- }
-
- for (int i = 0; i < nbrOfExtension; i++) {
- int nbrOfCe = mainInput.readInt();
- for (int j = 0; j < nbrOfCe; j++) {
- objects.add(loadConfigurationElementAndChildren(mainInput, extraInput, 1, 2, objects, null), holdObjects);
- }
- }
- return xpt;
- } catch (IOException e) {
- String message = NLS.bind(Messages.meta_regCacheIOExceptionReading, mainDataFile);
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, message, e));
- if (DEBUG)
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, "Error reading an extension point tree (" + offset + ") from the registry cache", e)); //$NON-NLS-1$//$NON-NLS-2$
- return null;
- } finally {
- closeExtraFile();
- closeInputFile();
- }
- }
-
- private Object loadExtensionPoint(int offset) {
- try {
- goToInputFile(offset);
- return basicLoadExtensionPoint();
- } catch (IOException e) {
- String message = NLS.bind(Messages.meta_regCacheIOExceptionReading, mainDataFile);
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, message, e));
- if (DEBUG)
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, "Error reading an extension point (" + offset + ") from the registry cache", e)); //$NON-NLS-1$ //$NON-NLS-2$
- return null;
- }
- }
-
- private ExtensionPoint basicLoadExtensionPoint() throws IOException {
- int self = mainInput.readInt();
- int[] children = readArray(mainInput);
- int extraData = mainInput.readInt();
- return new ExtensionPoint(self, children, extraData);
- }
-
- private int[] readArray(DataInputStream in) throws IOException {
- int arraySize = in.readInt();
- if (arraySize == 0)
- return RegistryObjectManager.EMPTY_INT_ARRAY;
- int[] result = new int[arraySize];
- for (int i = 0; i < arraySize; i++) {
- result[i] = in.readInt();
- }
- return result;
- }
-
- private void goToInputFile(int offset) throws IOException {
- mainInput.skipBytes(offset);
- }
-
- private void goToExtraFile(int offset) throws IOException {
- extraInput.skipBytes(offset);
- }
-
- private String readStringOrNull(DataInputStream in, boolean intern) throws IOException {
- byte type = in.readByte();
- if (type == NULL)
- return null;
- if (intern)
- return in.readUTF().intern();
- return in.readUTF();
- }
-
- public String[] loadExtensionExtraData(int dataPosition) {
- try {
- goToExtraFile(dataPosition);
- return basicLoadExtensionExtraData();
- } catch (IOException e) {
- String message = NLS.bind(Messages.meta_regCacheIOExceptionReading, extraDataFile);
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, message, e));
- if (DEBUG)
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, "Error reading extension label (" + dataPosition + ") from the registry cache", e)); //$NON-NLS-1$ //$NON-NLS-2$
- return null;
- } finally {
- closeExtraFile();
- closeInputFile();
- }
- }
-
- private String[] basicLoadExtensionExtraData() throws IOException {
- return new String[] {readStringOrNull(extraInput, false), readStringOrNull(extraInput, false)};
- }
-
- public String[] loadExtensionPointExtraData(int offset) {
- try {
- goToExtraFile(offset);
- return basicLoadExtensionPointExtraData();
- } catch (IOException e) {
- String message = NLS.bind(Messages.meta_regCacheIOExceptionReading, extraDataFile);
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, message, e));
- if (DEBUG)
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, "Error reading extension point data (" + offset + ") from the resgistry cache", e)); //$NON-NLS-1$ //$NON-NLS-2$
- return null;
- } finally {
- closeExtraFile();
- closeInputFile();
- }
- }
-
- private String[] basicLoadExtensionPointExtraData() throws IOException {
- String[] result = new String[5];
- result[0] = readStringOrNull(extraInput, false); //the label
- result[1] = readStringOrNull(extraInput, false); //the schema
- result[2] = readStringOrNull(extraInput, false); //the fully qualified name
- result[3] = readStringOrNull(extraInput, false); //the namespace
- result[4] = Long.toString(extraInput.readLong());
- return result;
- }
-
- public KeyedHashSet loadNamespaces() {
- DataInputStream namespaceInput = null;
- try {
- namespaceInput = new DataInputStream(new BufferedInputStream(new FileInputStream(contributionsFile)));
- int size = namespaceInput.readInt();
- KeyedHashSet result = new KeyedHashSet(size);
- for (int i = 0; i < size; i++) {
- Contribution n = new Contribution(namespaceInput.readLong());
- n.setRawChildren(readArray(namespaceInput));
- result.add(n);
- }
- return result;
- } catch (IOException e) {
- String message = NLS.bind(Messages.meta_regCacheIOExceptionReading, contributionsFile);
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, message, e));
- return null;
- } finally {
- if (namespaceInput != null)
- try {
- namespaceInput.close();
- } catch (IOException e1) {
- //Ignore
- }
- }
- }
-
- private void loadAllOrphans(RegistryObjectManager objectManager) throws IOException {
- //Read the extensions and configuration elements of the orphans
- int orphans = objectManager.getOrphanExtensions().size();
- for (int k = 0; k < orphans; k++) {
- int numberOfOrphanExtensions = mainInput.readInt();
- for (int i = 0; i < numberOfOrphanExtensions; i++) {
- loadFullExtension(objectManager);
- }
- for (int i = 0; i < numberOfOrphanExtensions; i++) {
- int nbrOfCe = mainInput.readInt();
- for (int j = 0; j < nbrOfCe; j++) {
- objectManager.add(loadConfigurationElementAndChildren(mainInput, extraInput, 1, Integer.MAX_VALUE, objectManager, null), true);
- }
- }
- }
- }
-
- public boolean readAllCache(RegistryObjectManager objectManager) {
- try {
- int size = objectManager.getExtensionPoints().size();
- for (int i = 0; i < size; i++) {
- objectManager.add(readAllExtensionPointTree(objectManager), holdObjects);
- }
- loadAllOrphans(objectManager);
- } catch (IOException e) {
- String message = NLS.bind(Messages.meta_regCacheIOExceptionReading, mainDataFile);
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, message, e));
- return false;
- } finally {
- closeExtraFile();
- closeInputFile();
- }
- return true;
- }
-
- public ExtensionPoint readAllExtensionPointTree(RegistryObjectManager objectManager) throws IOException {
- ExtensionPoint xpt = loadFullExtensionPoint();
- int[] children = xpt.getRawChildren();
- int nbrOfExtension = children.length;
- for (int i = 0; i < nbrOfExtension; i++) {
- loadFullExtension(objectManager);
- }
-
- for (int i = 0; i < nbrOfExtension; i++) {
- int nbrOfCe = mainInput.readInt();
- for (int j = 0; j < nbrOfCe; j++) {
- objectManager.add(loadConfigurationElementAndChildren(mainInput, extraInput, 1, Integer.MAX_VALUE, objectManager, null), true);
- }
- }
- return xpt;
- }
-
- private ExtensionPoint loadFullExtensionPoint() throws IOException { //TODO I don't like this.
- ExtensionPoint xpt = basicLoadExtensionPoint();
- String[] tmp = basicLoadExtensionPointExtraData();
- xpt.setLabel(tmp[0]);
- xpt.setSchema(tmp[1]);
- xpt.setUniqueIdentifier(tmp[2]);
- xpt.setNamespace(tmp[3]);
- xpt.setBundleId(Long.parseLong(tmp[4]));
- return xpt;
- }
-
- private Extension loadFullExtension(RegistryObjectManager objectManager) throws IOException {
- String[] tmp;
- Extension loaded = basicLoadExtension(mainInput);
- tmp = basicLoadExtensionExtraData();
- loaded.setLabel(tmp[0]);
- loaded.setExtensionPointIdentifier(tmp[1]);
- objectManager.add(loaded, holdObjects);
- return loaded;
- }
-
- public HashMap loadOrphans() {
- DataInputStream orphanInput = null;
- try {
- orphanInput = new DataInputStream(new BufferedInputStream(new FileInputStream(orphansFile)));
- int size = orphanInput.readInt();
- HashMap result = new HashMap(size);
- for (int i = 0; i < size; i++) {
- String key = orphanInput.readUTF();
- int[] value = readArray(orphanInput);
- result.put(key, value);
- }
- return result;
- } catch (IOException e) {
- return null;
- } finally {
- if (orphanInput != null)
- try {
- orphanInput.close();
- } catch (IOException e1) {
- //ignore
- }
- }
- }
-
- public void setHoldObjects(boolean holdObjects) {
- this.holdObjects = holdObjects;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/TableWriter.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/TableWriter.java
deleted file mode 100644
index e38aa68..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/TableWriter.java
+++ /dev/null
@@ -1,304 +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.registry;
-
-import java.io.*;
-import java.util.*;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.internal.runtime.Messages;
-import org.eclipse.core.runtime.*;
-
-public class TableWriter {
- private static final byte fileError = 0;
-
- static File mainDataFile;
- static File extraDataFile;
- static File tableFile;
- static File contributionsFile;
- static File orphansFile;
-
- static void setMainDataFile(File main) {
- mainDataFile = main;
- }
-
- static void setExtraDataFile(File extra) {
- extraDataFile = extra;
- }
-
- static void setTableFile(File table) {
- tableFile = table;
- }
-
- static void setContributionsFile(File fileName) {
- contributionsFile = fileName;
- }
-
- static void setOrphansFile(File orphan) {
- orphansFile = orphan;
- }
-
- DataOutputStream mainOutput;
- DataOutputStream extraOutput;
- FileOutputStream mainFileOutput = null;
- FileOutputStream extraFileOutput = null;
-
- private HashtableOfInt offsets;
-
- private int getExtraDataPosition() {
- return extraOutput.size();
- }
-
- public boolean saveCache(RegistryObjectManager objectManager, long timestamp) {
- try {
- if (!openFiles())
- return false;
- try {
- saveExtensionRegistry(objectManager, timestamp);
- } catch (IOException io) {
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, Messages.meta_registryCacheWriteProblems, io));
- return false;
- }
- } finally {
- closeFiles();
- }
- return true;
- }
-
- private boolean openFiles() {
- try {
- mainFileOutput = new FileOutputStream(mainDataFile);
- mainOutput = new DataOutputStream(new BufferedOutputStream(mainFileOutput));
- extraFileOutput = new FileOutputStream(extraDataFile);
- extraOutput = new DataOutputStream(new BufferedOutputStream(extraFileOutput));
- } catch (FileNotFoundException e) {
- if (mainFileOutput != null)
- try {
- mainFileOutput.close();
- } catch (IOException e1) {
- //Ignore
- }
-
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, Messages.meta_unableToCreateCache, e));
- return false;
- }
- return true;
- }
-
- private void closeFiles() {
- try {
- if (mainOutput != null) {
- mainOutput.flush();
- if (mainFileOutput.getFD().valid()) {
- mainFileOutput.getFD().sync();
- }
- mainOutput.close();
- }
- } catch (IOException e) {
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, Messages.meta_registryCacheWriteProblems, e));
- e.printStackTrace();
- }
- try {
- if (extraOutput != null) {
- extraOutput.flush();
- if (extraFileOutput.getFD().valid()) {
- extraFileOutput.getFD().sync();
- }
- extraOutput.close();
- }
- } catch (IOException e) {
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, fileError, Messages.meta_registryCacheWriteProblems, e));
- e.printStackTrace();
- }
- }
-
- private void saveExtensionRegistry(RegistryObjectManager objectManager, long timestamp) throws IOException {
- ExtensionPointHandle[] points = objectManager.getExtensionPointsHandles();
- offsets = new HashtableOfInt(objectManager.getNextId());
- for (int i = 0; i < points.length; i++) {
- saveExtensionPoint(points[i]);
- }
- saveOrphans(objectManager);
- saveNamespaces(objectManager.getContributions());
- closeFiles(); //Close the files here so we can write the appropriate size information in the table file.
- saveTables(objectManager, timestamp); //Write the table last so if that is something went wrong we can know
- }
-
- private void saveNamespaces(KeyedHashSet[] contributions) throws IOException {
- FileOutputStream fosNamespace = new FileOutputStream(contributionsFile);
- DataOutputStream outputNamespace = new DataOutputStream(new BufferedOutputStream(fosNamespace));
- KeyedElement[] newElements = contributions[0].elements();
- KeyedElement[] formerElements = contributions[1].elements();
- outputNamespace.writeInt(newElements.length + formerElements.length);
- for (int i = 0; i < newElements.length; i++) {
- Contribution elt = (Contribution) newElements[i];
- outputNamespace.writeLong(elt.getContributingBundle().getBundleId());
- saveArray(elt.getRawChildren(), outputNamespace);
- }
- for (int i = 0; i < formerElements.length; i++) {
- Contribution elt = (Contribution) formerElements[i];
- outputNamespace.writeLong(elt.getContributingBundle().getBundleId());
- saveArray(elt.getRawChildren(), outputNamespace);
- }
- outputNamespace.flush();
- fosNamespace.getFD().sync();
- outputNamespace.close();
- }
-
- private void saveTables(RegistryObjectManager objectManager, long registryTimeStamp) throws IOException {
- FileOutputStream fosTable = new FileOutputStream(tableFile);
- DataOutputStream outputTable = new DataOutputStream(new BufferedOutputStream(fosTable));
- writeCacheHeader(outputTable, registryTimeStamp);
- outputTable.writeInt(objectManager.getNextId());
- offsets.save(outputTable);
- objectManager.getExtensionPoints().save(outputTable);
- outputTable.flush();
- fosTable.getFD().sync();
- outputTable.close();
- }
-
- private void writeCacheHeader(DataOutputStream output, long registryTimeStamp) throws IOException {
- output.writeInt(TableReader.CACHE_VERSION);
- output.writeLong(InternalPlatform.getDefault().getStateTimeStamp());
- output.writeLong(registryTimeStamp);
- output.writeLong(mainDataFile.length());
- output.writeLong(extraDataFile.length());
- output.writeLong(contributionsFile.length());
- output.writeLong(orphansFile.length());
- InternalPlatform info = InternalPlatform.getDefault();
- output.writeUTF(info.getOS());
- output.writeUTF(info.getWS());
- output.writeUTF(info.getNL());
- }
-
- private void saveArray(int[] array, DataOutputStream out) throws IOException {
- if (array == null) {
- out.writeInt(0);
- return;
- }
- out.writeInt(array.length);
- for (int i = 0; i < array.length; i++) {
- out.writeInt(array[i]);
- }
- }
-
- private void saveExtensionPoint(ExtensionPointHandle xpt) throws IOException {
- //save the file position
- offsets.put(xpt.getId(), mainOutput.size());
- //save the extensionPoint
- mainOutput.writeInt(xpt.getId());
- saveArray(xpt.getObject().getRawChildren(), mainOutput);
- mainOutput.writeInt(getExtraDataPosition());
- saveExtensionPointData(xpt);
-
- saveExtensions(xpt.getExtensions(), mainOutput);
- }
-
- private void saveExtension(ExtensionHandle ext, DataOutputStream outputStream) throws IOException {
- offsets.put(ext.getId(), outputStream.size());
- outputStream.writeInt(ext.getId());
- writeStringOrNull(ext.getSimpleIdentifier(), outputStream);
- writeStringOrNull(ext.getNamespace(), outputStream);
- saveArray(ext.getObject().getRawChildren(), outputStream);
- outputStream.writeInt(getExtraDataPosition());
- saveExtensionData(ext);
- }
-
- private void writeStringArray(String[] array, DataOutputStream outputStream) throws IOException {
- outputStream.writeInt(array == null ? 0 : array.length);
- for (int i = 0; i < (array == null ? 0 : array.length); i++) {
- writeStringOrNull(array[i], outputStream);
- }
- }
-
- //Save Configuration elements depth first
- private void saveConfigurationElement(ConfigurationElementHandle element, DataOutputStream outputStream, DataOutputStream extraOutputStream, int depth) throws IOException {
- DataOutputStream currentOutput = outputStream;
- if (depth > 2)
- currentOutput = extraOutputStream;
-
- offsets.put(element.getId(), currentOutput.size());
-
- currentOutput.writeInt(element.getId());
- ConfigurationElement actualCe = (ConfigurationElement) element.getObject();
-
- currentOutput.writeLong(actualCe.getContributingBundle().getBundleId());
- writeStringOrNull(actualCe.getName(), currentOutput);
- currentOutput.writeInt(actualCe.parentId);
- currentOutput.writeByte(actualCe.parentType);
- currentOutput.writeInt(depth > 1 ? extraOutputStream.size() : -1);
- writeStringArray(actualCe.getPropertiesAndValue(), currentOutput);
- //save the children
- saveArray(actualCe.getRawChildren(), currentOutput);
-
- ConfigurationElementHandle[] childrenCEs = (ConfigurationElementHandle[]) element.getChildren();
- for (int i = 0; i < childrenCEs.length; i++) {
- saveConfigurationElement(childrenCEs[i], outputStream, extraOutputStream, depth + 1);
- }
-
- }
-
- private void saveExtensions(IExtension[] exts, DataOutputStream outputStream) throws IOException {
- for (int i = 0; i < exts.length; i++) {
- saveExtension((ExtensionHandle) exts[i], outputStream);
- }
-
- for (int i = 0; i < exts.length; i++) {
- IConfigurationElement[] ces = exts[i].getConfigurationElements();
- outputStream.writeInt(ces.length);
- for (int j = 0; j < ces.length; j++) {
- saveConfigurationElement((ConfigurationElementHandle) ces[j], outputStream, extraOutput, 1);
- }
- }
- }
-
- private void saveExtensionPointData(ExtensionPointHandle xpt) throws IOException {
- writeStringOrNull(xpt.getLabel(), extraOutput);
- writeStringOrNull(xpt.getSchemaReference(), extraOutput);
- writeStringOrNull(xpt.getUniqueIdentifier(), extraOutput);
- writeStringOrNull(xpt.getNamespace(), extraOutput);
- extraOutput.writeLong(((ExtensionPoint) xpt.getObject()).getBundleId());
- }
-
- private void saveExtensionData(ExtensionHandle extension) throws IOException {
- writeStringOrNull(extension.getLabel(), extraOutput);
- writeStringOrNull(extension.getExtensionPointUniqueIdentifier(), extraOutput);
- }
-
- private void writeStringOrNull(String string, DataOutputStream out) throws IOException {
- if (string == null)
- out.writeByte(TableReader.NULL);
- else {
- out.writeByte(TableReader.OBJECT);
- out.writeUTF(string);
- }
- }
-
- private void saveOrphans(RegistryObjectManager objectManager) throws IOException {
- Map orphans = objectManager.getOrphanExtensions();
- FileOutputStream fosOrphan = new FileOutputStream(orphansFile);
- DataOutputStream outputOrphan = new DataOutputStream(new BufferedOutputStream(fosOrphan));
- outputOrphan.writeInt(orphans.size());
- Set elements = orphans.entrySet();
- for (Iterator iter = elements.iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- outputOrphan.writeUTF((String) entry.getKey());
- saveArray((int[]) entry.getValue(), outputOrphan);
- }
- for (Iterator iter = elements.iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- mainOutput.writeInt(((int[]) entry.getValue()).length);
- saveExtensions((IExtension[]) objectManager.getHandles((int[]) entry.getValue(), RegistryObjectManager.EXTENSION), mainOutput);
- }
- outputOrphan.flush();
- fosOrphan.getFD().sync();
- outputOrphan.close();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/TemporaryObjectManager.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/TemporaryObjectManager.java
deleted file mode 100644
index bffa678..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/TemporaryObjectManager.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import java.util.Map;
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
-
-/**
- * @since 3.1
- */
-public class TemporaryObjectManager implements IObjectManager {
- private Map actualObjects; //id --> registry objects
- private RegistryObjectManager parent; //the main object manager (should be equals to extensionRegistry.getObjectManager)
-
- public TemporaryObjectManager(Map actualObjects, RegistryObjectManager parent) {
- this.actualObjects = actualObjects;
- this.parent = parent;
- }
-
- public Handle getHandle(int id, byte type) {
- switch (type) {
- case RegistryObjectManager.EXTENSION_POINT :
- return new ExtensionPointHandle(this, id);
-
- case RegistryObjectManager.EXTENSION :
- return new ExtensionHandle(this, id);
-
- case RegistryObjectManager.CONFIGURATION_ELEMENT :
- return new ConfigurationElementHandle(this, id);
-
- case RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT :
- default : //avoid compiler error, type should always be known
- return new ThirdLevelConfigurationElementHandle(this, id);
- }
- }
-
- public Handle[] getHandles(int[] ids, byte type) {
- Handle[] results = null;
- int nbrId = ids.length;
- switch (type) {
- case RegistryObjectManager.EXTENSION_POINT :
- if (nbrId == 0)
- return ExtensionPointHandle.EMPTY_ARRAY;
- results = new ExtensionPointHandle[nbrId];
- for (int i = 0; i < nbrId; i++) {
- results[i] = new ExtensionPointHandle(this, ids[i]);
- }
- break;
-
- case RegistryObjectManager.EXTENSION :
- if (nbrId == 0)
- return ExtensionHandle.EMPTY_ARRAY;
- results = new ExtensionHandle[nbrId];
- for (int i = 0; i < nbrId; i++) {
- results[i] = new ExtensionHandle(this, ids[i]);
- }
- break;
-
- case RegistryObjectManager.CONFIGURATION_ELEMENT :
- if (nbrId == 0)
- return ConfigurationElementHandle.EMPTY_ARRAY;
- results = new ConfigurationElementHandle[nbrId];
- for (int i = 0; i < nbrId; i++) {
- results[i] = new ConfigurationElementHandle(this, ids[i]);
- }
- break;
-
- case RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT :
- if (nbrId == 0)
- return ConfigurationElementHandle.EMPTY_ARRAY;
- results = new ThirdLevelConfigurationElementHandle[nbrId];
- for (int i = 0; i < nbrId; i++) {
- results[i] = new ThirdLevelConfigurationElementHandle(this, ids[i]);
- }
- break;
- }
- return results;
- }
-
- synchronized public Object getObject(int id, byte type) {
- Object result = null;
- try {
- result = parent.getObject(id, type);
- } catch (InvalidRegistryObjectException e) {
- if (actualObjects != null) {
- result = actualObjects.get(new Integer(id));
- }
- }
- if (result == null)
- throw new InvalidRegistryObjectException();
- return result;
- }
-
- synchronized public RegistryObject[] getObjects(int[] values, byte type) {
- if (values.length == 0) {
- switch (type) {
- case RegistryObjectManager.EXTENSION_POINT :
- return ExtensionPoint.EMPTY_ARRAY;
- case RegistryObjectManager.EXTENSION :
- return Extension.EMPTY_ARRAY;
- case RegistryObjectManager.CONFIGURATION_ELEMENT :
- case RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT :
- return ConfigurationElement.EMPTY_ARRAY;
- }
- }
-
- RegistryObject[] results = null;
- switch (type) {
- case RegistryObjectManager.EXTENSION_POINT :
- results = new ExtensionPoint[values.length];
- break;
- case RegistryObjectManager.EXTENSION :
- results = new Extension[values.length];
- break;
- case RegistryObjectManager.CONFIGURATION_ELEMENT :
- case RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT :
- results = new ConfigurationElement[values.length];
- break;
- }
- for (int i = 0; i < values.length; i++) {
- results[i] = (RegistryObject) getObject(values[i], type);
- }
- return results;
- }
-
- public synchronized void close() {
- actualObjects = null;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ThirdLevelConfigurationElementHandle.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ThirdLevelConfigurationElementHandle.java
deleted file mode 100644
index a305a77..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ThirdLevelConfigurationElementHandle.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.registry;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-
-/**
- * @since 3.1
- */
-public class ThirdLevelConfigurationElementHandle extends ConfigurationElementHandle {
-
- public ThirdLevelConfigurationElementHandle(IObjectManager objectManager, int id) {
- super(objectManager, id);
- }
-
- protected ConfigurationElement getConfigurationElement() {
- return (ConfigurationElement) objectManager.getObject(getId(), RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT);
- }
-
- public IConfigurationElement[] getChildren() {
- return (IConfigurationElement[]) objectManager.getHandles(getConfigurationElement().getRawChildren(), RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT);
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AdapterFactoryProxy.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AdapterFactoryProxy.java
deleted file mode 100644
index 149d5a1..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AdapterFactoryProxy.java
+++ /dev/null
@@ -1,118 +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.internal.runtime;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.Bundle;
-
-/**
- * Instances of this class represent adapter factories that have been
- * contributed via the adapters extension point. The concrete factory is not
- * loaded until the factory's plugin is loaded, AND until the factory is
- * requested to supply an adapter.
- */
-class AdapterFactoryProxy implements IAdapterFactory {
- private IConfigurationElement element;
- /**
- * The real factory. Null until the factory is loaded.
- */
- private IAdapterFactory factory;
- private boolean factoryLoaded = false;
-
- /**
- * Creates a new factory proxy based on the given configuration element.
- * Returns the new proxy, or null if the element could not be created.
- */
- public static AdapterFactoryProxy createProxy(IConfigurationElement element) {
- AdapterFactoryProxy result = new AdapterFactoryProxy();
- result.element = element;
- if ("factory".equals(element.getName())) //$NON-NLS-1$
- return result;
- result.logError();
- return null;
- }
-
- String getAdaptableType() {
- //cannot return null because it can cause startup failure
- String result = element.getAttribute("adaptableType"); //$NON-NLS-1$
- if (result != null)
- return result;
- logError();
- return ""; //$NON-NLS-1$
- }
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (!factoryLoaded)
- loadFactory(false);
- return factory == null ? null : factory.getAdapter(adaptableObject, adapterType);
- }
-
- public Class[] getAdapterList() {
- if (!factoryLoaded)
- loadFactory(false);
- return factory == null ? null : factory.getAdapterList();
- }
-
- String[] getAdapterNames() {
- IConfigurationElement[] children = element.getChildren();
- ArrayList adapters = new ArrayList(children.length);
- for (int i = 0; i < children.length; i++) {
- //ignore unknown children for forward compatibility
- if ("adapter".equals(children[i].getName())) { //$NON-NLS-1$
- String type = children[i].getAttribute("type"); //$NON-NLS-1$
- if (type != null)
- adapters.add(type);
- }
- }
- if (adapters.isEmpty())
- logError();
- return (String[]) adapters.toArray(new String[adapters.size()]);
- }
-
- IExtension getExtension() {
- return element.getDeclaringExtension();
- }
-
- /**
- * Loads the real adapter factory, but only if its associated plug-in is
- * already loaded. Returns the real factory if it was successfully loaded.
- * @param force if <code>true</code> the plugin providing the
- * factory will be loaded if necessary, otherwise no plugin activations
- * will occur.
- */
- IAdapterFactory loadFactory(boolean force) {
- synchronized (this) {
- if (factory != null || factoryLoaded)
- return factory;
- String bundleId = element.getNamespace();
- if (!force && Platform.getBundle(bundleId).getState() != Bundle.ACTIVE)
- return null;
- //set to true to prevent repeated attempts to load a broken factory
- factoryLoaded = true;
- }
- try {
- factory = (IAdapterFactory) element.createExecutableExtension("class"); //$NON-NLS-1$
- } catch (CoreException e) {
- InternalPlatform.getDefault().log(e.getStatus());
- }
- return factory;
- }
-
- /**
- * The factory extension was malformed. Log an appropriate exception
- */
- private void logError() {
- String msg = NLS.bind(Messages.adapters_badAdapterFactory, element.getNamespace());
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, 1, msg, null));
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AdapterManager.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AdapterManager.java
deleted file mode 100644
index 4b445ec..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AdapterManager.java
+++ /dev/null
@@ -1,410 +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.runtime;
-
-import java.util.*;
-import org.eclipse.core.runtime.*;
-
-/**
- * This class is the standard implementation of <code>IAdapterManager</code>. It provides
- * fast lookup of property values with the following semantics:
- * <ul>
- * <li>At most one factory will be invoked per property lookup
- * <li>If multiple installed factories provide the same adapter, only the first found in
- * the search order will be invoked.
- * <li>The search order from a class with the definition <br>
- * <code>class X extends Y implements A, B</code><br> is as follows: <il>
- * <li>the target's class: X
- * <li>X's superclasses in order to <code>Object</code>
- * <li>a breadth-first traversal of the target class's interfaces in the order returned by
- * <code>getInterfaces</code> (in the example, A and its superinterfaces then B and its
- * superinterfaces) </il>
- * </ul>
- *
- * @see IAdapterFactory
- * @see IAdapterManager
- */
-public final class AdapterManager implements IAdapterManager, IRegistryChangeListener {
- /**
- * Cache of adapters for a given adaptable class. Maps String -> Map
- * (adaptable class name -> (adapter class name -> factory instance))
- */
- protected HashMap adapterLookup;
- /**
- * Cache of classes for a given type name. Avoids too many loadClass calls.
- * (factory -> (type name -> clazz))
- */
- protected HashMap classLookup;
- /**
- * Cache of class lookup order. This avoids having to compute often, and
- * provides clients with quick lookup for instanceOf checks based on type name.
- */
- protected HashMap classSearchOrderLookup;
- /**
- * Map of factories, keyed by <code>String</code>, fully qualified class name of
- * the adaptable class that the factory provides adapters for. Value is a <code>List</code>
- * of <code>IAdapterFactory</code>.
- */
- protected final HashMap factories;
-
- /**
- * Constructs a new adapter manager.
- */
- public AdapterManager() {
- factories = new HashMap(5);
- adapterLookup = null;
- registerFactoryProxies();
- Platform.getExtensionRegistry().addRegistryChangeListener(this);
- }
-
- /**
- * Given a type name, add all of the factories that respond to those types into
- * the given table. Each entry will be keyed by the adapter class name (supplied in
- * IAdapterFactory.getAdapterList).
- */
- private void addFactoriesFor(String typeName, Map table) {
- List factoryList = (List) factories.get(typeName);
- if (factoryList == null)
- return;
- for (int i = 0, imax = factoryList.size(); i < imax; i++) {
- IAdapterFactory factory = (IAdapterFactory) factoryList.get(i);
- if (factory instanceof AdapterFactoryProxy) {
- String[] adapters = ((AdapterFactoryProxy) factory).getAdapterNames();
- for (int j = 0; j < adapters.length; j++) {
- if (table.get(adapters[j]) == null)
- table.put(adapters[j], factory);
- }
- } else {
- Class[] adapters = factory.getAdapterList();
- for (int j = 0; j < adapters.length; j++) {
- String adapterName = adapters[j].getName();
- if (table.get(adapterName) == null)
- table.put(adapterName, factory);
- }
- }
- }
- }
-
- private void cacheClassLookup(IAdapterFactory factory, Class clazz) {
- //cache reference to lookup to protect against concurrent flush
- HashMap lookup = classLookup;
- if (lookup == null)
- classLookup = lookup = new HashMap(4);
- HashMap classes = (HashMap) lookup.get(factory);
- if (classes == null) {
- classes = new HashMap(4);
- lookup.put(factory, classes);
- }
- classes.put(clazz.getName(), clazz);
- }
-
- private Class cachedClassForName(IAdapterFactory factory, String typeName) {
- Class clazz = null;
- //cache reference to lookup to protect against concurrent flush
- HashMap lookup = classLookup;
- if (lookup != null) {
- HashMap classes = (HashMap) lookup.get(factory);
- if (classes != null) {
- clazz = (Class) classes.get(typeName);
- }
- }
- return clazz;
- }
-
- /**
- * Returns the class with the given fully qualified name, or null
- * if that class does not exist or belongs to a plug-in that has not
- * yet been loaded.
- */
- private Class classForName(IAdapterFactory factory, String typeName) {
- Class clazz = cachedClassForName(factory, typeName);
- if (clazz == null) {
- try {
- if (factory instanceof AdapterFactoryProxy)
- factory = ((AdapterFactoryProxy) factory).loadFactory(false);
- if (factory != null) {
- clazz = factory.getClass().getClassLoader().loadClass(typeName);
- cacheClassLookup(factory, clazz);
- }
- } catch (ClassNotFoundException e) {
- // class not yet loaded
- }
- }
- return clazz;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterManager#getAdapterTypes(java.lang.Class)
- */
- public String[] computeAdapterTypes(Class adaptable) {
- Set types = getFactories(adaptable).keySet();
- return (String[]) types.toArray(new String[types.size()]);
- }
-
- /**
- * Computes the adapters that the provided class can adapt to, along
- * with the factory object that can perform that transformation. Returns
- * a table of adapter class name to factory object.
- * @param adaptable
- */
- private Map getFactories(Class adaptable) {
- //cache reference to lookup to protect against concurrent flush
- HashMap lookup = adapterLookup;
- if (lookup == null)
- adapterLookup = lookup = new HashMap(30);
- Map table = (Map) lookup.get(adaptable.getName());
- if (table == null) {
- // calculate adapters for the class
- table = new HashMap(4);
- Class[] classes = computeClassOrder(adaptable);
- for (int i = 0; i < classes.length; i++)
- addFactoriesFor(classes[i].getName(), table);
- // cache the table
- lookup.put(adaptable.getName(), table);
- }
- return table;
- }
-
- public Class[] computeClassOrder(Class adaptable) {
- List classes = null;
- //cache reference to lookup to protect against concurrent flush
- HashMap lookup = classSearchOrderLookup;
- if (lookup != null)
- classes = (List) lookup.get(adaptable);
- // compute class order only if it hasn't been cached before
- if (classes == null) {
- classes = new ArrayList();
- computeClassOrder(adaptable, classes);
- if (lookup == null)
- classSearchOrderLookup = lookup = new HashMap();
- lookup.put(adaptable, classes);
- }
- return (Class[]) classes.toArray(new Class[classes.size()]);
- }
-
- /**
- * Builds and returns a table of adapters for the given adaptable type.
- * The table is keyed by adapter class name. The
- * value is the <b>sole<b> factory that defines that adapter. Note that
- * if multiple adapters technically define the same property, only the
- * first found in the search order is considered.
- *
- * Note that it is important to maintain a consistent class and interface
- * lookup order. See the class comment for more details.
- */
- private void computeClassOrder(Class adaptable, Collection classes) {
- Class clazz = adaptable;
- Set seen = new HashSet(4);
- while (clazz != null) {
- classes.add(clazz);
- computeInterfaceOrder(clazz.getInterfaces(), classes, seen);
- clazz = clazz.getSuperclass();
- }
- }
-
- private void computeInterfaceOrder(Class[] interfaces, Collection classes, Set seen) {
- List newInterfaces = new ArrayList(interfaces.length);
- for (int i = 0; i < interfaces.length; i++) {
- Class interfac = interfaces[i];
- if (seen.add(interfac)) {
- //note we cannot recurse here without changing the resulting interface order
- classes.add(interfac);
- newInterfaces.add(interfac);
- }
- }
- for (Iterator it = newInterfaces.iterator(); it.hasNext();)
- computeInterfaceOrder(((Class) it.next()).getInterfaces(), classes, seen);
- }
-
- /**
- * Flushes the cache of adapter search paths. This is generally required whenever an
- * adapter is added or removed.
- * <p>
- * It is likely easier to just toss the whole cache rather than trying to be smart
- * and remove only those entries affected.
- * </p>
- */
- public synchronized void flushLookup() {
- adapterLookup = null;
- classLookup = null;
- classSearchOrderLookup = null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterManager#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptable, Class adapterType) {
- IAdapterFactory factory = (IAdapterFactory) getFactories(adaptable.getClass()).get(adapterType.getName());
- Object result = null;
- if (factory != null)
- result = factory.getAdapter(adaptable, adapterType);
- if (result == null && adapterType.isInstance(adaptable))
- return adaptable;
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterManager#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptable, String adapterType) {
- return getAdapter(adaptable, adapterType, false);
- }
-
- /**
- * Returns an adapter of the given type for the provided adapter.
- * @param adaptable the object to adapt
- * @param adapterType the type to adapt the object to
- * @param force <code>true</code> if the plug-in providing the
- * factory should be activated if necessary. <code>false</code>
- * if no plugin activations are desired.
- */
- private Object getAdapter(Object adaptable, String adapterType, boolean force) {
- IAdapterFactory factory = (IAdapterFactory) getFactories(adaptable.getClass()).get(adapterType);
- if (force && factory instanceof AdapterFactoryProxy)
- factory = ((AdapterFactoryProxy) factory).loadFactory(true);
- Object result = null;
- if (factory != null) {
- Class clazz = classForName(factory, adapterType);
- if (clazz != null)
- result = factory.getAdapter(adaptable, clazz);
- }
- if (result == null && adaptable.getClass().getName().equals(adapterType))
- return adaptable;
- return result;
- }
-
- public boolean hasAdapter(Object adaptable, String adapterTypeName) {
- return getFactories(adaptable.getClass()).get(adapterTypeName) != null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterManager#loadAdapter(java.lang.Object, java.lang.String)
- */
- public Object loadAdapter(Object adaptable, String adapterTypeName) {
- return getAdapter(adaptable, adapterTypeName, true);
- }
-
- /*
- * @see IAdapterManager#registerAdapters
- */
- public synchronized void registerAdapters(IAdapterFactory factory, Class adaptable) {
- registerFactory(factory, adaptable.getName());
- flushLookup();
- }
-
- private void registerExtension(IExtension extension) {
- IConfigurationElement[] elements = extension.getConfigurationElements();
- for (int j = 0; j < elements.length; j++) {
- AdapterFactoryProxy proxy = AdapterFactoryProxy.createProxy(elements[j]);
- if (proxy != null)
- registerFactory(proxy, proxy.getAdaptableType());
- }
- }
-
- /*
- * @see IAdapterManager#registerAdapters
- */
- private void registerFactory(IAdapterFactory factory, String adaptableType) {
- List list = (List) factories.get(adaptableType);
- if (list == null) {
- list = new ArrayList(5);
- factories.put(adaptableType, list);
- }
- list.add(factory);
- }
-
- /**
- * Loads adapters registered with the adapters extension point from
- * the plug-in registry. Note that the actual factory implementations
- * are loaded lazily as they are needed.
- */
- private void registerFactoryProxies() {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint point = registry.getExtensionPoint(Platform.PI_RUNTIME, Platform.PT_ADAPTERS);
- if (point == null)
- return;
- IExtension[] extensions = point.getExtensions();
- for (int i = 0; i < extensions.length; i++)
- registerExtension(extensions[i]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IRegistryChangeListener#registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent)
- */
- public synchronized void registryChanged(IRegistryChangeEvent event) {
- //find the set of changed adapter extensions
- HashSet toRemove = null;
- IExtensionDelta[] deltas = event.getExtensionDeltas();
- String adapterId = Platform.PI_RUNTIME + '.' + Platform.PT_ADAPTERS;
- boolean found = false;
- for (int i = 0; i < deltas.length; i++) {
- //we only care about extensions to the adapters extension point
- if (!adapterId.equals(deltas[i].getExtensionPoint().getUniqueIdentifier()))
- continue;
- found = true;
- if (deltas[i].getKind() == IExtensionDelta.ADDED)
- registerExtension(deltas[i].getExtension());
- else {
- //create the hash set lazily
- if (toRemove == null)
- toRemove = new HashSet();
- toRemove.add(deltas[i].getExtension());
- }
- }
- //need to discard cached state for the changed extensions
- if (found)
- flushLookup();
- if (toRemove == null)
- return;
- //remove any factories belonging to extensions that are going away
- for (Iterator it = factories.values().iterator(); it.hasNext();) {
- for (Iterator it2 = ((List) it.next()).iterator(); it2.hasNext();) {
- IAdapterFactory factory = (IAdapterFactory) it2.next();
- if (factory instanceof AdapterFactoryProxy) {
- IExtension ext = ((AdapterFactoryProxy) factory).getExtension();
- if (toRemove.contains(ext))
- it2.remove();
- }
- }
- }
- }
-
- /*
- * @see IAdapterManager#unregisterAdapters
- */
- public synchronized void unregisterAdapters(IAdapterFactory factory) {
- for (Iterator it = factories.values().iterator(); it.hasNext();)
- ((List) it.next()).remove(factory);
- flushLookup();
- }
-
- /*
- * @see IAdapterManager#unregisterAdapters
- */
- public synchronized void unregisterAdapters(IAdapterFactory factory, Class adaptable) {
- List factoryList = (List) factories.get(adaptable.getName());
- if (factoryList == null)
- return;
- factoryList.remove(factory);
- flushLookup();
- }
-
- /*
- * Shuts down the adapter manager by removing all factories
- * and removing the registry change listener. Should only be
- * invoked during platform shutdown.
- */
- public synchronized void unregisterAllAdapters() {
- factories.clear();
- flushLookup();
- Platform.getExtensionRegistry().removeRegistryChangeListener(this);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Assert.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Assert.java
deleted file mode 100644
index 2278021..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Assert.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-/**
- * <code>Assert</code> is useful for for embedding runtime sanity checks
- * in code.
- * The predicate methods all test a condition and throw some
- * type of unchecked exception if the condition does not hold.
- * <p>
- * Assertion failure exceptions, like most runtime exceptions, are
- * thrown when something is misbehaving. Assertion failures are invariably
- * unspecified behavior; consequently, clients should never rely on
- * these being thrown (and certainly should not being catching them
- * specifically).
- * </p>
- */
-public final class Assert {
- /* This class is not intended to be instantiated. */
- private Assert() {
- // not allowed
- }
-
- /** Asserts that an argument is legal. If the given boolean is
- * not <code>true</code>, an <code>IllegalArgumentException</code>
- * is thrown.
- *
- * @param expression the outcode of the check
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- * @exception IllegalArgumentException if the legality test failed
- */
- public static boolean isLegal(boolean expression) {
- return isLegal(expression, ""); //$NON-NLS-1$
- }
-
- /** Asserts that an argument is legal. If the given boolean is
- * not <code>true</code>, an <code>IllegalArgumentException</code>
- * is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param expression the outcode of the check
- * @param message the message to include in the exception
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- * @exception IllegalArgumentException if the legality test failed
- */
- public static boolean isLegal(boolean expression, String message) {
- if (!expression)
- throw new IllegalArgumentException(message);
- return expression;
- }
-
- /** Asserts that the given object is not <code>null</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- *
- * @param object the value to test
- * @exception IllegalArgumentException if the object is <code>null</code>
- */
- public static void isNotNull(Object object) {
- isNotNull(object, ""); //$NON-NLS-1$
- }
-
- /** Asserts that the given object is not <code>null</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param object the value to test
- * @param message the message to include in the exception
- * @exception IllegalArgumentException if the object is <code>null</code>
- */
- public static void isNotNull(Object object, String message) {
- if (object == null)
- throw new AssertionFailedException("null argument:" + message); //$NON-NLS-1$
- }
-
- /** Asserts that the given boolean is <code>true</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- *
- * @param expression the outcode of the check
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- */
- public static boolean isTrue(boolean expression) {
- return isTrue(expression, ""); //$NON-NLS-1$
- }
-
- /** Asserts that the given boolean is <code>true</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param expression the outcode of the check
- * @param message the message to include in the exception
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- */
- public static boolean isTrue(boolean expression, String message) {
- if (!expression)
- throw new AssertionFailedException("assertion failed: " + message); //$NON-NLS-1$
- return expression;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AssertionFailedException.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AssertionFailedException.java
deleted file mode 100644
index e9c4f7f..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AssertionFailedException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-/**
- * <code>AssertionFailedException</code> is a runtime exception thrown
- * by some of the methods in <code>Assert</code>.
- * <p>
- * This class is not declared public to prevent some misuses; programs that catch
- * or otherwise depend on assertion failures are susceptible to unexpected
- * breakage when assertions in the code are added or removed.
- * </p>
- */
-/* package */
-class AssertionFailedException extends RuntimeException {
- /**
- * All serializable objects should have a stable serialVersionUID
- */
- private static final long serialVersionUID = 1L;
-
- /** Constructs a new exception with the given message.
- */
- public AssertionFailedException(String detail) {
- super(detail);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AuthorizationDatabase.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AuthorizationDatabase.java
deleted file mode 100644
index 4884bec..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AuthorizationDatabase.java
+++ /dev/null
@@ -1,369 +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.runtime;
-
-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 usernames 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 {
- /**
- * Version number for the format of the keyring 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, Platform.PI_RUNTIME, Platform.FAILED_READ_METADATA, NLS.bind(Messages.meta_unableToReadAuthorization, file), e));
- } catch (ClassNotFoundException e) {
- throw new CoreException(new Status(IStatus.ERROR, Platform.PI_RUNTIME, Platform.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
- InternalPlatform.getDefault().log(new Status(IStatus.WARNING, Platform.PI_RUNTIME, Platform.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, Platform.PI_RUNTIME, Platform.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, Platform.PI_RUNTIME, Platform.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 occured while trying to create the file, it means that it is not writtable
- 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/src/org/eclipse/core/internal/runtime/AuthorizationHandler.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AuthorizationHandler.java
deleted file mode 100644
index d0bac9e..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AuthorizationHandler.java
+++ /dev/null
@@ -1,119 +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.runtime;
-
-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.core.runtime.Platform;
-import org.eclipse.osgi.util.NLS;
-
-// 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) initally provided to the platform at startup.
- */
- private static void loadKeyring() throws CoreException {
- if (keyring != null && new File(keyringFile).lastModified() == keyringTimeStamp)
- return;
- if (keyringFile == null) {
- File file = new File(InternalPlatform.getDefault().getConfigurationLocation().getURL().getPath() + '/' + Platform.PI_RUNTIME);
- file = new File(file, F_KEYRING);
- keyringFile = file.getAbsolutePath();
- }
- try {
- keyring = new AuthorizationDatabase(keyringFile, password);
- } catch (CoreException e) {
- InternalPlatform.getDefault().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();
- }
-
- /**
- * @see org.eclipse.core.runtime.Platform
- */
- public static void addAuthorizationInfo(URL serverUrl, String realm, String authScheme, Map info) throws CoreException {
- loadKeyring();
- keyring.addAuthorizationInfo(serverUrl, realm, authScheme, new HashMap(info));
- keyring.save();
- }
-
- /**
- * @see org.eclipse.core.runtime.Platform
- */
- public static void addProtectionSpace(URL resourceUrl, String realm) throws CoreException {
- loadKeyring();
- keyring.addProtectionSpace(resourceUrl, realm);
- keyring.save();
- }
-
- /**
- * @see org.eclipse.core.runtime.Platform
- */
- public static void flushAuthorizationInfo(URL serverUrl, String realm, String authScheme) throws CoreException {
- loadKeyring();
- keyring.flushAuthorizationInfo(serverUrl, realm, authScheme);
- keyring.save();
- }
-
- /**
- * @see org.eclipse.core.runtime.Platform
- */
- public static 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);
- }
-
- /**
- * @see org.eclipse.core.runtime.Platform
- */
- public static 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/src/org/eclipse/core/internal/runtime/Cipher.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Cipher.java
deleted file mode 100644
index 51eaa3c..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Cipher.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-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/src/org/eclipse/core/internal/runtime/CipherInputStream.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/CipherInputStream.java
deleted file mode 100644
index 0bb17c7..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/CipherInputStream.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-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/src/org/eclipse/core/internal/runtime/CipherOutputStream.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/CipherOutputStream.java
deleted file mode 100644
index 600a560..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/CipherOutputStream.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-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/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 ae6c6ed..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/CompatibilityHelper.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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/DataArea.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/DataArea.java
deleted file mode 100644
index 1688402..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/DataArea.java
+++ /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
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.service.datalocation.Location;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.Bundle;
-
-public class DataArea {
- /* package */static final String F_META_AREA = ".metadata"; //$NON-NLS-1$
- /* package */static final String F_PLUGIN_DATA = ".plugins"; //$NON-NLS-1$
- /* package */static final String F_LOG = ".log"; //$NON-NLS-1$
- /**
- * Internal name of the preference storage file (value <code>"pref_store.ini"</code>) in this plug-in's (read-write) state area.
- */
- /* package */static final String PREFERENCES_FILE_NAME = "pref_store.ini"; //$NON-NLS-1$
-
- private IPath location; //The location of the instance data
- private boolean initialized = false;
-
- protected void assertLocationInitialized() throws IllegalStateException {
- if (location != null && initialized)
- return;
- Location service = InternalPlatform.getDefault().getInstanceLocation();
- if (service == null)
- throw new IllegalStateException(Messages.meta_noDataModeSpecified);
- try {
- URL url = service.getURL();
- if (url == null)
- throw new IllegalStateException(Messages.meta_instanceDataUnspecified);
- // TODO assume the URL is a file:
- // Use the new File technique to ensure that the resultant string is
- // in the right format (e.g., leading / removed from /c:/foo etc)
- location = new Path(new File(url.getFile()).toString());
- initializeLocation();
- } catch (CoreException e) {
- throw new IllegalStateException(e.getMessage());
- }
- }
-
- public IPath getMetadataLocation() throws IllegalStateException {
- assertLocationInitialized();
- return location.append(F_META_AREA);
- }
-
- public IPath getInstanceDataLocation() throws IllegalStateException {
- assertLocationInitialized();
- return location;
- }
-
- public IPath getLogLocation() throws IllegalStateException {
- return new Path(InternalPlatform.getDefault().getFrameworkLog().getFile().getAbsolutePath());
- }
-
- /**
- * Returns the read/write location in which the given bundle can manage private state.
- */
- public IPath getStateLocation(Bundle bundle) throws IllegalStateException {
- assertLocationInitialized();
- return getStateLocation(bundle.getSymbolicName());
- }
-
- public IPath getStateLocation(String bundleName) throws IllegalStateException {
- assertLocationInitialized();
- return getMetadataLocation().append(F_PLUGIN_DATA).append(bundleName);
- }
-
- public IPath getPreferenceLocation(String bundleName, boolean create) throws IllegalStateException {
- IPath result = getStateLocation(bundleName);
- if (create)
- result.toFile().mkdirs();
- return result.append(PREFERENCES_FILE_NAME);
- }
-
- private void initializeLocation() throws CoreException {
- // check if the location can be created
- if (location.toFile().exists()) {
- if (!location.toFile().isDirectory()) {
- String message = NLS.bind(Messages.meta_notDir, location);
- throw new CoreException(new Status(IStatus.ERROR, Platform.PI_RUNTIME, Platform.FAILED_WRITE_METADATA, message, null));
- }
- }
- //try infer the device if there isn't one (windows)
- if (location.getDevice() == null)
- location = new Path(location.toFile().getAbsolutePath());
- createLocation();
- initialized = true;
- }
-
- private void createLocation() throws CoreException {
- // append on the metadata location so that the whole structure is created.
- File file = location.append(F_META_AREA).toFile();
- try {
- file.mkdirs();
- } catch (Exception e) {
- String message = NLS.bind(Messages.meta_couldNotCreate, file.getAbsolutePath());
- throw new CoreException(new Status(IStatus.ERROR, Platform.PI_RUNTIME, Platform.FAILED_WRITE_METADATA, message, e));
- }
- if (!file.canWrite()) {
- String message = NLS.bind(Messages.meta_readonly, file.getAbsolutePath());
- throw new CoreException(new Status(IStatus.ERROR, Platform.PI_RUNTIME, Platform.FAILED_WRITE_METADATA, message, null));
- }
- // set the log file location now that we created the data area
- IPath path = location.append(F_META_AREA).append(F_LOG);
- try {
- InternalPlatform.getDefault().getFrameworkLog().setFile(path.toFile(), true);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/DevClassPathHelper.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/DevClassPathHelper.java
deleted file mode 100644
index 8d79fea..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/DevClassPathHelper.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-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(InternalPlatform.PROP_DEV);
- if (osgiDev != null) {
- try {
- inDevelopmentMode = true;
- URL location = new URL(osgiDev);
- devProperties = load(location);
- if (devProperties != null)
- 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/src/org/eclipse/core/internal/runtime/FindSupport.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/FindSupport.java
deleted file mode 100644
index 2c974ed..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/FindSupport.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Map;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.osgi.framework.Bundle;
-
-// This class provides implements the find* methods exposed on Platform.
-// It does the lookup in bundles and fragments and does the variable replacement.
-public class FindSupport {
- private static String[] NL_JAR_VARIANTS = buildNLVariants(InternalPlatform.getDefault().getNL());
-
- private static String[] buildNLVariants(String nl) {
- ArrayList result = new ArrayList();
- IPath base = new Path("nl"); //$NON-NLS-1$
-
- IPath path = new Path(nl.replace('_', '/'));
- while (path.segmentCount() > 0) {
- result.add(base.append(path).toString());
- // for backwards compatibility only, don't replace the slashes
- if (path.segmentCount() > 1)
- result.add(base.append(path.toString().replace('/', '_')).toString());
- path = path.removeLastSegments(1);
- }
-
- return (String[]) result.toArray(new String[result.size()]);
- }
-
- /**
- * See doc on @link Platform#find(Bundle, IPath) Platform#find(Bundle, IPath)
- */
- public static URL find(Bundle bundle, IPath path) {
- return find(bundle, path, null);
- }
-
- /**
- * See doc on @link Platform#find(Bundle, IPath, Map) Platform#find(Bundle, IPath, Map)
- */
- public static URL find(Bundle b, IPath path, Map override) {
- if (path == null)
- return null;
-
- URL result = null;
-
- // Check for the empty or root case first
- if (path.isEmpty() || path.isRoot()) {
- // Watch for the root case. It will produce a new
- // URL which is only the root directory (and not the
- // root of this plugin).
- result = findInPlugin(b, Path.EMPTY);
- if (result == null)
- result = findInFragments(b, Path.EMPTY);
- return result;
- }
-
- // Now check for paths without variable substitution
- String first = path.segment(0);
- if (first.charAt(0) != '$') {
- result = findInPlugin(b, path);
- if (result == null)
- result = findInFragments(b, path);
- return result;
- }
-
- // Worry about variable substitution
- IPath rest = path.removeFirstSegments(1);
- if (first.equalsIgnoreCase("$nl$")) //$NON-NLS-1$
- return findNL(b, rest, override);
- if (first.equalsIgnoreCase("$os$")) //$NON-NLS-1$
- return findOS(b, rest, override);
- if (first.equalsIgnoreCase("$ws$")) //$NON-NLS-1$
- return findWS(b, rest, override);
- if (first.equalsIgnoreCase("$files$")) //$NON-NLS-1$
- return null;
-
- return null;
- }
-
- private static URL findOS(Bundle b, IPath path, Map override) {
- String os = null;
- if (override != null)
- try {
- // check for override
- os = (String) override.get("$os$"); //$NON-NLS-1$
- } catch (ClassCastException e) {
- // just in case
- }
- if (os == null)
- // use default
- os = InternalPlatform.getDefault().getOS();
- if (os.length() == 0)
- return null;
-
- // Now do the same for osarch
- String osArch = null;
- if (override != null)
- try {
- // check for override
- osArch = (String) override.get("$arch$"); //$NON-NLS-1$
- } catch (ClassCastException e) {
- // just in case
- }
- if (osArch == null)
- // use default
- osArch = InternalPlatform.getDefault().getOSArch();
- if (osArch.length() == 0)
- return null;
-
- URL result = null;
- IPath base = new Path("os").append(os).append(osArch); //$NON-NLS-1$
- // Keep doing this until all you have left is "os" as a path
- while (base.segmentCount() != 1) {
- IPath filePath = base.append(path);
- result = findInPlugin(b, filePath);
- if (result != null)
- return result;
- result = findInFragments(b, filePath);
- if (result != null)
- return result;
- base = base.removeLastSegments(1);
- }
- // If we get to this point, we haven't found it yet.
- // Look in the plugin and fragment root directories
- result = findInPlugin(b, path);
- if (result != null)
- return result;
- return findInFragments(b, path);
- }
-
- private static URL findWS(Bundle b, IPath path, Map override) {
- String ws = null;
- if (override != null)
- try {
- // check for override
- ws = (String) override.get("$ws$"); //$NON-NLS-1$
- } catch (ClassCastException e) {
- // just in case
- }
- if (ws == null)
- // use default
- ws = InternalPlatform.getDefault().getWS();
- IPath filePath = new Path("ws").append(ws).append(path); //$NON-NLS-1$
- // We know that there is only one segment to the ws path
- // e.g. ws/win32
- URL result = findInPlugin(b, filePath);
- if (result != null)
- return result;
- result = findInFragments(b, filePath);
- if (result != null)
- return result;
- // If we get to this point, we haven't found it yet.
- // Look in the plugin and fragment root directories
- result = findInPlugin(b, path);
- if (result != null)
- return result;
- return findInFragments(b, path);
- }
-
- private static URL findNL(Bundle b, IPath path, Map override) {
- String nl = null;
- String[] nlVariants = null;
- if (override != null)
- try {
- // check for override
- nl = (String) override.get("$nl$"); //$NON-NLS-1$
- } catch (ClassCastException e) {
- // just in case
- }
- nlVariants = nl == null ? NL_JAR_VARIANTS : buildNLVariants(nl);
- if (nl != null && nl.length() == 0)
- return null;
-
- URL result = null;
- for (int i = 0; i < nlVariants.length; i++) {
- IPath filePath = new Path(nlVariants[i]).append(path);
- result = findInPlugin(b, filePath);
- if (result != null)
- return result;
- result = findInFragments(b, filePath);
- if (result != null)
- return result;
- }
- // If we get to this point, we haven't found it yet.
- // Look in the plugin and fragment root directories
- result = findInPlugin(b, path);
- if (result != null)
- return result;
- return findInFragments(b, path);
- }
-
- private static URL findInPlugin(Bundle b, IPath filePath) {
- return b.getEntry(filePath.toString());
- }
-
- private static URL findInFragments(Bundle b, IPath filePath) {
- Bundle[] fragments = InternalPlatform.getDefault().getFragments(b);
- if (fragments == null)
- return null;
-
- URL fileURL = null;
- int i = 0;
- while (i < fragments.length && fileURL == null) {
- fileURL = fragments[i].getEntry(filePath.toString());
- i++;
- }
- return fileURL;
- }
-
- /**
- * See doc on @link Platform#openStream(Bundle, IPath, boolean) Platform#Platform#openStream(Bundle, IPath, boolean)
- */
- public static final InputStream openStream(Bundle bundle, IPath file, boolean localized) throws IOException {
- URL url = null;
- if (!localized) {
- url = findInPlugin(bundle, file);
- if (url == null)
- url = findInFragments(bundle, file);
- } else {
- url = FindSupport.find(bundle, file);
- }
- if (url != null)
- return url.openStream();
- throw new IOException("Cannot find " + file.toString()); //$NON-NLS-1$
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/HashMapOfString.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/HashMapOfString.java
deleted file mode 100644
index c29747b..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/HashMapOfString.java
+++ /dev/null
@@ -1,169 +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.runtime;
-
-import org.eclipse.core.internal.preferences.StringPool;
-
-/**
- * Hashtable of {String --> String}.
- *
- * This map handles collisions using linear probing. When elements are
- * removed, the entire table is rehashed. Thus this map has good space
- * characteristics, good insertion and iteration performance, but slower
- * removal performance than a HashMap.
- * <p>
- * This map is not thread safe.
- */
-public final class HashMapOfString {
- private static final String[] EMPTY_STRING_ARRAY = new String[0];
- /**
- * number of elements in the table
- */
- private int elementSize;
- /**
- * The table keys
- */
- private String[] keyTable;
-
- private int threshold;
-
- private String[] valueTable;
- private static final float LOAD_FACTOR = 0.45f;
-
- public HashMapOfString() {
- this(16);
- }
-
- public HashMapOfString(int size) {
- this.elementSize = 0;
- //table size must always be a power of two
- int tableLen = 1;
- while (tableLen < size)
- tableLen *= 2;
- this.keyTable = new String[tableLen];
- this.valueTable = new String[tableLen];
- this.threshold = (int) (tableLen * LOAD_FACTOR);
- }
-
- public String get(String key) {
- int lengthMask = keyTable.length - 1;
- int index = key.hashCode() & lengthMask;
- String currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.equals(key))
- return valueTable[index];
- index = (index+1) & lengthMask;
- }
- return null;
- }
-
- public boolean isEmpty() {
- return elementSize == 0;
- }
-
- /**
- * Returns an array of all keys in this map.
- */
- public String[] keys() {
- if (elementSize == 0)
- return EMPTY_STRING_ARRAY;
- String[] result = new String[elementSize];
- int next = 0;
- for (int i = 0; i < keyTable.length; i++)
- if (keyTable[i] != null)
- result[next++] = keyTable[i];
- return result;
- }
-
- public String put(String key, String value) {
- int lengthMask = keyTable.length - 1;
- int index = key.hashCode() & lengthMask;
- String currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.equals(key))
- return valueTable[index] = value;
- index = (index+1) & lengthMask;
- }
- keyTable[index] = key;
- valueTable[index] = value;
-
- // assumes the threshold is never equal to the size of the table
- if (++elementSize > threshold)
- rehash(keyTable.length * 2);
- return value;
- }
-
- private void rehash(int newLen) {
- HashMapOfString newHashtable = new HashMapOfString(newLen);
- String currentKey;
- int oldLen = keyTable.length;
- for (int i = oldLen; --i >= 0;)
- if ((currentKey = keyTable[i]) != null)
- newHashtable.put(currentKey, valueTable[i]);
- this.keyTable = newHashtable.keyTable;
- this.valueTable = newHashtable.valueTable;
- this.threshold = newHashtable.threshold;
- }
-
- public String removeKey(String key) {
- int lengthMask = keyTable.length - 1;
- int index = key.hashCode() & lengthMask;
- String currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.equals(key)) {
- String value = valueTable[index];
- elementSize--;
- keyTable[index] = null;
- valueTable[index] = null;
- rehash((int) (elementSize / LOAD_FACTOR));
- return value;
- }
- index = (index+1) & lengthMask;
- }
- return null;
- }
-
- /* (non-Javadoc
- * Method declared on IStringPoolParticipant
- */
- public void shareStrings(StringPool set) {
- //copy elements for thread safety
- String[] array = keyTable;
- if (array == null)
- return;
- for (int i = 0; i < array.length; i++) {
- String o = array[i];
- if (o != null)
- array[i] = set.add(o);
- }
- array = valueTable;
- if (array == null)
- return;
- for (int i = 0; i < array.length; i++) {
- String o = array[i];
- if (o != null)
- array[i] = set.add(o);
- }
- }
-
- public int size() {
- return elementSize;
- }
-
- public String toString() {
- String s = ""; //$NON-NLS-1$
- String value;
- for (int i = 0, length = valueTable.length; i < length; i++)
- if ((value = valueTable[i]) != null)
- s += keyTable[i] + " -> " + value.toString() + "\n"; //$NON-NLS-2$ //$NON-NLS-1$
- return s;
- }
-}
\ No newline at end of file
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 f806763..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java
+++ /dev/null
@@ -1,1127 +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
- * Julian Chen - fix for bug #92572, jclRM
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import org.eclipse.core.internal.boot.*;
-import org.eclipse.core.internal.content.ContentTypeManager;
-import org.eclipse.core.internal.jobs.JobManager;
-import org.eclipse.core.internal.preferences.PreferencesService;
-import org.eclipse.core.internal.registry.ExtensionRegistry;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.adaptor.FileManager;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.core.runtime.preferences.IPreferencesService;
-import org.eclipse.osgi.framework.log.FrameworkLog;
-import org.eclipse.osgi.framework.log.FrameworkLogEntry;
-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.eclipse.osgi.service.urlconversion.URLConverter;
-import org.eclipse.osgi.util.NLS;
-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 IAdapterManager adapterManager;
-
- // Command line args as seen by the Eclipse runtime. allArgs does NOT
- // include args consumed by the underlying framework (e.g., OSGi)
- private static String[] allArgs = new String[0];
- private static String[] appArgs = new String[0];
- private static final String APPLICATION = "-application"; //$NON-NLS-1$
-
- 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};
- private static final String BOOT = "-boot"; //$NON-NLS-1$
- private static final String CLASSLOADER_PROPERTIES = "-classloaderProperties"; //$NON-NLS-1$
-
- // debug support: set in loadOptions()
- public static boolean DEBUG = false;
- public static boolean DEBUG_CONTEXT = false;
- public static boolean DEBUG_PREFERENCE_GENERAL = false;
- public static boolean DEBUG_PREFERENCE_GET = false;
- public static boolean DEBUG_PREFERENCE_SET = false;
- public static boolean DEBUG_REGISTRY = false;
-
- private static Runnable splashHandler = null;
- private static final String FEATURE = "-feature"; //$NON-NLS-1$
- private static final String FIRST_USE = "-firstUse"; //$NON-NLS-1$
- private static String[] frameworkArgs = new String[0];
- static FrameworkLog frameworkLog;
-
- static EnvironmentInfo infoService;
- private static boolean initialized;
- private static final String KEY_DOUBLE_PREFIX = "%%"; //$NON-NLS-1$
-
- private static final String KEY_PREFIX = "%"; //$NON-NLS-1$
- private static final String KEYRING = "-keyring"; //$NON-NLS-1$
- private static String keyringFile;
-
- private static ArrayList logListeners = new ArrayList(5);
- private static Map logs = new HashMap(5);
- private static DataArea metaArea;
- private static final String NEW_UPDATES = "-newUpdates"; //$NON-NLS-1$
- private static final String NO_LAZY_REGISTRY_CACHE_LOADING = "-noLazyRegistryCacheLoading"; //$NON-NLS-1$
-
- // obsolete command line args
- private static final String NO_PACKAGE_PREFIXES = "-noPackagePrefixes"; //$NON-NLS-1$
- private static final String NO_REGISTRY_CACHE = "-noregistrycache"; //$NON-NLS-1$
- private static final String NO_UPDATE = "-noUpdate"; //$NON-NLS-1$
-
- 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};
- static PackageAdmin packageAdmin;
- 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_CUSTOMIZATION = "-plugincustomization"; //$NON-NLS-1$
-
- private static final String PLUGIN_PATH = ".plugin-path"; //$NON-NLS-1$
- public static String pluginCustomizationFile = null;
- private static final String PLUGINS = "-plugins"; //$NON-NLS-1$
-
- // command line options
- private static final String PRODUCT = "-product"; //$NON-NLS-1$
- public static final String PROP_ADAPTOR = "osgi.adaptor"; //$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_CHECK_CONFIG = "osgi.checkConfiguration"; //$NON-NLS-1$
- public static final String PROP_CONFIG_AREA = "osgi.configuration.area"; //$NON-NLS-1$
- public static final String PROP_CONSOLE = "osgi.console"; //$NON-NLS-1$
- public static final String PROP_CONSOLE_CLASS = "osgi.consoleClass"; //$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$
- public static final String PROP_EXITCODE = "eclipse.exitcode"; //$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_INSTANCE_AREA = "osgi.instance.area"; //$NON-NLS-1$
- public static final String PROP_MANIFEST_CACHE = "osgi.manifest.cache"; //$NON-NLS-1$
- public static final String PROP_NL = "osgi.nl"; //$NON-NLS-1$
- public static final String PROP_NO_LAZY_CACHE_LOADING = "eclipse.noLazyRegistryCacheLoading"; //$NON-NLS-1$
- public static final String PROP_NO_REGISTRY_CACHE = "eclipse.noRegistryCache"; //$NON-NLS-1$
- public static final String PROP_NO_REGISTRY_FLUSHING = "eclipse.noRegistryFlushing"; //$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_SYSPATH = "osgi.syspath"; //$NON-NLS-1$
- public static final String PROP_USER_AREA = "osgi.user.area"; //$NON-NLS-1$
- public static final String PROP_WS = "osgi.ws"; //$NON-NLS-1$
- private static final InternalPlatform singleton = new InternalPlatform();
-
- private static final String UPDATE = "-update"; //$NON-NLS-1$
- static URLConverter urlConverter;
- private static final String[] WS_LIST = {Platform.WS_CARBON, Platform.WS_GTK, Platform.WS_MOTIF, Platform.WS_PHOTON, Platform.WS_WIN32};
- private Path cachedInstanceLocation; // Cache the path of the instance location
- private ServiceTracker configurationLocation = null;
- private BundleContext context;
- private ServiceTracker debugTracker = null;
-
- private ArrayList groupProviders = new ArrayList(3);
- private ServiceTracker installLocation = null;
- private ServiceTracker instanceLocation = null;
- private boolean missingProductReported = false;
- private DebugOptions options = null;
- private IProduct product;
- private IExtensionRegistry registry;
-
- private FileManager runtimeFileManager;
- private Plugin runtimeInstance; // Keep track of the plugin object for runtime in case the backward compatibility is run.
-
- private ServiceTracker userLocation = null;
-
- public static InternalPlatform getDefault() {
- return singleton;
- }
-
- /**
- * Private constructor to block instance creation.
- */
- private InternalPlatform() {
- super();
- }
-
- public void addAuthorizationInfo(URL serverUrl, String realm, String authScheme, Map info) throws CoreException {
- AuthorizationHandler.addAuthorizationInfo(serverUrl, realm, authScheme, info);
- }
-
- /**
- * @see Platform#addLogListener(ILogListener)
- */
- public void addLogListener(ILogListener listener) {
- assertInitialized();
- synchronized (logListeners) {
- // replace if already exists (Set behaviour but we use an array
- // since we want to retain order)
- logListeners.remove(listener);
- logListeners.add(listener);
- }
- }
-
- public void addProtectionSpace(URL resourceUrl, String realm) throws CoreException {
- AuthorizationHandler.addProtectionSpace(resourceUrl, realm);
- }
-
- private URL asActualURL(URL url) throws IOException {
- if (!url.getProtocol().equals(PlatformURLHandler.PROTOCOL))
- return url;
- URLConnection connection = url.openConnection();
- if (connection instanceof PlatformURLConnection)
- return ((PlatformURLConnection) connection).getResolvedURL();
- return url;
- }
-
- /**
- * @see Platform
- */
- public URL asLocalURL(URL url) throws IOException {
- URL result = url;
- // If this is a platform URL get the local URL from the PlatformURLConnection
- if (result.getProtocol().equals(PlatformURLHandler.PROTOCOL))
- result = asActualURL(url);
-
- // If the result is a bundleentry or bundleresouce URL then
- // convert it to a file URL. This will end up extracting the
- // bundle entry to cache if the bundle is packaged as a jar.
- if (result.getProtocol().startsWith(PlatformURLHandler.BUNDLE)) {
- if (urlConverter == null)
- throw new IOException("url.noaccess"); //$NON-NLS-1$
- result = urlConverter.convertToFileURL(result);
- }
-
- return result;
- }
-
- private void assertInitialized() {
- //avoid the Policy.bind if assertion is true
- if (!initialized)
- Assert.isTrue(false, Messages.meta_appNotInit);
- }
-
- public void clearRegistryCache() {
- if (registry instanceof ExtensionRegistry)
- ((ExtensionRegistry) registry).clearRegistryCache();
- }
-
- /**
- * @see Platform#endSplash()
- */
- public void endSplash() {
- final Runnable handler = splashHandler;
- if (handler == null)
- return;
- //clear reference to handler to avoid calling it again and to avoid object leak
- splashHandler = null;
- run(new ISafeRunnable() {
- public void handleException(Throwable e) {
- // just continue ... the exception has already been logged by
- // handleException(ISafeRunnable)
- }
-
- public void run() throws Exception {
- handler.run();
- }
- });
- }
-
- public URL find(Bundle b, IPath path) {
- return FindSupport.find(b, path);
- }
-
- public URL find(Bundle bundle, IPath path, Map override) {
- return FindSupport.find(bundle, path, override);
- }
-
- public void flushAuthorizationInfo(URL serverUrl, String realm, String authScheme) throws CoreException {
- AuthorizationHandler.flushAuthorizationInfo(serverUrl, realm, authScheme);
- }
-
- /**
- * @see Platform#getAdapterManager()
- */
- public IAdapterManager getAdapterManager() {
- assertInitialized();
- if (adapterManager == null)
- adapterManager = new AdapterManager();
- return adapterManager;
- }
-
- public String[] getApplicationArgs() {
- return appArgs;
- }
-
- public Map getAuthorizationInfo(URL serverUrl, String realm, String authScheme) {
- return AuthorizationHandler.getAuthorizationInfo(serverUrl, realm, authScheme);
- }
-
- 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) {
- 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;
- }
-
- public IBundleGroupProvider[] getBundleGroupProviders() {
- return (IBundleGroupProvider[]) groupProviders.toArray(new IBundleGroupProvider[groupProviders.size()]);
- }
-
- /**
- * 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;
- if (packageAdmin == null)
- return null;
- Bundle source = packageAdmin.getBundle(object.getClass());
- if (source != null && source.getSymbolicName() != null)
- return source.getSymbolicName();
- return null;
- }
-
- public Bundle[] getBundles(String symbolicName, String version) {
- 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 bundes 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 allArgs;
- }
-
- public Location getConfigurationLocation() {
- assertInitialized();
- return (Location) configurationLocation.getService();
- }
-
- public IContentTypeManager getContentTypeManager() {
- return ContentTypeManager.getInstance();
- }
-
- public EnvironmentInfo getEnvironmentInfoService() {
- return infoService;
- }
-
- public Bundle[] getFragments(Bundle bundle) {
- if (packageAdmin == null)
- return null;
- return packageAdmin.getFragments(bundle);
- }
-
- public FrameworkLog getFrameworkLog() {
- return frameworkLog;
- }
-
- public Bundle[] getHosts(Bundle bundle) {
- if (packageAdmin == null)
- return null;
- return packageAdmin.getHosts(bundle);
- }
-
- public Location getInstallLocation() {
- assertInitialized();
- 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();
- return (Location) instanceLocation.getService();
- }
-
- public int getIntegerOption(String option, int defaultValue) {
- String value = getOption(option);
- if (value == null)
- return defaultValue;
- try {
- return Integer.parseInt(value);
- } catch (NumberFormatException e) {
- return defaultValue;
- }
- }
-
- public IJobManager getJobManager() {
- return JobManager.getInstance();
- }
-
- /**
- * @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;
- }
-
- public IPath getLogFileLocation() {
- return getMetaArea().getLogLocation();
- }
-
- /**
- * Returns the object which defines the location and organization
- * of the platform's meta area.
- */
- public DataArea getMetaArea() {
- if (metaArea != null)
- return metaArea;
-
- metaArea = new DataArea();
- return metaArea;
- }
-
- public String getNL() {
- return System.getProperty(PROP_NL);
- }
-
- /**
- * @see Platform
- */
- public String getOption(String option) {
- if (options != null)
- return options.getOption(option);
- return null;
- }
-
- public String getOS() {
- return System.getProperty(PROP_OS);
- }
-
- public String getOSArch() {
- return System.getProperty(PROP_ARCH);
- }
-
- public PlatformAdmin getPlatformAdmin() {
- 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.
- * It's 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(PlatformURLBaseConnection.PLATFORM_URL_STRING + PLUGIN_PATH);
- 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() {
- return PreferencesService.getDefault();
- }
-
- /**
- * Look for the companion preference translation file for a group
- * of preferences. This method will attempt to find a companion
- * ".properties" file first. This companion file can be in an
- * nl-specific directory for this plugin or any of its fragments or
- * it can be in the root of this plugin or the root of any of the
- * plugin's fragments. This properties file can be used to translate
- * preference values.
- *
- * TODO fix these comments
- * @param uniqueIdentifier the descriptor of the plugin
- * who has the preferences
- * @param basePrefFileName the base name of the preference file
- * This base will be used to construct the name of the
- * companion translation file.
- * Example: If basePrefFileName is "plugin_customization",
- * the preferences are in "plugin_customization.ini" and
- * the translations are found in
- * "plugin_customization.properties".
- * @return the properties file
- *
- * @since 2.0
- */
- public Properties getPreferenceTranslator(String uniqueIdentifier, String basePrefFileName) {
- return new Properties();
- }
-
- public IProduct getProduct() {
- if (product != null)
- return product;
- String productId = System.getProperty(PROP_PRODUCT);
- if (productId == null)
- return null;
- IConfigurationElement[] entries = getRegistry().getConfigurationElementsFor(Platform.PI_RUNTIME, Platform.PT_PRODUCT, productId);
- if (entries.length > 0) {
- // There should only be one product with the given id so just take the first element
- product = new Product(productId, entries[0]);
- return product;
- }
- IConfigurationElement[] elements = getRegistry().getConfigurationElementsFor(Platform.PI_RUNTIME, Platform.PT_PRODUCT);
- List logEntries = null;
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
- if (element.getName().equalsIgnoreCase("provider")) { //$NON-NLS-1$
- try {
- IProductProvider provider = (IProductProvider) element.createExecutableExtension("run"); //$NON-NLS-1$
- IProduct[] products = provider.getProducts();
- for (int j = 0; j < products.length; j++) {
- IProduct provided = products[j];
- if (provided.getId().equalsIgnoreCase(productId)) {
- product = provided;
- return product;
- }
- }
- } catch (CoreException e) {
- if (logEntries == null)
- logEntries = new ArrayList(3);
- logEntries.add(new FrameworkLogEntry(Platform.PI_RUNTIME, NLS.bind(Messages.provider_invalid, element.getParent().toString()), 0, e, null));
- }
- }
- }
- if (logEntries != null)
- getFrameworkLog().log(new FrameworkLogEntry(Platform.PI_RUNTIME, Messages.provider_invalid_general, 0, null, (FrameworkLogEntry[]) logEntries.toArray()));
-
- if (!missingProductReported) {
- getFrameworkLog().log(new FrameworkLogEntry(Platform.PI_RUNTIME, NLS.bind(Messages.product_notFound, productId), 0, null, null));
- missingProductReported = true;
- }
- return null;
- }
-
- public String getProtectionSpace(URL resourceUrl) {
- return AuthorizationHandler.getProtectionSpace(resourceUrl);
- }
-
- public IExtensionRegistry getRegistry() {
- return registry;
- }
-
- 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);
- }
-
- public FileManager getRuntimeFileManager() {
- return runtimeFileManager;
- }
-
- public Plugin getRuntimeInstance() {
- return runtimeInstance;
- }
-
- private Runnable getSplashHandler() {
- ServiceReference[] ref;
- try {
- ref = context.getServiceReferences(Runnable.class.getName(), null);
- } catch (InvalidSyntaxException e) {
- return null;
- }
- // assumes the endInitializationHandler is available as a service
- // see EclipseStarter.publishSplashScreen
- for (int i = 0; i < ref.length; i++) {
- String name = (String) ref[i].getProperty("name"); //$NON-NLS-1$
- if (name != null && name.equals("splashscreen")) { //$NON-NLS-1$
- Runnable result = (Runnable) context.getService(ref[i]);
- context.ungetService(ref[i]);
- 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 URLConverter getURLConverter() {
- return urlConverter;
- }
-
- public Location getUserLocation() {
- assertInitialized();
- return (Location) userLocation.getService();
- }
-
- public String getWS() {
- return System.getProperty(PROP_WS);
- }
-
- private void handleException(ISafeRunnable code, Throwable e) {
- if (!(e instanceof OperationCanceledException)) {
- // try to obtain the correct plug-in id for the bundle providing the safe runnable
- String pluginId = getBundleId(code);
- if (pluginId == null)
- pluginId = Platform.PI_RUNTIME;
- String message = NLS.bind(Messages.meta_pluginProblems, pluginId);
- IStatus status;
- if (e instanceof CoreException) {
- status = new MultiStatus(pluginId, Platform.PLUGIN_ERROR, message, e);
- ((MultiStatus) status).merge(((CoreException) e).getStatus());
- } else {
- status = new Status(IStatus.ERROR, pluginId, Platform.PLUGIN_ERROR, message, e);
- }
- //we have to be safe, so don't try to log if the platform is not running
- //since it will fail - last resort is to print the stack trace on stderr
- if (initialized)
- log(status);
- else
- e.printStackTrace();
- }
- code.handleException(e);
- }
-
- /**
- * @return whether platform log writer has already been registered
- */
- public boolean hasLogWriter() {
- return platformLog != null && logListeners.contains(platformLog);
- }
-
- private void initializeAuthorizationHandler() {
- AuthorizationHandler.setKeyringFile(keyringFile);
- AuthorizationHandler.setPassword(password);
- }
-
- /*
- * Finds and loads the options file
- */
- void initializeDebugFlags() {
- // load runtime options
- DEBUG = getBooleanOption(Platform.PI_RUNTIME + "/debug", false); //$NON-NLS-1$
- if (DEBUG) {
- DEBUG_CONTEXT = getBooleanOption(Platform.PI_RUNTIME + "/debug/context", false); //$NON-NLS-1$
- DEBUG_REGISTRY = getBooleanOption(Platform.PI_RUNTIME + "/registry/debug", false); //$NON-NLS-1$
- DEBUG_PREFERENCE_GENERAL = getBooleanOption(Platform.PI_RUNTIME + "/preferences/general", false); //$NON-NLS-1$
- DEBUG_PREFERENCE_GET = getBooleanOption(Platform.PI_RUNTIME + "/preferences/get", false); //$NON-NLS-1$
- DEBUG_PREFERENCE_SET = getBooleanOption(Platform.PI_RUNTIME + "/preferences/set", false); //$NON-NLS-1$
- }
- }
-
- private void initializeLocationTrackers() {
- final String FILTER_PREFIX = "(&(objectClass=org.eclipse.osgi.service.datalocation.Location)(type="; //$NON-NLS-1$
- Filter filter = null;
- try {
- filter = context.createFilter(FILTER_PREFIX + PROP_CONFIG_AREA + "))"); //$NON-NLS-1$
- } catch (InvalidSyntaxException e) {
- // ignore this. It should never happen as we have tested the above format.
- }
- configurationLocation = new ServiceTracker(context, filter, null);
- configurationLocation.open();
-
- try {
- filter = context.createFilter(FILTER_PREFIX + PROP_USER_AREA + "))"); //$NON-NLS-1$
- } catch (InvalidSyntaxException e) {
- // ignore this. It should never happen as we have tested the above format.
- }
- userLocation = new ServiceTracker(context, filter, null);
- userLocation.open();
-
- try {
- filter = context.createFilter(FILTER_PREFIX + PROP_INSTANCE_AREA + "))"); //$NON-NLS-1$
- } catch (InvalidSyntaxException e) {
- // ignore this. It should never happen as we have tested the above format.
- }
- instanceLocation = new ServiceTracker(context, filter, null);
- instanceLocation.open();
-
- try {
- filter = context.createFilter(FILTER_PREFIX + PROP_INSTALL_AREA + "))"); //$NON-NLS-1$
- } catch (InvalidSyntaxException e) {
- // ignore this. It should never happen as we have tested the above format.
- }
- installLocation = new ServiceTracker(context, filter, null);
- installLocation.open();
- }
-
- private void initializeRuntimeFileManager() throws IOException {
- Location configuration = getConfigurationLocation();
- File controlledDir = new File(configuration.getURL().getPath() + '/' + Platform.PI_RUNTIME);
- runtimeFileManager = new FileManager(controlledDir, configuration.isReadOnly() ? "none" : null, configuration.isReadOnly()); //$NON-NLS-1$
- runtimeFileManager.open(!configuration.isReadOnly());
- }
-
- public boolean isFragment(Bundle bundle) {
- if (packageAdmin == null)
- return false;
- return (packageAdmin.getBundleType(bundle) & PackageAdmin.BUNDLE_TYPE_FRAGMENT) > 0;
- }
-
- public boolean isRunning() {
- try {
- return initialized && 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) {
- if (!initialized) {
- Throwable t = status.getException();
- if (t != null)
- t.printStackTrace();
- assertInitialized();
- }
- // 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 handleException(Throwable e) {
- //Ignore
- }
-
- public void run() throws Exception {
- listener.logging(status, Platform.PI_RUNTIME);
- }
- };
- run(code);
- }
- }
-
- private String[] processCommandLine(String[] args) {
- final String TRUE = "true"; //$NON-NLS-1$
-
- if (args == null)
- return args;
- allArgs = args;
- if (args.length == 0)
- return args;
-
- int[] configArgs = new int[args.length];
- //need to initialize the first element to something that could not be an index.
- configArgs[0] = -1;
- int configArgIndex = 0;
- for (int i = 0; i < args.length; i++) {
- boolean found = false;
- // check for args without parameters (i.e., a flag arg)
-
- // look for the no registry cache flag
- if (args[i].equalsIgnoreCase(NO_REGISTRY_CACHE)) {
- // use the long way to set the property to compile against eeminimum
- System.getProperties().setProperty(PROP_NO_REGISTRY_CACHE, TRUE);
- found = true;
- }
-
- // check to see if we should NOT be lazily loading plug-in definitions from the registry cache file.
- // This will be processed below.
- if (args[i].equalsIgnoreCase(NO_LAZY_REGISTRY_CACHE_LOADING)) {
- // use the long way to set the property to compile against eeminimum
- System.getProperties().setProperty(PROP_NO_LAZY_CACHE_LOADING, TRUE);
- found = true;
- }
-
- // consume obsolete args
- if (args[i].equalsIgnoreCase(CLASSLOADER_PROPERTIES))
- found = true; // ignored
- if (args[i].equalsIgnoreCase(NO_PACKAGE_PREFIXES))
- found = true; // ignored
- if (args[i].equalsIgnoreCase(PLUGINS))
- found = true; // ignored
- if (args[i].equalsIgnoreCase(FIRST_USE))
- found = true; // ignored
- if (args[i].equalsIgnoreCase(NO_UPDATE))
- found = true; // ignored
- if (args[i].equalsIgnoreCase(NEW_UPDATES))
- found = true; // ignored
- if (args[i].equalsIgnoreCase(UPDATE))
- found = true; // ignored
-
- // done checking for args. Remember where an arg was found
- if (found) {
- configArgs[configArgIndex++] = i;
- continue;
- }
- // 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;
- found = true;
- }
-
- // look for the user password.
- if (args[i - 1].equalsIgnoreCase(PASSWORD)) {
- password = arg;
- found = true;
- }
-
- // look for the product to run
- // treat -feature as a synonym for -product for compatibility.
- if (args[i - 1].equalsIgnoreCase(PRODUCT) || args[i - 1].equalsIgnoreCase(FEATURE)) {
- // use the long way to set the property to compile against eeminimum
- System.getProperties().setProperty(PROP_PRODUCT, arg);
- found = true;
- }
-
- // look for the application to run.
- if (args[i - 1].equalsIgnoreCase(APPLICATION)) {
- // use the long way to set the property to compile against eeminimum
- System.getProperties().setProperty(PROP_APPLICATION, arg);
- found = true;
- }
-
- // look for the plug-in customization file
- if (args[i - 1].equalsIgnoreCase(PLUGIN_CUSTOMIZATION)) {
- pluginCustomizationFile = arg;
- found = true;
- }
-
- // consume obsolete args for compatibilty
- if (args[i - 1].equalsIgnoreCase(CLASSLOADER_PROPERTIES))
- found = true; // ignore
- if (args[i - 1].equalsIgnoreCase(BOOT))
- found = true; // ignore
-
- // done checking for args. Remember where an arg was found
- if (found) {
- configArgs[configArgIndex++] = i - 1;
- configArgs[configArgIndex++] = i;
- }
- }
-
- // remove all the arguments consumed by this argument parsing
- if (configArgIndex == 0) {
- appArgs = args;
- return args;
- }
- appArgs = new String[args.length - configArgIndex];
- frameworkArgs = new String[configArgIndex];
- configArgIndex = 0;
- int j = 0;
- int k = 0;
- for (int i = 0; i < args.length; i++) {
- if (i == configArgs[configArgIndex]) {
- frameworkArgs[k++] = args[i];
- configArgIndex++;
- } else
- appArgs[j++] = args[i];
- }
- return appArgs;
- }
-
- 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()]);
- }
-
- public void registerBundleGroupProvider(IBundleGroupProvider provider) {
- groupProviders.add(provider);
- }
-
- /**
- * @see Platform#removeLogListener(ILogListener)
- */
- public void removeLogListener(ILogListener listener) {
- assertInitialized();
- synchronized (logListeners) {
- logListeners.remove(listener);
- }
- }
-
- /**
- * @see Platform
- */
- public URL resolve(URL url) throws IOException {
- URL result = asActualURL(url);
- if (!result.getProtocol().startsWith(PlatformURLHandler.BUNDLE))
- return result;
-
- if (urlConverter == null) {
- throw new IOException("url.noaccess"); //$NON-NLS-1$
- }
- result = urlConverter.convertToLocalURL(result);
-
- return result;
- }
-
- public void run(ISafeRunnable code) {
- Assert.isNotNull(code);
- try {
- code.run();
- } catch (Exception e) {
- handleException(code, e);
- } catch (LinkageError e) {
- handleException(code, e);
- }
- }
-
- public void setExtensionRegistry(IExtensionRegistry value) {
- registry = value;
- }
-
- public void setOption(String option, String value) {
- if (options != null)
- options.setOption(option, value);
- }
-
- //Those two methods are 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.
- */
-
- public void start(BundleContext runtimeContext) throws IOException {
- this.context = runtimeContext;
- initializeLocationTrackers();
- ResourceTranslator.start();
- splashHandler = getSplashHandler();
- processCommandLine(infoService.getNonFrameworkArgs());
- debugTracker = new ServiceTracker(context, DebugOptions.class.getName(), null);
- debugTracker.open();
- options = (DebugOptions) debugTracker.getService();
- initializeDebugFlags();
- initialized = true;
- getMetaArea();
- initializeAuthorizationHandler();
- platformLog = new PlatformLogWriter(getFrameworkLog());
- addLogListener(platformLog);
- initializeRuntimeFileManager();
- }
-
- //TODO: what else must be done during the platform shutdown? See #loaderShutdown
- public void stop(BundleContext bundleContext) {
- assertInitialized();
- //shutdown all running jobs
- JobManager.shutdown();
- debugTracker.close();
- ResourceTranslator.stop();
- initialized = false;
- context = null;
- }
-
- /**
- * Takes a preference value and a related resource bundle and
- * returns the translated version of this value (if one exists).
- *
- * TODO: fix these comments
- * @param value the preference value for potential translation
- * @param props the properties containing the translated values
- *
- * @since 2.0
- */
- public String translatePreference(String value, Properties props) {
- value = value.trim();
- if (props == null || value.startsWith(KEY_DOUBLE_PREFIX))
- return value;
- if (value.startsWith(KEY_PREFIX)) {
-
- int ix = value.indexOf(" "); //$NON-NLS-1$
- String key = ix == -1 ? value : value.substring(0, ix);
- String dflt = ix == -1 ? value : value.substring(ix + 1);
- return props.getProperty(key.substring(1), dflt);
- }
- return value;
- }
-
- public void unregisterBundleGroupProvider(IBundleGroupProvider provider) {
- groupProviders.remove(provider);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/ListenerList.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/ListenerList.java
deleted file mode 100644
index 7c13e42..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/ListenerList.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-/**
- * Internal class to maintain a list of listeners. This class is a thread safe
- * list that is optimized for frequent reads and infrequent writes. Copy on write
- * is used to ensure readers can access the list without synchronization overhead.
- * Readers are given access to the underlying array data structure for reading,
- * with the trust that they will not modify the underlying array.
- * <p>
- * N.B.: This class is similar to other ListenerLists available throughout
- * Eclipse code base, except this implementation allows the client to compare
- * listeners using either equality or identity.
- * </p>
- * @since 3.0
- */
-public class ListenerList {
-
- /**
- * The empty array singleton instance.
- */
- private static final Object[] EmptyArray = new Object[0];
- /**
- * Mode constant (value 0) indicating that listeners should be compared
- * using equality.
- */
- public static final int EQUALITY = 0;
- /**
- * Mode constant (value 1) indicating that listeners should be compared
- * using identity.
- */
- public static final int IDENTITY = 1;
-
- /**
- * Indicates the comparison mode used to determine if two
- * listeners are equivalent
- */
- private final int compareMode;
-
- /**
- * The list of listeners. Initially <code>null</code> but initialized
- * to an array of size capacity the first time a listener is added.
- * Maintains invariant: listeners != null
- */
- private volatile Object[] listeners = EmptyArray;
-
- /**
- * Creates a listener list.
- */
- public ListenerList() {
- this(EQUALITY);
- }
-
- /**
- * Creates a listener list using the provided comparison mode.
- */
- public ListenerList(int mode) {
- this.compareMode = mode;
- }
-
- /**
- * Adds the given listener to this list. Has no effect if an equal
- * listener is already registered.
- *<p>
- * This method is synchronized to protect against multiple threads
- * adding or removing listeners concurrently. This does not block
- * concurrent readers.
- *
- * @param listener the listener to add
- */
- public synchronized void add(Object listener) {
- if (listener == null)
- throw new IllegalArgumentException();
- // check for duplicates
- final int oldSize = listeners.length;
- for (int i = 0; i < oldSize; ++i)
- if (same(listener, listeners[i]))
- return;
- // Thread safety: create new array to avoid affecting concurrent readers
- Object[] newListeners = new Object[oldSize+1];
- System.arraycopy(listeners, 0, newListeners, 0, oldSize);
- newListeners[oldSize] = listener;
- //atomic assignment
- this.listeners = newListeners;
- }
-
- /**
- * Returns an array containing all the registered listeners.
- * The resulting array is unaffected by subsequent adds or removes.
- * If there are no listeners registered, the result is an empty array
- * singleton instance (no garbage is created).
- * Use this method when notifying listeners, so that any modifications
- * to the listener list during the notification will have no effect on
- * the notification itself.
- * <p>
- * Note: callers must not modify the returned array.
- *
- * @return the list of registered listeners
- */
- public Object[] getListeners() {
- return listeners;
- }
-
- /**
- * Returns whether this listener list is empty.
- *
- * @return <code>true</code> if there are no registered listeners, and
- * <code>false</code> otherwise
- */
- public boolean isEmpty() {
- return listeners.length == 0;
- }
-
- /**
- * Removes the given listener from this list. Has no effect if an
- * identical listener was not already registered.
- * <p>
- * This method is synchronized to protect against multiple threads
- * adding or removing listeners concurrently. This does not block
- * concurrent readers.
- *
- * @param listener the listener
- */
- public synchronized void remove(Object listener) {
- if (listener == null)
- throw new IllegalArgumentException();
- int oldSize = listeners.length;
- for (int i = 0; i < oldSize; ++i) {
- if (same(listener, listeners[i])) {
- if (oldSize == 1) {
- listeners = EmptyArray;
- } else {
- // Thread safety: create new array to avoid affecting concurrent readers
- Object[] newListeners = new Object[oldSize-1];
- System.arraycopy(listeners, 0, newListeners, 0, i);
- System.arraycopy(listeners, i+1, newListeners, i, oldSize-i-1);
- //atomic assignment to field
- this.listeners = newListeners;
- }
- return;
- }
- }
- }
-
- /**
- * Returns <code>true</code> if the two listeners are the
- * same based on the specified comparison mode, and <code>false</code>
- * otherwise.
- */
- private boolean same(Object listener1, Object listener2) {
- return compareMode == IDENTITY ? listener1 == listener2 : listener1.equals(listener2);
- }
-
- /**
- * Returns the number of registered listeners.
- *
- * @return the number of registered listeners
- */
- public int size() {
- return listeners.length;
- }
-}
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 5b487da..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Log.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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
- }
- };
- InternalPlatform.getDefault().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 8fbb999..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Messages.java
+++ /dev/null
@@ -1,190 +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.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$
-
- // Adapter manager
- public static String adapters_badAdapterFactory;
-
- // application
- public static String application_invalidExtension;
- public static String application_noIdFound;
- public static String application_notFound;
- public static String application_returned;
-
- // 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;
-
- // Job Manager and Locks
- public static String jobs_blocked0;
- public static String jobs_blocked1;
- public static String jobs_internalError;
- public static String jobs_waitFamSub;
-
- // 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_authFormatChanged;
- public static String meta_couldNotCreate;
- public static String meta_exceptionParsingLog;
- public static String meta_instanceDataUnspecified;
- public static String meta_keyringFileAlreadySpecified;
- public static String meta_noDataModeSpecified;
- public static String meta_notDir;
- public static String meta_pluginProblems;
- public static String meta_readonly;
- public static String meta_regCacheIOExceptionReading;
- public static String meta_registryCacheInconsistent;
- public static String meta_registryCacheReadProblems;
-
- // Extension Registry
- public static String meta_registryCacheWriteProblems;
- public static String meta_unableToCreateCache;
- public static String meta_unableToReadAuthorization;
- public static String meta_unableToReadCache;
- public static String meta_unableToWriteAuthorization;
-
- public static String ok;
-
- // parsing/resolve
- public static String parse_nonSingleton;
- public static String parse_badPrereqOnFrag;
- public static String parse_doubleSeparatorVersion;
- public static String parse_duplicateFragment;
- public static String parse_duplicateLib;
- public static String parse_duplicatePlugin;
- public static String parse_emptyPluginVersion;
- public static String parse_error;
- public static String parse_errorNameLineColumn;
- public static String parse_errorProcessing;
- public static String parse_extPointDisabled;
- public static String parse_extPointUnknown;
- public static String parse_failedParsingManifest;
- public static String parse_fourElementPluginVersion;
- public static String parse_fragmentMissingAttr;
- public static String parse_fragmentMissingIdName;
- public static String parse_internalStack;
- public static String parse_missingAttribute;
- public static String parse_missingAttributeLine;
- public static String parse_missingFPName;
- public static String parse_missingFPVersion;
- public static String parse_missingFragmentPd;
- public static String parse_missingPluginId;
- public static String parse_missingPluginName;
- public static String parse_missingPluginVersion;
- public static String parse_nullFragmentIdentifier;
- public static String parse_nullPluginIdentifier;
- public static String parse_numericMajorComponent;
- public static String parse_numericMinorComponent;
- public static String parse_numericServiceComponent;
- public static String parse_oneElementPluginVersion;
- public static String parse_pluginMissingAttr;
- public static String parse_pluginMissingIdName;
-
- public static String parse_postiveMajor;
- public static String parse_postiveMinor;
- public static String parse_postiveService;
- public static String parse_prereqDisabled;
- public static String parse_prereqLoop;
- public static String parse_prereqOptLoop;
- public static String parse_problems;
- public static String parse_separatorEndVersion;
- public static String parse_separatorStartVersion;
- public static String parse_unknownAttribute;
- public static String parse_unknownAttributeLine;
- public static String parse_unknownElement;
- public static String parse_unknownElementLine;
- public static String parse_unknownEntry;
- public static String parse_unknownLibraryType;
- public static String parse_unknownTopElement;
- public static String parse_unsatisfiedOptPrereq;
- public static String parse_unsatisfiedPrereq;
- public static String parse_validExport;
- public static String parse_validMatch;
- public static String parse_xmlParserNotAvailable;
- public static String plugin_deactivatedLoad;
-
- // plugins
- public static String plugin_eventListenerError;
- public static String plugin_extDefNoClass;
- public static String plugin_extDefNotFound;
- public static String plugin_initObjectError;
- public static String plugin_instantiateClassError;
- public static String plugin_loadClassError;
- public static String plugin_notPluginClass;
- public static String plugin_pluginDisabled;
- public static String plugin_shutdownProblems;
- public static String plugin_startupProblems;
- public static String plugin_unableToResolve;
-
- // Preferences
- public static String preferences_applyProblems;
- public static String preferences_classCastScope;
- public static String preferences_classCastListener;
- public static String preferences_classCastFilterEntry;
- public static String preferences_errorWriting;
- public static String preferences_exportProblems;
- public static String preferences_failedDelete;
- public static String preferences_fileNotFound;
- public static String preferences_importProblems;
- public static String preferences_incompatible;
- public static String preferences_invalidExtensionSuperclass;
- public static String preferences_invalidFileFormat;
- public static String preferences_loadException;
- public static String preferences_matching;
- public static String preferences_missingClassAttribute;
- public static String preferences_missingScopeAttribute;
- public static String preferences_removedNode;
- public static String preferences_saveException;
- public static String preferences_saveProblems;
- public static String preferences_validate;
- public static String preferences_validationException;
-
- // Product
- public static String product_notFound;
- public static String provider_invalid;
- public static String provider_invalid_general;
-
- // URL
- public static String url_badVariant;
- public static String url_createConnection;
- public static String url_invalidURL;
- public static String url_noaccess;
- public static String url_noOutput;
- public static String url_resolveFragment;
- public static String url_resolvePlugin;
-
- 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/ObjectMap.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/ObjectMap.java
deleted file mode 100644
index 57c9abc..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/ObjectMap.java
+++ /dev/null
@@ -1,330 +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.runtime;
-
-import java.util.*;
-import org.eclipse.core.internal.preferences.StringPool;
-
-/**
- * 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.
- */
- public ObjectMap() {
- this(DEFAULT_SIZE);
- }
-
- /**
- * Creates a new object map.
- *
- * @param initialCapacity
- * The initial number of elements that will fit in the map.
- */
- public ObjectMap(int initialCapacity) {
- 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 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.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 4283d5a..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PerformanceStatsProcessor.java
+++ /dev/null
@@ -1,218 +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.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 ListenerList listeners = new 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 7ff458c..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformActivator.java
+++ /dev/null
@@ -1,246 +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
- * Julian Chen - fix for bug #92572, jclRM
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-import java.io.IOException;
-import java.util.Hashtable;
-import org.eclipse.core.internal.boot.PlatformURLBaseConnection;
-import org.eclipse.core.internal.boot.PlatformURLHandler;
-import org.eclipse.core.internal.content.ContentTypeManager;
-import org.eclipse.core.internal.registry.ExtensionRegistry;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.framework.log.FrameworkLog;
-import org.eclipse.osgi.service.environment.EnvironmentInfo;
-import org.eclipse.osgi.service.runnable.ParameterizedRunnable;
-import org.eclipse.osgi.service.urlconversion.URLConverter;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.*;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.osgi.service.url.URLConstants;
-import org.osgi.service.url.URLStreamHandlerService;
-
-/**
- * Activator for the Eclipse runtime.
- */
-public class PlatformActivator extends Plugin implements BundleActivator {
- private static final String PROP_ECLIPSE_EXITCODE = "eclipse.exitcode"; //$NON-NLS-1$
- private static final String PROP_ECLIPSE_APPLICATION = "eclipse.application"; //$NON-NLS-1$
- private static final String NL_SYSTEM_BUNDLE = "org.eclipse.osgi.nl"; //$NON-NLS-1$
- private static final String NL_PROP_EXT = ".properties"; //$NON-NLS-1$
-
- private static BundleContext context;
- private ServiceReference environmentServiceReference;
- private ServiceReference urlServiceReference;
- private ServiceReference logServiceReference;
- private ServiceReference packageAdminReference;
- private ServiceRegistration entryLocatorRegistration;
-
- public static BundleContext getContext() {
- return context;
- }
-
- public void start(BundleContext runtimeContext) throws Exception {
- PlatformActivator.context = runtimeContext;
- acquireInfoService();
- acquireURLConverterService();
- acquireFrameworkLogService();
- acquirePackageAdminService();
- startInternalPlatform();
- startRegistry(runtimeContext);
- // the content type manager must be initialized only after the registry has been created
- ContentTypeManager.startup();
- installPlatformURLSupport();
- registerApplicationService();
- InternalPlatform.getDefault().setRuntimeInstance(this);
- super.start(runtimeContext);
- }
-
- /**
- * Register the platform URL support as a service to the URLHandler service
- */
- private void installPlatformURLSupport() {
- PlatformURLPluginConnection.startup();
- PlatformURLFragmentConnection.startup();
- PlatformURLMetaConnection.startup();
- PlatformURLConfigConnection.startup();
-
- PlatformURLBaseConnection.startup(InternalPlatform.getDefault().getInstallURL());
-
- Hashtable properties = new Hashtable(1);
- properties.put(URLConstants.URL_HANDLER_PROTOCOL, new String[] {PlatformURLHandler.PROTOCOL});
- context.registerService(URLStreamHandlerService.class.getName(), new PlatformURLHandler(), properties);
- }
-
- private void startRegistry(BundleContext runtimeContext) {
- InternalPlatform.getDefault().setExtensionRegistry(new ExtensionRegistry());
- }
-
- public void stop(BundleContext runtimeContext) {
- // stop the content type manager
- ContentTypeManager.shutdown();
- // Stop the registry
- stopRegistry(runtimeContext);
- // unregister the EntryLocator to prevent the Framework from calling it
- unregisterEntryLocator();
- environmentInfoServiceReleased(environmentServiceReference);
- urlServiceReleased(urlServiceReference);
- logServiceReleased(logServiceReference);
- packageAdminServiceReleased(packageAdminReference);
- // Stop the platform orderly.
- InternalPlatform.getDefault().stop(runtimeContext);
- InternalPlatform.getDefault().setRuntimeInstance(null);
- InternalPlatform.getDefault().getRuntimeFileManager().close();
- }
-
- private void stopRegistry(BundleContext runtimeContext) {
- ExtensionRegistry registry = (ExtensionRegistry) InternalPlatform.getDefault().getRegistry();
- if (registry == null)
- return;
- registry.stop();
- InternalPlatform.getDefault().setExtensionRegistry(null);
- }
-
- private void acquireInfoService() throws Exception {
- environmentServiceReference = context.getServiceReference(EnvironmentInfo.class.getName());
- if (environmentServiceReference == null)
- return;
- InternalPlatform.infoService = (EnvironmentInfo) context.getService(environmentServiceReference);
- }
-
- private void acquireURLConverterService() throws Exception {
- urlServiceReference = context.getServiceReference(URLConverter.class.getName());
- if (urlServiceReference == null)
- return;
- InternalPlatform.urlConverter = (URLConverter) context.getService(urlServiceReference);
- }
-
- private void acquireFrameworkLogService() throws Exception {
- logServiceReference = context.getServiceReference(FrameworkLog.class.getName());
- if (logServiceReference == null)
- return;
- InternalPlatform.frameworkLog = (FrameworkLog) context.getService(logServiceReference);
- }
-
- private void acquirePackageAdminService() throws Exception {
- packageAdminReference = context.getServiceReference(PackageAdmin.class.getName());
- if (packageAdminReference == null)
- return;
- InternalPlatform.packageAdmin = (PackageAdmin) context.getService(packageAdminReference);
- }
-
- private void startInternalPlatform() throws IOException {
- InternalPlatform.getDefault().start(context);
- }
-
- private void environmentInfoServiceReleased(ServiceReference reference) {
- if (environmentServiceReference == null)
- return;
- if (environmentServiceReference != reference)
- return;
-
- InternalPlatform.infoService = null;
- context.ungetService(environmentServiceReference);
- environmentServiceReference = null;
- }
-
- private void urlServiceReleased(ServiceReference reference) {
- if (urlServiceReference == null)
- return;
- if (urlServiceReference != reference)
- return;
-
- InternalPlatform.urlConverter = null;
- context.ungetService(urlServiceReference);
- urlServiceReference = null;
- }
-
- private void logServiceReleased(ServiceReference reference) {
- if (logServiceReference == null)
- return;
- if (logServiceReference != reference)
- return;
-
- InternalPlatform.frameworkLog = null;
- context.ungetService(logServiceReference);
- logServiceReference = null;
- }
-
- private void packageAdminServiceReleased(ServiceReference reference) {
- if (packageAdminReference == null)
- return;
- if (packageAdminReference != reference)
- return;
-
- InternalPlatform.packageAdmin = null;
- context.ungetService(packageAdminReference);
- packageAdminReference = null;
- }
-
- private void registerApplicationService() {
- ParameterizedRunnable work = new ParameterizedRunnable() {
- public Object run(Object arg) throws Exception {
- IPlatformRunnable application = null;
- String applicationId = System.getProperty(PROP_ECLIPSE_APPLICATION);
- if (applicationId == null) {
- //Derive the application from the product information
- IProduct product = InternalPlatform.getDefault().getProduct();
- if (product != null) {
- applicationId = product.getApplication();
- if (applicationId != null)
- // use the long way to set the property to compile against eeminimum
- System.getProperties().setProperty(PROP_ECLIPSE_APPLICATION, applicationId);
- }
- }
- if (applicationId == null)
- throw new RuntimeException(Messages.application_noIdFound);
- IExtensionRegistry registry = InternalPlatform.getDefault().getRegistry();
- IExtension applicationExtension = registry.getExtension(Platform.PI_RUNTIME, Platform.PT_APPLICATIONS, applicationId);
- if (applicationExtension == null) {
- IExtension[] availableApps = registry.getExtensionPoint(Platform.PI_RUNTIME + '.' + Platform.PT_APPLICATIONS).getExtensions();
- String availableAppsString = "<NONE>"; //$NON-NLS-1$
- if (availableApps.length != 0) {
- availableAppsString = availableApps[0].getUniqueIdentifier();
- for (int i = 1; i < availableApps.length; i++) {
- availableAppsString = availableAppsString + ", " + availableApps[i].getUniqueIdentifier(); //$NON-NLS-1$
- }
- }
- throw new RuntimeException(NLS.bind(Messages.application_notFound, applicationId, availableAppsString));
- }
- IConfigurationElement[] configs = applicationExtension.getConfigurationElements();
- if (configs.length == 0)
- throw new RuntimeException(NLS.bind(Messages.application_invalidExtension, applicationId));
- IConfigurationElement config = configs[0];
- application = (IPlatformRunnable) config.createExecutableExtension("run"); //$NON-NLS-1$
- // if the given arg is null the pass in the left over command line args.
- if (arg == null)
- arg = InternalPlatform.getDefault().getApplicationArgs();
- Object result = application.run(arg);
- int exitCode = result instanceof Integer ? ((Integer) result).intValue() : 0;
- // use the long way to set the property to compile against eeminimum
- System.getProperties().setProperty(PROP_ECLIPSE_EXITCODE, Integer.toString(exitCode));
- if (InternalPlatform.DEBUG)
- System.out.println(NLS.bind(Messages.application_returned, (new String[] {applicationId, result == null ? "null" : result.toString()}))); //$NON-NLS-1$
- return result;
- }
- };
- Hashtable properties = new Hashtable(1);
- properties.put(PROP_ECLIPSE_APPLICATION, "default"); //$NON-NLS-1$
- context.registerService(ParameterizedRunnable.class.getName(), work, properties);
- }
-
- 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 95e9831..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformLogWriter.java
+++ /dev/null
@@ -1,66 +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.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) {
- StringBuffer entry = new StringBuffer();
- entry.append(status.getPlugin()).append(" "); //$NON-NLS-1$
- entry.append(Integer.toString(status.getSeverity())).append(" "); //$NON-NLS-1$
- entry.append(Integer.toString(status.getCode()));
- 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(entry.toString(), status.getMessage(), stackCode, t, children);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformURLConfigConnection.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformURLConfigConnection.java
deleted file mode 100644
index 143c264..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformURLConfigConnection.java
+++ /dev/null
@@ -1,97 +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.runtime;
-
-import java.io.*;
-import java.net.URL;
-import java.net.UnknownServiceException;
-import org.eclipse.core.internal.boot.PlatformURLConnection;
-import org.eclipse.core.internal.boot.PlatformURLHandler;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osgi.service.datalocation.Location;
-import org.eclipse.osgi.util.NLS;
-
-public class PlatformURLConfigConnection extends PlatformURLConnection {
- private static final String FILE_PROTOCOL = "file"; //$NON-NLS-1$
- private static boolean isRegistered = false;
- public static final String CONFIG = "config"; //$NON-NLS-1$
-
- private boolean parentConfiguration = false;
-
- /**
- * @param url
- */
- public PlatformURLConfigConnection(URL url) {
- super(url);
- }
-
- protected URL resolve() throws IOException {
- String spec = url.getFile().trim();
- if (spec.startsWith("/")) //$NON-NLS-1$
- spec = spec.substring(1);
- if (!spec.startsWith(CONFIG))
- throw new IOException(NLS.bind(Messages.url_badVariant, url.toString()));
- String path = spec.substring(CONFIG.length() + 1);
- // resolution takes parent configuration into account (if it exists)
- Location localConfig = Platform.getConfigurationLocation();
- Location parentConfig = localConfig.getParentLocation();
- // assume we will find the file locally
- URL localURL = new URL(localConfig.getURL(), path);
- if (!FILE_PROTOCOL.equals(localURL.getProtocol()) || parentConfig == null)
- // we only support cascaded file: URLs
- return localURL;
- File localFile = new File(localURL.getPath());
- if (localFile.exists())
- // file exists in local configuration
- return localURL;
- // try to find in the parent configuration
- URL parentURL = new URL(parentConfig.getURL(), path);
- if (FILE_PROTOCOL.equals(parentURL.getProtocol())) {
- // we only support cascaded file: URLs
- File parentFile = new File(parentURL.getPath());
- if (parentFile.exists()) {
- // parent has the location
- parentConfiguration = true;
- return parentURL;
- }
- }
- return localURL;
- }
-
- public static void startup() {
- // register connection type for platform:/config handling
- if (isRegistered)
- return;
- PlatformURLHandler.register(CONFIG, PlatformURLConfigConnection.class);
- isRegistered = true;
- }
-
- /* (non-Javadoc)
- * @see java.net.URLConnection#getOutputStream()
- */
- public OutputStream getOutputStream() throws IOException {
- if (parentConfiguration || Platform.getConfigurationLocation().isReadOnly())
- throw new UnknownServiceException(NLS.bind(Messages.url_noOutput, url));
- //This is not optimal but connection is a private ivar in super.
- URL resolved = getResolvedURL();
- if (resolved != null) {
- String fileString = resolved.getFile();
- if (fileString != null) {
- File file = new File(fileString);
- String parent = file.getParent();
- if (parent != null)
- new File(parent).mkdirs();
- return new FileOutputStream(file);
- }
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformURLFragmentConnection.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformURLFragmentConnection.java
deleted file mode 100644
index 716ad01..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformURLFragmentConnection.java
+++ /dev/null
@@ -1,65 +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.runtime;
-
-/**
- * Platform URL support
- * platform:/fragment/fragmentId/ maps to fragmentDescriptor.getInstallURLInternal()
- */
-
-import java.io.IOException;
-import java.net.URL;
-import org.eclipse.core.internal.boot.PlatformURLConnection;
-import org.eclipse.core.internal.boot.PlatformURLHandler;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.Bundle;
-
-public class PlatformURLFragmentConnection extends PlatformURLConnection {
-
- private Bundle target = null;
- private static boolean isRegistered = false;
- public static final String FRAGMENT = "fragment"; //$NON-NLS-1$
-
- public PlatformURLFragmentConnection(URL url) {
- super(url);
- }
-
- protected boolean allowCaching() {
- return true;
- }
-
- protected URL resolve() throws IOException {
- String spec = url.getFile().trim();
- if (spec.startsWith("/")) //$NON-NLS-1$
- spec = spec.substring(1);
- if (!spec.startsWith(FRAGMENT))
- throw new IOException(NLS.bind(Messages.url_badVariant, url));
- int ix = spec.indexOf("/", FRAGMENT.length() + 1); //$NON-NLS-1$
- String ref = ix == -1 ? spec.substring(FRAGMENT.length() + 1) : spec.substring(FRAGMENT.length() + 1, ix);
- String id = getId(ref);
- target = InternalPlatform.getDefault().getBundle(id);
- if (target == null)
- throw new IOException(NLS.bind(Messages.url_resolveFragment, url));
- URL result = target.getEntry("/"); //$NON-NLS-1$
- if (ix == -1 || (ix + 1) >= spec.length())
- return result;
- else
- return new URL(result, spec.substring(ix + 1));
- }
-
- public static void startup() {
- // register connection type for platform:/fragment handling
- if (isRegistered)
- return;
- PlatformURLHandler.register(FRAGMENT, PlatformURLFragmentConnection.class);
- isRegistered = true;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformURLMetaConnection.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformURLMetaConnection.java
deleted file mode 100644
index c052085..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformURLMetaConnection.java
+++ /dev/null
@@ -1,78 +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.runtime;
-
-import java.io.*;
-import java.net.URL;
-import org.eclipse.core.internal.boot.PlatformURLConnection;
-import org.eclipse.core.internal.boot.PlatformURLHandler;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.Bundle;
-
-public class PlatformURLMetaConnection extends PlatformURLConnection {
- private Bundle target = null;
- private static boolean isRegistered = false;
- public static final String META = "meta"; //$NON-NLS-1$
-
- /**
- * @param url
- */
- public PlatformURLMetaConnection(URL url) {
- super(url);
- }
-
- protected URL resolve() throws IOException {
- String spec = url.getFile().trim();
- if (spec.startsWith("/")) //$NON-NLS-1$
- spec = spec.substring(1);
- if (!spec.startsWith(META))
- throw new IOException(NLS.bind(Messages.url_badVariant, url.toString()));
- int ix = spec.indexOf("/", META.length() + 1); //$NON-NLS-1$
- String ref = ix == -1 ? spec.substring(META.length() + 1) : spec.substring(META.length() + 1, ix);
- String id = getId(ref);
- target = InternalPlatform.getDefault().getBundle(id);
- if (target == null)
- throw new IOException(NLS.bind(Messages.url_resolvePlugin, url.toString()));
- IPath path = Platform.getStateLocation(target);
- if (ix != -1 || (ix + 1) <= spec.length())
- path = path.append(spec.substring(ix + 1));
- return path.toFile().toURL();
- }
-
- public static void startup() {
- // register connection type for platform:/meta handling
- if (isRegistered)
- return;
- PlatformURLHandler.register(META, PlatformURLMetaConnection.class);
- isRegistered = true;
- }
-
- /* (non-Javadoc)
- * @see java.net.URLConnection#getOutputStream()
- */
- public OutputStream getOutputStream() throws IOException {
- //This is not optimal but connection is a private ivar in super.
- URL resolved = getResolvedURL();
- if (resolved != null) {
- String fileString = resolved.getFile();
- if (fileString != null) {
- File file = new File(fileString);
- String parent = file.getParent();
- if (parent != null)
- new File(parent).mkdirs();
- return new FileOutputStream(file);
- }
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformURLPluginConnection.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformURLPluginConnection.java
deleted file mode 100644
index 2c4c42b..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformURLPluginConnection.java
+++ /dev/null
@@ -1,92 +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.runtime;
-
-/**
- * Platform URL support
- * platform:/plugin/pluginId/ maps to pluginDescriptor.getInstallURLInternal()
- */
-
-import java.io.IOException;
-import java.net.URL;
-import org.eclipse.core.internal.boot.PlatformURLConnection;
-import org.eclipse.core.internal.boot.PlatformURLHandler;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.Bundle;
-
-public class PlatformURLPluginConnection extends PlatformURLConnection {
-
- private Bundle target = null;
- private static boolean isRegistered = false;
- public static final String PLUGIN = "plugin"; //$NON-NLS-1$
-
- public PlatformURLPluginConnection(URL url) {
- super(url);
- }
-
- protected boolean allowCaching() {
- return true;
- }
-
- protected URL resolve() throws IOException {
- String spec = url.getFile().trim();
- if (spec.startsWith("/")) //$NON-NLS-1$
- spec = spec.substring(1);
- if (!spec.startsWith(PLUGIN))
- throw new IOException(NLS.bind(Messages.url_badVariant, url));
- int ix = spec.indexOf("/", PLUGIN.length() + 1); //$NON-NLS-1$
- String ref = ix == -1 ? spec.substring(PLUGIN.length() + 1) : spec.substring(PLUGIN.length() + 1, ix);
- String id = getId(ref);
- target = InternalPlatform.getDefault().getBundle(id);
- if (target == null)
- throw new IOException(NLS.bind(Messages.url_resolvePlugin, url));
- if (ix == -1 || (ix + 1) >= spec.length())
- return target.getEntry("/"); //$NON-NLS-1$
- URL result = target.getEntry(spec.substring(ix + 1));
- if (result != null)
- return result;
- // if the result is null then force the creation of a URL that will throw FileNotFoundExceptions
- return new URL(target.getEntry("/"), spec.substring(ix + 1)); //$NON-NLS-1$
-
- }
-
- public static void startup() {
- // register connection type for platform:/plugin handling
- if (isRegistered)
- return;
- PlatformURLHandler.register(PLUGIN, PlatformURLPluginConnection.class);
- isRegistered = true;
- }
-
- public URL[] getAuxillaryURLs() throws IOException {
- if (target == null) {
- String spec = url.getFile().trim();
- if (spec.startsWith("/")) //$NON-NLS-1$
- spec = spec.substring(1);
- if (!spec.startsWith(PLUGIN))
- throw new IOException(NLS.bind(Messages.url_badVariant, url));
- int ix = spec.indexOf("/", PLUGIN.length() + 1); //$NON-NLS-1$
- String ref = ix == -1 ? spec.substring(PLUGIN.length() + 1) : spec.substring(PLUGIN.length() + 1, ix);
- String id = getId(ref);
- target = InternalPlatform.getDefault().getBundle(id);
- if (target == null)
- throw new IOException(NLS.bind(Messages.url_resolvePlugin, url));
- }
- Bundle[] fragments = InternalPlatform.getDefault().getFragments(target);
- int fragmentLength = (fragments == null) ? 0 : fragments.length;
- if (fragmentLength == 0)
- return null;
- URL[] result = new URL[fragmentLength];
- for (int i = 0; i < fragmentLength; i++)
- result[i] = fragments[i].getEntry("/"); //$NON-NLS-1$
- return result;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Policy.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Policy.java
deleted file mode 100644
index e30a52f..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Policy.java
+++ /dev/null
@@ -1,53 +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.runtime;
-
-import java.util.Date;
-import org.eclipse.core.runtime.*;
-
-public class Policy {
-
- 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.
- * Pre-pend the message with the current date and the name of the current thread.
- */
- public static void debug(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());
- }
-}
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 019a8e2..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Product.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-import java.util.HashMap;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IProduct;
-import org.osgi.framework.Bundle;
-
-public class Product implements IProduct {
- private static final String ATTR_DESCRIPTION = "description"; //$NON-NLS-1$
- private static final String ATTR_NAME = "name"; //$NON-NLS-1$
- private static final String ATTR_APPLICATION = "application"; //$NON-NLS-1$
- private static final String ATTR_VALUE = "value"; //$NON-NLS-1$
-
- String application = null;
- String name = null;
- String id = null;
- String description = null;
- HashMap properties;
- Bundle definingBundle = null;
-
- public Product(String id, IConfigurationElement element) {
- this.id = id;
- if (element == null)
- return;
- application = element.getAttribute(ATTR_APPLICATION);
- name = element.getAttribute(ATTR_NAME);
- description = element.getAttribute(ATTR_DESCRIPTION);
- loadProperties(element);
- }
-
- private void loadProperties(IConfigurationElement element) {
- IConfigurationElement[] children = element.getChildren();
- properties = new HashMap(children.length);
- for (int i = 0; i < children.length; i++) {
- IConfigurationElement child = children[i];
- String key = child.getAttribute(ATTR_NAME);
- String value = child.getAttribute(ATTR_VALUE);
- if (key != null && value != null)
- properties.put(key, value);
- }
- definingBundle = Platform.getBundle(element.getNamespace());
- }
-
- public Bundle getDefiningBundle() {
- return definingBundle;
- }
-
- public String getApplication() {
- return application;
- }
-
- public String getName() {
- return name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getId() {
- return id;
- }
-
- public String getProperty(String key) {
- return (String) properties.get(key);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/ResourceTranslator.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/ResourceTranslator.java
deleted file mode 100644
index fe2b1f3..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/ResourceTranslator.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.*;
-import org.eclipse.osgi.service.localization.BundleLocalization;
-import org.eclipse.osgi.util.ManifestElement;
-import org.osgi.framework.*;
-
-public class ResourceTranslator {
- private static final String KEY_PREFIX = "%"; //$NON-NLS-1$
- private static final String KEY_DOUBLE_PREFIX = "%%"; //$NON-NLS-1$
- private static ServiceReference localizationServiceReference;
- private static BundleLocalization localizationService;
-
- public static String getResourceString(Bundle bundle, String value) {
- return getResourceString(bundle, value, null);
- }
-
- public static String getResourceString(Bundle bundle, String value, ResourceBundle resourceBundle) {
- String s = value.trim();
- if (!s.startsWith(KEY_PREFIX, 0))
- return s;
- if (s.startsWith(KEY_DOUBLE_PREFIX, 0))
- return s.substring(1);
-
- int ix = s.indexOf(' ');
- String key = ix == -1 ? s : s.substring(0, ix);
- String dflt = ix == -1 ? s : s.substring(ix + 1);
-
- if (resourceBundle == null && bundle != null) {
- try {
- resourceBundle = getResourceBundle(bundle);
- } catch (MissingResourceException e) {
- // just return the default (dflt)
- }
- }
-
- if (resourceBundle == null)
- return dflt;
-
- try {
- return resourceBundle.getString(key.substring(1));
- } catch (MissingResourceException e) {
- //this will avoid requiring a bundle access on the next lookup
- return dflt;
- }
- }
-
- public static void start() {
- BundleContext context = InternalPlatform.getDefault().getBundleContext();
- localizationServiceReference = InternalPlatform.getDefault().getBundleContext().getServiceReference(BundleLocalization.class.getName());
- if (localizationServiceReference == null)
- return;
- localizationService = (BundleLocalization) context.getService(localizationServiceReference);
- }
-
- public static void stop() {
- if (localizationServiceReference == null)
- return;
- localizationService = null;
- InternalPlatform.getDefault().getBundleContext().ungetService(localizationServiceReference);
- localizationServiceReference = null;
- }
-
- public static ResourceBundle getResourceBundle(Bundle bundle) throws MissingResourceException {
- if (hasRuntime21(bundle))
- return ResourceBundle.getBundle("plugin", Locale.getDefault(), createTempClassloader(bundle)); //$NON-NLS-1$
- return localizationService.getLocalization(bundle, null);
- }
-
- private static boolean hasRuntime21(Bundle b) {
- try {
- ManifestElement[] prereqs = ManifestElement.parseHeader(Constants.REQUIRE_BUNDLE, (String) b.getHeaders("").get(Constants.REQUIRE_BUNDLE)); //$NON-NLS-1$
- if (prereqs == null)
- return false;
- for (int i = 0; i < prereqs.length; i++) {
- if ("2.1".equals(prereqs[i].getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE)) && "org.eclipse.core.runtime".equals(prereqs[i].getValue())) { //$NON-NLS-1$//$NON-NLS-2$
- return true;
- }
- }
- } catch (BundleException e) {
- return false;
- }
- return false;
- }
-
- private static ClassLoader createTempClassloader(Bundle b) {
- ArrayList classpath = new ArrayList();
- addClasspathEntries(b, classpath);
- addBundleRoot(b, classpath);
- addDevEntries(b, classpath);
- addFragments(b, classpath);
- URL[] urls = new URL[classpath.size()];
- return new URLClassLoader((URL[]) classpath.toArray(urls));
- }
-
- private static void addFragments(Bundle host, ArrayList classpath) {
- Bundle[] fragments = InternalPlatform.getDefault().getFragments(host);
- if (fragments == null)
- return;
-
- for (int i = 0; i < fragments.length; i++) {
- addClasspathEntries(fragments[i], classpath);
- addDevEntries(fragments[i], classpath);
- }
- }
-
- private static void addClasspathEntries(Bundle b, ArrayList classpath) {
- ManifestElement[] classpathElements;
- try {
- classpathElements = ManifestElement.parseHeader(Constants.BUNDLE_CLASSPATH, (String) b.getHeaders("").get(Constants.BUNDLE_CLASSPATH)); //$NON-NLS-1$
- if (classpathElements == null)
- return;
- for (int i = 0; i < classpathElements.length; i++) {
- URL classpathEntry = b.getEntry(classpathElements[i].getValue());
- if (classpathEntry != null)
- classpath.add(classpathEntry);
- }
- } catch (BundleException e) {
- //ignore
- }
- }
-
- private static void addBundleRoot(Bundle b, ArrayList classpath) {
- classpath.add(b.getEntry("/")); //$NON-NLS-1$
- }
-
- private static void addDevEntries(Bundle b, ArrayList classpath) {
- if (!DevClassPathHelper.inDevelopmentMode())
- return;
-
- String[] binaryPaths = DevClassPathHelper.getDevClassPath(b.getSymbolicName());
- for (int i = 0; i < binaryPaths.length; i++) {
- URL classpathEntry = b.getEntry(binaryPaths[i]);
- if (classpathEntry != null)
- classpath.add(classpathEntry);
- }
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/URLTool.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/URLTool.java
deleted file mode 100644
index 0cd0212..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/URLTool.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Vector;
-
-/**
- * A utility for manipulating <code>URL</code>s.
- */
-public class URLTool {
-
- /**
- * Returns the given <code>URL</code> with a trailing slash appended to
- * it. If the <code>URL</code> already has a trailing slash the
- * <code>URL</code> is returned unchanged.
- * <table>
- * <caption>Example</caption>
- * <tr>
- * <th>Given URL</th>
- * <th>Returned URL</th>
- * <tr>
- * <td>"http://hostname/folder"</td>
- * <td>"http://hostname/folder/"</td>
- * <tr>
- * <td>"http://hostname/folder/</td>
- * <td>"http://hostname/folder/"</td>
- * </table>
- *
- * @param url a URL
- * @return the given URL with a trailing slash
- */
- public static URL appendTrailingSlash(URL url) {
- String file = url.getFile();
- if (file.endsWith("/")) //$NON-NLS-1$
- return url;
- try {
- return new URL(url.getProtocol(), url.getHost(), url.getPort(), file + "/"); //$NON-NLS-1$
- } catch (MalformedURLException e) {
- Assert.isTrue(false, "internal error"); //$NON-NLS-1$
- }
- return null;
- }
-
- /**
- * Returns the child URL formed by joining the given member with the
- * given parent URL.
- *
- * @return a child URL of the given parent
- */
- public static URL getChild(URL parent, String member) {
- String file = parent.getFile();
- if (!file.endsWith("/")) //$NON-NLS-1$
- file = file + "/"; //$NON-NLS-1$
- try {
- return new URL(parent.getProtocol(), parent.getHost(), parent.getPort(), file + member);
- } catch (MalformedURLException e) {
- Assert.isTrue(false, "internal error"); //$NON-NLS-1$
- }
- return null;
- }
-
- /**
- * Returns all elements in the given URLs path.
- * <table>
- * <caption>Example</caption>
- * <tr>
- * <th>Given URL</th>
- * <th>Element</th>
- * <tr>
- * <td>"http://hostname/"</td>
- * <td>[]</td>
- * <tr>
- * <td>"http://hostname/folder/</td>
- * <td>[folder]</td>
- * <tr>
- * <td>"http://hostname/folder/file</td>
- * <td>[folder, file]</td>
- * </table>
- * @param url a URL
- * @return all elements in the given URLs path
- */
- public static Vector getElements(URL url) {
- Vector result = new Vector(5);
- String lastElement = null;
- while ((lastElement = getLastElement(url)) != null) {
- result.insertElementAt(lastElement, 0);
- url = getParent(url);
- }
- return result;
- }
-
- /**
- * Returns the last element in the given URLs path, or <code>null</code>
- * if the URL is the root.
- * <table>
- * <caption>Example</caption>
- * <tr>
- * <th>Given URL</th>
- * <th>Last Element</th>
- * <tr>
- * <td>"http://hostname/"</td>
- * <td>null</td>
- * <tr>
- * <td>"http://hostname/folder/</td>
- * <td>folder</td>
- * <tr>
- * <td>"http://hostname/folder/file</td>
- * <td>file</td>
- * </table>
- * @param url a URL
- * @return the last element in the given URLs path, or
- * <code>null</code> if the URL is the root
- */
- public static String getLastElement(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;
- }
- boolean isDirectory = file.charAt(len - 1) == '/';
- if (lastSlashIndex == -1) {
- if (isDirectory) {
- return file.substring(0, len - 1);
- } else {
- return file;
- }
- } else {
- if (isDirectory) {
- return file.substring(lastSlashIndex + 1, len - 1);
- } else {
- return file.substring(lastSlashIndex + 1, len);
- }
- }
- }
-
- /**
- * 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;
- }
-
- /**
- * Returns the root URL of the given URL.
- * <table>
- * <caption>Example</caption>
- * <tr>
- * <th>Given URL</th>
- * <th>Root URL</th>
- * <tr>
- * <td>"http://hostname/"</td>
- * <td>"http://hostname/"</td>
- * <tr>
- * <td>"http://hostname/folder/file</td>
- * <td>"http://hostname/"</td>
- * </table>
- *
- * @param urlString a URL
- * @return the root url of the given URL
- * @throws MalformedURLException if the given URL is malformed
- */
- public static URL getRoot(String urlString) throws MalformedURLException {
- return getRoot(new URL(urlString));
- }
-
- /**
- * Returns the root URL of the given URL.
- * <table>
- * <caption>Example</caption>
- * <tr>
- * <th>Given URL</th>
- * <th>Root URL</th>
- * <tr>
- * <td>"http://hostname/"</td>
- * <td>"http://hostname/"</td>
- * <tr>
- * <td>"http://hostname/folder/file</td>
- * <td>"http://hostname/"</td>
- * </table>
- *
- * @param url a URL
- * @return the root URL of the given URL
- */
- public static URL getRoot(URL url) {
- try {
- return new URL(url.getProtocol(), url.getHost(), url.getPort(), "/"); //$NON-NLS-1$
- } catch (MalformedURLException e) {
- Assert.isTrue(false, "internal error"); //$NON-NLS-1$
- }
-
- return null;
- }
-
- /**
- * Returns the given URL with its trailing slash removed. If the URL has
- * no trailing slash, the URL is returned unchanged.
- * <table>
- * <caption>Example</caption>
- * <tr>
- * <th>Given URL</th>
- * <th>Returned URL</th>
- * <tr>
- * <td>"http://hostname/folder"</td>
- * <td>"http://hostname/folder"</td>
- * <tr>
- * <td>"http://hostname/folder/</td>
- * <td>"http://hostname/folder"</td>
- * </table>
- *
- * @param url a URL
- * @return the given URL with its last slash removed
- */
- public static URL removeTrailingSlash(URL url) {
- String file = url.getFile();
-
- if (file.endsWith("/")) { //$NON-NLS-1$
- file = file.substring(0, file.length() - 1);
- try {
- return new URL(url.getProtocol(), url.getHost(), url.getPort(), file);
- } catch (MalformedURLException e) {
- Assert.isTrue(false, e.getMessage());
- }
- } else {
- return url;
- }
-
- return null;
- }
-
- /**
- * Returns a boolean indicating whether the given URLs overlap.
- * <table>
- * <caption>Example</caption>
- * <tr>
- * <th>First URL</th>
- * <th>Second URL</th>
- * <th>Do they overlap</th>
- * <tr>
- * <td>"http://hostname/folder/"</td>
- * <td>"http://hostname/folder/"</td>
- * <td>true</td>
- * <tr>
- * <td>"http://hostname/folder/"</td>
- * <td>"http://hostname/folder/file"</td>
- * <td>true</td>
- * <tr>
- * <td>"http://hostname/folder/file"</td>
- * <td>"http://hostname/folder/"</td>
- * <td>true</td>
- * <tr>
- * <td>"http://hostname/folder1/"</td>
- * <td>"http://hostname/folder2/"</td>
- * <td>false</td>
- * <tr>
- * <td>"http://hostname1/folder/"</td>
- * <td>"http://hostname2/folder/"</td>
- * <td>false</td>
- * </table>
- * @param url1 firt URL
- * @param url2 second URL
- * @return a boolean indicating whether the given URLs overlap
- */
- public static boolean urlsOverlap(URL url1, URL url2) {
- if (!getRoot(url1).equals(getRoot(url2))) {
- return false;
- }
-
- Vector elements1 = URLTool.getElements(url1);
- Vector elements2 = URLTool.getElements(url2);
-
- for (int i = 0; i < elements1.size() && i < elements2.size(); ++i) {
- String element1 = (String) elements1.elementAt(i);
- String element2 = (String) elements2.elementAt(i);
- if (!element1.equals(element2)) {
- return false;
- }
- }
-
- return true;
- }
-}
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 3d8d432..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/messages.properties
+++ /dev/null
@@ -1,174 +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 plugin messages
-
-ok = OK
-
-### Adapter manager
-adapters_badAdapterFactory = Malformed adapter factory extension in plug-in: {0}.
-
-### application
-application_invalidExtension = Invalid (empty) application extension \"{0}\".
-application_noIdFound = No application id has been found.
-application_notFound=Application \"{0}\" could not be found in the registry. The applications available are: {1}.
-application_returned=The application \"{0}\" returned with code: {1}.
-
-### 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.
-
-### 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_appNotInit = The application has not been initialized.
-meta_authFormatChanged = The platform authorization database file format has changed. Cached authorization information will be lost.
-meta_couldNotCreate = Error trying to create the platform metadata area: {0}.
-meta_exceptionParsingLog = An exception occurred while parsing the log file: {0}
-meta_instanceDataUnspecified = The instance data location has not been specified yet.
-meta_keyringFileAlreadySpecified = The keyring file location has already been specified {0}.
-meta_noDataModeSpecified = No instance data can be specified.
-meta_notDir = Specified platform location \"{0}\" is not a directory.
-meta_pluginProblems = Problems occurred when invoking code from plug-in: \"{0}\".
-meta_readonly = The platform metadata area could not be written: {0}. By default the platform writes its content\nunder the current working directory when the platform is launched. Use the -data parameter to\nspecify a different content area for the platform.
-meta_unableToReadAuthorization = Unable to read authorization database: {0}.
-meta_unableToWriteAuthorization = Unable to write to authorization database: {0}.
-
-### Extension Registry
-meta_registryCacheWriteProblems = Trouble writing to the registry cache file.
-meta_registryCacheReadProblems = Trouble reading from the registry cache file.
-meta_regCacheIOExceptionReading = IOException encountered while reading \"{0}\".
-meta_registryCacheInconsistent = Registry cache inconsistent, defaulting to not using cached file.
-meta_unableToCreateCache = Unable to create output stream for registry cache.
-meta_unableToReadCache = Unable to create input stream for registry cache.
-
-### parsing/resolve
-parse_nonSingleton = The extensions and extension-points from the bundle \"{0}\" are ignored. The bundle is not marked as singleton.
-parse_badPrereqOnFrag=Fragment \"{0}\" requires non-existent plug-in \"{1}\". Fragment ignored.
-parse_doubleSeparatorVersion=Plug-in version identifier, \"{0}\", must not contain two consecutive separator characters.
-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_emptyPluginVersion=A plug-in version identifier must be non-empty.
-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_failedParsingManifest=Could not parse plug-in manifest for \"{0}\". Any contributed extensions and extension points will be ignored.
-parse_fourElementPluginVersion=Plug-in version identifier, \"{0}\", can contain a maximum of four components.
-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_missingAttribute=Missing \"{0}\" attribute in \"{1}\" element. Element ignored.
-parse_missingAttributeLine=Missing \"{0}\" attribute in \"{1}\" element (line: {2}). Element ignored.
-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_numericMajorComponent=The major (1st) component of plug-in version identifier, \"{0}\", must be numeric.
-parse_numericMinorComponent=The minor (2nd) component of plug-in version identifier, \"{0}\", must be numeric.
-parse_numericServiceComponent=The service (3rd) component of plug-in version identifier, \"{0}\", must be numeric.
-parse_oneElementPluginVersion=Plug-in version identifier, \"{0}\", must contain at least one component.
-parse_pluginMissingAttr = Plug-in \"{0}\" disabled due to missing attributes.
-parse_pluginMissingIdName = Plug-in disabled due to missing attributes (including name and id).
-parse_postiveMajor=Plug-in version identifier, \"{0}\", must have a positive major (1st) component.
-parse_postiveMinor=Plug-in version identifier, \"{0}\", must have a positive minor (2nd) component.
-parse_postiveService=Plug-in version identifier, \"{0}\", must have a positive service (3rd) component.
-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_problems = Problems parsing plug-in manifest for: \"{0}\".
-parse_separatorEndVersion=Plug-in version identifier, \"{0}\", must not end with a separator character.
-parse_separatorStartVersion=Plug-in version identifier, \"{0}\", must not start with a separator character.
-parse_unknownAttribute = Unknown attribute \"{1}\" for element \"{0}\" ignored.
-parse_unknownAttributeLine= Unknown attribute \"{1}\" for element \"{0}\" ignored (line: {2}).
-parse_unknownElement = Unknown element \"{1}\", found within a \"{0}\", ignored.
-parse_unknownElementLine = Unknown element \"{1}\", found within a \"{0}\", ignored (line: {2}).
-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\".
-parse_xmlParserNotAvailable=Could not acquire XML parsing service.
-
-### plugins
-plugin_deactivatedLoad = Attempt to load class \"{0}\" from de-activated plug-in \"{1}\".
-plugin_eventListenerError = Error notifying registry change listener.
-plugin_extDefNoClass = Executable extension definition \"{0}\" does not specify a class name.
-plugin_extDefNotFound = Executable extension definition for \"{0}\" not found.
-plugin_initObjectError = Plug-in \"{0}\" was unable to execute setInitializationData on an instance of \"{1}\".
-plugin_instantiateClassError = Plug-in \"{0}\" was unable to instantiate class \"{1}\".
-plugin_loadClassError = Plug-in {0} was unable to load class {1}.
-plugin_notPluginClass = Supplied runtime class \"{0}\" does not extend class Plugin.
-plugin_pluginDisabled = Attempt to activate a disabled plug-in: \"{0}\".
-plugin_shutdownProblems = Problems encountered shutting down plug-in: \"{0}\".
-plugin_startupProblems = Problems encountered starting up plug-in: \"{0}\".
-plugin_unableToResolve = Unable to resolve plug-in registry.
-
-### Preferences
-preferences_applyProblems=Problems applying preference changes.
-preferences_classCastScope=Extensions to org.eclipse.core.runtime.preferences extension point must implement the IScope interface.
-preferences_classCastListener=Preference modify listeners must subclass the PreferenceModifyListener class.
-preferences_classCastFilterEntry=Preference filter mappings must be instances of the class PreferenceFilterEntry.
-preferences_errorWriting=Error writing preference file {0}. {1}
-preferences_exportProblems=Problems exporting preferences.
-preferences_failedDelete=Failed to delete preferences file: {0}.
-preferences_fileNotFound=Preference export file not found: {0}.
-preferences_importProblems=Problems importing preferences.
-preferences_incompatible=The preference file contains preferences for version \"{0}\" of plug-in \"{1}\", but version \"{2}\" is currently installed.
-preferences_invalidExtensionSuperclass=Extension does not extend class AbstractPreferenceInitializer.
-preferences_invalidFileFormat=Invalid preference file format.
-preferences_loadException=Exception loading preferences from: {0}.
-preferences_matching=Exception while matching preference filters.
-preferences_missingClassAttribute= Missing \"class\" attribute in \"preference\" element in extension declaration for: {0}.
-preferences_missingScopeAttribute= Missing \"scope\" attribute in \"preference\" element in extension declaration for: {0}.
-preferences_removedNode=Preference node \"{0}\" has been removed.
-preferences_saveException=Exception saving preferences to: {0}.
-preferences_saveProblems=Problems saving preferences.
-preferences_validate=Some preferences may not be compatible with the currently installed plug-ins.
-preferences_validationException=Exception while validating bundle versions.
-
-### 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.
-
-### URL
-url_badVariant=Unsupported \"platform:\" protocol variation \"{0}\".
-url_createConnection=Unable to create connection on \"{0}\".
-url_invalidURL=Invalid URL \"{0}\".
-url_noOutput=Output is not supported for \"{0}\", location is read-only.
-url_noaccess=Unhandled URL protocol \"{0}\".
-url_resolveFragment=Unable to resolve fragment \"{0}\".
-url_resolvePlugin=Unable to resolve plug-in \"{0}\".
-
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/CoreException.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/CoreException.java
deleted file mode 100644
index 9ac5b61..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/CoreException.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-
-/**
- * A checked exception representing a failure.
- * <p>
- * Core exceptions contain a status object describing the
- * cause of the exception.
- * </p>
- *
- * @see IStatus
- */
-public class CoreException extends Exception {
-
- /**
- * All serializable objects should have a stable serialVersionUID
- */
- private static final long serialVersionUID = 1L;
-
- /** Status object. */
- private IStatus status;
-
- /**
- * Creates a new exception with the given status object. The message
- * of the given status is used as the exception message.
- *
- * @param status the status object to be associated with this exception
- */
- public CoreException(IStatus status) {
- super(status.getMessage());
- this.status = status;
- }
-
- /**
- * Returns the status object for this exception.
- *
- * @return a status object
- */
- public final IStatus getStatus() {
- return status;
- }
-
- /**
- * Prints a stack trace out for the exception, and
- * any nested exception that it may have embedded in
- * its Status object.
- */
- public void printStackTrace() {
- printStackTrace(System.err);
- }
-
- /**
- * Prints a stack trace out for the exception, and
- * any nested exception that it may have embedded in
- * its Status object.
- *
- * @param output the stream to write to
- */
- public void printStackTrace(PrintStream output) {
- synchronized (output) {
- if (status.getException() != null) {
- output.print(getClass().getName() + "[" + status.getCode() + "]: "); //$NON-NLS-1$ //$NON-NLS-2$
- status.getException().printStackTrace(output);
- } else
- super.printStackTrace(output);
- }
- }
-
- /**
- * Prints a stack trace out for the exception, and
- * any nested exception that it may have embedded in
- * its Status object.
- *
- * @param output the stream to write to
- */
- public void printStackTrace(PrintWriter output) {
- synchronized (output) {
- if (status.getException() != null) {
- output.print(getClass().getName() + "[" + status.getCode() + "]: "); //$NON-NLS-1$ //$NON-NLS-2$
- status.getException().printStackTrace(output);
- } else
- super.printStackTrace(output);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IAdaptable.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IAdaptable.java
deleted file mode 100644
index a935fad..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IAdaptable.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * An interface for an adaptable object.
- * <p>
- * Adaptable objects can be dynamically extended to provide different
- * interfaces (or "adapters"). Adapters are created by adapter
- * factories, which are in turn managed by type by adapter managers.
- * </p>
- * For example,
- * <pre>
- * IAdaptable a = [some adaptable];
- * IFoo x = (IFoo)a.getAdapter(IFoo.class);
- * if (x != null)
- * [do IFoo things with x]
- * </pre>
- * <p>
- * Clients may implement this interface, or obtain a default implementation
- * of this interface by subclassing <code>PlatformObject</code>.
- * </p>
- * @see IAdapterFactory
- * @see IAdapterManager
- * @see PlatformObject
- */
-public interface IAdaptable {
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found.
- *
- * @param adapter the adapter class to look up
- * @return a object castable to the given class,
- * or <code>null</code> if this object does not
- * have an adapter for the given class
- */
- public Object getAdapter(Class adapter);
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IAdapterFactory.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IAdapterFactory.java
deleted file mode 100644
index 994eaae..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IAdapterFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * An adapter factory defines behavioral extensions for
- * one or more classes that implements the <code>IAdaptable</code>
- * interface. Adapter factories are registered with an
- * adapter manager.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see IAdapterManager
- * @see IAdaptable
- */
-public interface IAdapterFactory {
- /**
- * Returns an object which is an instance of the given class
- * associated with the given object. Returns <code>null</code> if
- * no such object can be found.
- *
- * @param adaptableObject the adaptable object being queried
- * (usually an instance of <code>IAdaptable</code>)
- * @param adapterType the type of adapter to look up
- * @return a object castable to the given adapter type,
- * or <code>null</code> if this adapter factory
- * does not have an adapter of the given type for the
- * given object
- */
- public Object getAdapter(Object adaptableObject, Class adapterType);
-
- /**
- * Returns the collection of adapter types handled by this
- * factory.
- * <p>
- * This method is generally used by an adapter manager
- * to discover which adapter types are supported, in advance
- * of dispatching any actual <code>getAdapter</code> requests.
- * </p>
- *
- * @return the collection of adapter types
- */
- public Class[] getAdapterList();
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IAdapterManager.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IAdapterManager.java
deleted file mode 100644
index 330fe5c..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IAdapterManager.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-
-/**
- * An adapter manager maintains a registry of adapter factories. Clients
- * directly invoke methods on an adapter manager to register and unregister
- * adapters. All adaptable objects (that is, objects that implement the <code>IAdaptable</code>
- * interface) funnel <code>IAdaptable.getAdapter</code> invocations to their
- * adapter manager's <code>IAdapterManger.getAdapter</code> method. The
- * adapter manager then forwards this request unmodified to the <code>IAdapterFactory.getAdapter</code>
- * method on one of the registered adapter factories.
- * <p>
- * Adapter factories can be registered programmatically using the <code>registerAdapters</code>
- * method. Alternatively, they can be registered declaratively using the
- * <code>org.eclipse.core.runtime.adapters</code> extension point. Factories registered
- * with this extension point will not be able to provide adapters until their
- * corresponding plugin has been activated.
- * <p>
- * The following code snippet shows how one might register an adapter of type
- * <code>com.example.acme.Sticky</code> on resources in the workspace.
- * <p>
- *
- * <pre>
- * IAdapterFactory pr = new IAdapterFactory() {
- * public Class[] getAdapterList() {
- * return new Class[] { com.example.acme.Sticky.class };
- * }
- * public Object getAdapter(Object adaptableObject, Class adapterType) {
- * IResource res = (IResource) adaptableObject;
- * QualifiedName key = new QualifiedName("com.example.acme", "sticky-note");
- * try {
- * com.example.acme.Sticky v = (com.example.acme.Sticky) res.getSessionProperty(key);
- * if (v == null) {
- * v = new com.example.acme.Sticky();
- * res.setSessionProperty(key, v);
- * }
- * } catch (CoreException e) {
- * // unable to access session property - ignore
- * }
- * return v;
- * }
- * }
- * Platform.getAdapterManager().registerAdapters(pr, IResource.class);
- * </pre>
- *
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IAdaptable
- * @see IAdapterFactory
- */
-public interface IAdapterManager {
-
- /**
- * Returns the types that can be obtained by converting <code>adaptableClass</code>
- * via this manager. Converting means that subsequent calls to <code>getAdapter()</code>
- * or <code>loadAdapter()</code> could result in an adapted object.
- * <p>
- * Note that the returned types do not guarantee that
- * a subsequent call to <code>getAdapter</code> with the same type as an argument
- * will return a non-null result. If the factory's plug-in has not yet been
- * loaded, or if the factory itself returns <code>null</code>, then
- * <code>getAdapter</code> will still return <code>null</code>.
- * </p>
- * @param adaptableClass the adaptable class being queried
- * @return an array of type names that can be obtained by converting
- * <code>adaptableClass</code> via this manager. An empty array
- * is returned if there are none.
- * @since 3.1
- */
- public String[] computeAdapterTypes(Class adaptableClass);
-
- /**
- * Returns the class search order for a given class. The search order from a
- * class with the definition <br>
- * <code>class X extends Y implements A, B</code><br>
- * is as follows:
- * <ul>
- * <li>the target's class: X
- * <li>X's superclasses in order to <code>Object</code>
- * <li>a breadth-first traversal of the target class's interfaces in the
- * order returned by <code>getInterfaces</code> (in the example, A and its
- * superinterfaces then B and its superinterfaces) </il>
- * </ul>
- *
- * @param clazz the class for which to return the class order.
- * @return the class search order for the given class. The returned
- * search order will minimally contain the target class.
- * @since 3.1
- */
- public Class[] computeClassOrder(Class clazz);
- /**
- * Returns an object which is an instance of the given class associated
- * with the given object. Returns <code>null</code> if no such object can
- * be found.
- * <p>
- * Note that this method will never cause plug-ins to be loaded. If the
- * only suitable factory is not yet loaded, this method will return <code>null</code>.
- *
- * @param adaptable the adaptable object being queried (usually an instance
- * of <code>IAdaptable</code>)
- * @param adapterType the type of adapter to look up
- * @return an object castable to the given adapter type, or <code>null</code>
- * if the given adaptable object does not have an available adapter of the
- * given type
- */
- public Object getAdapter(Object adaptable, Class adapterType);
-
- /**
- * Returns an object which is an instance of the given class name associated
- * with the given object. Returns <code>null</code> if no such object can
- * be found.
- * <p>
- * Note that this method will never cause plug-ins to be loaded. If the
- * only suitable factory is not yet loaded, this method will return <code>null</code>.
- * If activation of the plug-in providing the factory is required, use the
- * <code>loadAdapter</code> method instead.
- *
- * @param adaptable the adaptable object being queried (usually an instance
- * of <code>IAdaptable</code>)
- * @param adapterTypeName the fully qualified name of the type of adapter to look up
- * @return an object castable to the given adapter type, or <code>null</code>
- * if the given adaptable object does not have an available adapter of the
- * given type
- * @since 3.0
- */
- public Object getAdapter(Object adaptable, String adapterTypeName);
-
- /**
- * Returns whether there is an adapter factory registered that may be able
- * to convert <code>adaptable</code> to an object of type <code>adapterTypeName</code>.
- * <p>
- * Note that a return value of <code>true</code> does not guarantee that
- * a subsequent call to <code>getAdapter</code> with the same arguments
- * will return a non-null result. If the factory's plug-in has not yet been
- * loaded, or if the factory itself returns <code>null</code>, then
- * <code>getAdapter</code> will still return <code>null</code>.
- *
- * @param adaptable the adaptable object being queried (usually an instance
- * of <code>IAdaptable</code>)
- * @param adapterTypeName the fully qualified class name of an adapter to
- * look up
- * @return <code>true</code> if there is an adapter factory that claims
- * it can convert <code>adaptable</code> to an object of type <code>adapterType</code>,
- * and <code>false</code> otherwise.
- * @since 3.0
- */
- public boolean hasAdapter(Object adaptable, String adapterTypeName);
-
- /**
- * Returns an object that is an instance of the given class name associated
- * with the given object. Returns <code>null</code> if no such object can
- * be found.
- * <p>
- * Note that unlike the <code>getAdapter</code> methods, this method
- * will cause the plug-in that contributes the adapter factory to be loaded
- * if necessary. As such, this method should be used judiciously, in order
- * to avoid unnecessary plug-in activations. Most clients should avoid
- * activation by using <code>getAdapter</code> instead.
- *
- * @param adaptable the adaptable object being queried (usually an instance
- * of <code>IAdaptable</code>)
- * @param adapterTypeName the fully qualified name of the type of adapter to look up
- * @return an object castable to the given adapter type, or <code>null</code>
- * if the given adaptable object does not have an available adapter of the
- * given type
- * @since 3.0
- */
- public Object loadAdapter(Object adaptable, String adapterTypeName);
-
- /**
- * Registers the given adapter factory as extending objects of the given
- * type.
- * <p>
- * If the type being extended is a class, the given factory's adapters are
- * available on instances of that class and any of its subclasses. If it is
- * an interface, the adapters are available to all classes that directly or
- * indirectly implement that interface.
- * </p>
- *
- * @param factory the adapter factory
- * @param adaptable the type being extended
- * @see #unregisterAdapters(IAdapterFactory)
- * @see #unregisterAdapters(IAdapterFactory, Class)
- */
- public void registerAdapters(IAdapterFactory factory, Class adaptable);
-
- /**
- * Removes the given adapter factory completely from the list of registered
- * factories. Equivalent to calling <code>unregisterAdapters(IAdapterFactory,Class)</code>
- * on all classes against which it had been explicitly registered. Does
- * nothing if the given factory is not currently registered.
- *
- * @param factory the adapter factory to remove
- * @see #registerAdapters(IAdapterFactory, Class)
- */
- public void unregisterAdapters(IAdapterFactory factory);
-
- /**
- * Removes the given adapter factory from the list of factories registered
- * as extending the given class. Does nothing if the given factory and type
- * combination is not registered.
- *
- * @param factory the adapter factory to remove
- * @param adaptable one of the types against which the given factory is
- * registered
- * @see #registerAdapters(IAdapterFactory, Class)
- */
- public void unregisterAdapters(IAdapterFactory factory, Class adaptable);
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IBundleGroup.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IBundleGroup.java
deleted file mode 100644
index b2e06fd..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IBundleGroup.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import org.osgi.framework.Bundle;
-
-/**
- * Bundle groups represent a logical collection of plug-ins (aka bundles). Bundle
- * groups do not contain their constituents but rather collect them together under
- * a common label. The main role of a bundle group is to report to the system
- * (e.g., the About dialog) what bundles have been installed. They are not intended
- * for use in managing the set of bundles they represent.
- * <p>
- * Since the bulk of the branding related information is specific to the consumer,
- * bundle groups also carry an arbitrary set of properties. The valid set of
- * key-value pairs and their interpretation defined by the consumer in the
- * target environment.
- * </p><p>
- * The Eclipse UI is the typical consumer of bundle groups and defines various
- * property keys that it will use, for example, to display About information. See
- * <code>org.eclipse.ui.branding.IBundleGroupConstants</code>.
- * </p>
- * @see IBundleGroupProvider
- * @since 3.0
- */
-public interface IBundleGroup {
-
- /**
- * Returns the identifier of this bundle group. Bundle groups are uniquely identified by the combination of
- * their identifier and their version.
- * @see #getVersion()
- * @return the identifier for this bundle group
- */
- public String getIdentifier();
-
- /**
- * Returns the human-readable name of this bundle group.
- * @return the human-readable name
- */
- public String getName();
-
- /**
- * Returns the version of this bundle group. Bundle group version strings have the same format as
- * bundle versions (i.e., major.minor.service.qualifier). Bundle groups are uniquely identified
- * by the combination of their identifier and their version.
- * @see #getIdentifier()
- * @return the string form of this bundle group's version
- */
- public String getVersion();
-
- /**
- * Returns a text description of this bundle group.
- * @return text description of this bundle group
- */
- public String getDescription();
-
- /**
- * Returns the name of the provider of this bundle group.
- * @return the name of the provider or <code>null</code> if none
- */
- public String getProviderName();
-
- /**
- * Returns a list of all bundles supplied by this bundle group.
- * @return the bundles supplied by this bundle group
- */
- public Bundle[] getBundles();
-
- /**
- * Returns the property of this bundle group 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);
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IBundleGroupProvider.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IBundleGroupProvider.java
deleted file mode 100644
index d8da736..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IBundleGroupProvider.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * Bundle group providers define groups of plug-ins which have been installed in
- * the current system. Typically, a configuration agent (i.e., plug-in installer) will
- * define a bundle group provider so that it can report to the system the list
- * of plug-ins it has installed.
- *
- * @see IBundleGroup
- * @since 3.0
- */
-public interface IBundleGroupProvider {
- /**
- * Returns the human-readable name of this bundle group provider.
- * @return the name of this bundle group provider
- */
- public String getName();
-
- /**
- * Returns the bundle groups provided by this provider.
- * @return the bundle groups provided by this provider
- */
- public IBundleGroup[] getBundleGroups();
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IConfigurationElement.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IConfigurationElement.java
deleted file mode 100644
index b3e278a..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IConfigurationElement.java
+++ /dev/null
@@ -1,293 +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;
-
-/**
- * A configuration element, with its attributes and children,
- * directly reflects the content and structure of the extension section
- * within the declaring plug-in's manifest (<code>plugin.xml</code>) file.
- * <p>
- * This interface also provides a way to create executable extension
- * objects.
- * </p>
- * <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 configuration element 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
- * and configuration element 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 or configuration element 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 IConfigurationElement {
- /**
- * Creates and returns a new instance of the executable extension
- * identified by the named attribute of this configuration element.
- * The named attribute value must contain a fully qualified name
- * of a Java class. The class can either refer to a class implementing
- * the executable extension or to a factory capable of returning the
- * executable extension.
- * <p>
- * The specified class is instantiated using its 0-argument public constructor.
- * <p>
- * Then the following checks are done:<br>
- * If the specified class implements the {@link IExecutableExtension}
- * interface, the method {@link IExecutableExtension#setInitializationData(IConfigurationElement, String, Object)}
- * is called, passing to the object the configuration information that was used to create it.
- * <p>
- * If the specified class implements {@link IExecutableExtensionFactory}
- * interface, the method {@link IExecutableExtensionFactory#create()}
- * is invoked.
- * </p>
- * <p>
- * Unlike other methods on this object, invoking this method may activate
- * the plug-in.
- * </p>
- *
- * @param propertyName the name of the property
- * @return the executable instance
- * @exception CoreException if an instance of the executable extension
- * could not be created for any reason
- * @see IExecutableExtension#setInitializationData(IConfigurationElement, String, Object)
- * @see IExecutableExtensionFactory
- */
- public Object createExecutableExtension(String propertyName) throws CoreException;
-
- /**
- * Returns the named attribute of this configuration element, or
- * <code>null</code> if none.
- * <p>
- * The names of configuration element attributes
- * are the same as the attribute names of the corresponding XML element.
- * For example, the configuration markup
- * <pre>
- * <bg pattern="stripes"/>
- * </pre>
- * corresponds to a configuration element named <code>"bg"</code>
- * with an attribute named <code>"pattern"</code>
- * with attribute value <code>"stripes"</code>.
- * </p>
- * <p> Note that any translation specified in the plug-in manifest
- * file is automatically applied.
- * </p>
- *
- * @param name the name of the attribute
- * @return attribute value, or <code>null</code> if none
- * @throws InvalidRegistryObjectException if this configuration element is no longer valid
- */
- public String getAttribute(String name) throws InvalidRegistryObjectException;
-
- /**
- * Returns the named attribute of this configuration element, or
- * <code>null</code> if none.
- * <p>
- * The names of configuration element attributes
- * are the same as the attribute names of the corresponding XML element.
- * For example, the configuration markup
- * <pre>
- * <bg pattern="stripes"/>
- * </pre>
- * corresponds to a configuration element named <code>"bg"</code>
- * with an attribute named <code>"pattern"</code>
- * with attribute value <code>"stripes"</code>.
- * </p>
- * <p>
- * Note that any translation specified in the plug-in manifest
- * file for this attribute is <b>not</b> automatically applied.
- * </p>
- *
- * @param name the name of the attribute
- * @return attribute value, or <code>null</code> if none
- * @throws InvalidRegistryObjectException if this configuration element is no longer valid
- */
- public String getAttributeAsIs(String name) throws InvalidRegistryObjectException;
-
- /**
- * Returns the names of the attributes of this configuration element.
- * Returns an empty array if this configuration element has no attributes.
- * <p>
- * The names of configuration element attributes
- * are the same as the attribute names of the corresponding XML element.
- * For example, the configuration markup
- * <pre>
- * <bg color="blue" pattern="stripes"/>
- * </pre>
- * corresponds to a configuration element named <code>"bg"</code>
- * with attributes named <code>"color"</code>
- * and <code>"pattern"</code>.
- * </p>
- *
- * @return the names of the attributes
- * @throws InvalidRegistryObjectException if this configuration element is no longer valid
- */
- public String[] getAttributeNames() throws InvalidRegistryObjectException;
-
- /**
- * Returns all configuration elements that are children of this
- * configuration element.
- * Returns an empty array if this configuration element has no children.
- * <p>
- * Each child corresponds to a nested
- * XML element in the configuration markup.
- * For example, the configuration markup
- * <pre>
- * <view>
- *     <verticalHint>top</verticalHint>
- *     <horizontalHint>left</horizontalHint>
- * </view>
- * </pre>
- * corresponds to a configuration element, named <code>"view"</code>,
- * with two children.
- * </p>
- *
- * @return the child configuration elements
- * @throws InvalidRegistryObjectException if this configuration element is no longer valid
- * @see #getChildren(String)
- */
- public IConfigurationElement[] getChildren() throws InvalidRegistryObjectException;
-
- /**
- * Returns all child configuration elements with the given name.
- * Returns an empty array if this configuration element has no children
- * with the given name.
- *
- * @param name the name of the child configuration element
- * @return the child configuration elements with that name
- * @throws InvalidRegistryObjectException if this configuration element is no longer valid
- * @see #getChildren()
- */
- public IConfigurationElement[] getChildren(String name) throws InvalidRegistryObjectException;
-
- /**
- * Returns the extension that declares this configuration element.
- *
- * @return the extension
- * @throws InvalidRegistryObjectException if this configuration element is no longer valid
- */
- public IExtension getDeclaringExtension() throws InvalidRegistryObjectException;
-
- /**
- * Returns the name of this configuration element.
- * The name of a configuration element is the same as
- * the XML tag of the corresponding XML element.
- * For example, the configuration markup
- * <pre>
- * <wizard name="Create Project"/>
- * </pre>
- * corresponds to a configuration element named <code>"wizard"</code>.
- *
- * @return the name of this configuration element
- * @throws InvalidRegistryObjectException if this configuration element is no longer valid
- */
- public String getName() throws InvalidRegistryObjectException;
-
- /**
- * 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>IExtension</code>.
- * Otherwise the returned value can be downcast to
- * <code>IConfigurationElement</code>.
- *
- * @return the parent of this configuration element
- * or <code>null</code>
- * @throws InvalidRegistryObjectException if this configuration element is no longer valid
- * @since 3.0
- */
- public Object getParent() throws InvalidRegistryObjectException;
-
- /**
- * Returns the text value of this configuration element.
- * For example, the configuration markup
- * <pre>
- * <script lang="javascript">.\scripts\cp.js</script>
- * </pre>
- * corresponds to a configuration element <code>"script"</code>
- * with value <code>".\scripts\cp.js"</code>.
- * <p> Values may span multiple lines (i.e., contain carriage returns
- * and/or line feeds).
- * <p> Note that any translation specified in the plug-in manifest
- * file is automatically applied.
- * </p>
- *
- * @return the text value of this configuration element or <code>null</code>
- * @throws InvalidRegistryObjectException if this configuration element is no longer valid
- */
- public String getValue() throws InvalidRegistryObjectException;
-
- /**
- * Returns the untranslated text value of this configuration element.
- * For example, the configuration markup
- * <pre>
- * <script lang="javascript">.\scripts\cp.js</script>
- * </pre>
- * corresponds to a configuration element <code>"script"</code>
- * with value <code>".\scripts\cp.js"</code>.
- * <p> Values may span multiple lines (i.e., contain carriage returns
- * and/or line feeds).
- * <p>
- * Note that translation specified in the plug-in manifest
- * file is <b>not</b> automatically applied.
- * For example, the configuration markup
- * <pre>
- * <tooltip>#hattip</tooltip>
- * </pre>
- * corresponds to a configuration element, named <code>"tooltip"</code>,
- * with value <code>"#hattip"</code>.
- * </p>
- *
- * @return the untranslated text value of this configuration element or <code>null</code>
- * @throws InvalidRegistryObjectException if this configuration element is no longer valid
- */
- public String getValueAsIs() throws InvalidRegistryObjectException;
-
- /**
- * Returns the namespace for this configuration element. This value can be used
- * in various global facilities to discover this configuration element's provider.
- * <p>
- *
- * @return the namespace for this configuration element
- * @throws InvalidRegistryObjectException if this configuration element is no longer valid
- * @see Platform#getBundle(String)
- * @see IExtensionRegistry
- * @since 3.1
- */
- public String getNamespace() throws InvalidRegistryObjectException;
-
- /* (non-javadoc)
- * @see Object#equals(java.lang.Object)
- */
- public boolean equals(Object o);
-
- /**
- * Returns whether this configuration element 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();
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExecutableExtension.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExecutableExtension.java
deleted file mode 100644
index cbffd4e..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExecutableExtension.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * Interface for executable extension classes that require access to
- * their configuration element, or implement an extension adapter.
- * <p>
- * Extension adapters are typically required in cases where the extension
- * implementation does not follow the interface rules specified
- * by the provider of the extension point. In these
- * cases, the role of the adapter is to map between the extension point
- * interface, and the actual extension implementation. In general, adapters
- * are used when attempting to plug-in existing Java implementations, or
- * non-Java implementations (e.g., external executables).
- * </p>
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see IConfigurationElement#createExecutableExtension(String)
- */
-public interface IExecutableExtension {
- /**
- * This method is called by the implementation of the method
- * <code>IConfigurationElement.createExecutableExtension</code>
- * on a newly constructed extension, passing it its relevant configuration
- * information. Most executable extensions only make use of the first
- * two call arguments.
- * <p>
- * Regular executable extensions specify their Java implementation
- * class name as an attribute of the configuration element for the
- * extension. For example
- * <pre>
- * <action run="com.example.BaseAction"/>
- * </pre>
- * In the above example, this method would be called with a reference
- * to the <code><action></code> element (first argument), and
- * <code>"run"</code> as the name of the attribute that defined
- * this executable extension (second argument).
- * </p>
- * <p>
- * The last parameter is for the specific use of extension adapters
- * and is typically not used by regular executable extensions.
- * </p>
- * <p>
- * There are two supported ways of associating additional
- * adapter-specific data with the configuration in a way that
- * is transparent to the extension point implementor:
- * </p>
- * <p>
- * (1) by specifying adapter data as part of the implementation
- * class attribute value. The Java class name can be followed
- * by a ":" separator, followed by any adapter data in string
- * form. For example, if the extension point specifies an attribute
- * <code>"run"</code> to contain the name of the extension implementation,
- * an adapter can be configured as
- * <pre>
- * <action run="com.example.ExternalAdapter:./cmds/util.exe -opt 3"/>
- * </pre>
- * </p>
- * <p>
- * (2) by converting the attribute used to specify the executable
- * extension to a child element of the original configuration element,
- * and specifying the adapter data in the form of xml markup.
- * Using this form, the example above would become
- * <pre>
- * <action>
- * <<it>run</it> class="com.xyz.ExternalAdapter">
- * <parameter name="exec" value="./cmds/util.exe"/>
- * <parameter name="opt" value="3"/>
- * </<it>run</it>>
- * </action>
- * </pre>
- * </p>
- * <p>
- * Form (2) will typically only be
- * used for extension points that anticipate the majority of
- * extensions configured into it will in fact be in the form
- * of adapters.
- * </p>
- * <p>
- * In either case, the specified adapter class is instantiated using its
- * 0-argument public constructor. The adapter data is passed as the
- * last argument of this method. The data argument is defined as Object.
- * It can have the following values:
- * <ul>
- * <li><code>null</code>, if no adapter data was supplied</li>
- * <li>in case (1), the initialization data
- * string is passed as a <code>String</code></li>
- * <li>in case (2), the initialization data is passed
- * as a <code>Hashtable</code> containing the actual
- * parameter names and values (both <code>String</code>s)</li>
- * </ul>
- * </p>
- *
- * @param config the configuration element used to trigger this execution.
- * It can be queried by the executable extension for specific
- * configuration properties
- * @param propertyName the name of an attribute of the configuration element
- * used on the <code>createExecutableExtension(String)</code> call. This
- * argument can be used in the cases where a single configuration element
- * is used to define multiple executable extensions.
- * @param data adapter data in the form of a <code>String</code>,
- * a <code>Hashtable</code>, or <code>null</code>.
- * @exception CoreException if error(s) detected during initialization processing
- * @see IConfigurationElement#createExecutableExtension(String)
- */
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException;
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExecutableExtensionFactory.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExecutableExtensionFactory.java
deleted file mode 100644
index 675c7aa..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExecutableExtensionFactory.java
+++ /dev/null
@@ -1,47 +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;
-
-/**
- * This interface allows extension providers to control how the instances provided to extension-points are being created
- * by referring to the factory instead of referring to a class. For example, the following extension to the preference page
- * extension-point uses a factory called <code>PreferencePageFactory</code>.
- * <code><pre>
- * <extension point="org.eclipse.ui.preferencePages">
- * <page name="..." class="org.eclipse.update.ui.PreferencePageFactory:org.eclipse.update.ui.preferences.MainPreferencePage">
- * </page>
- * </extension>
- * </pre>
- * </code>
- *
- * <p>
- * Effectively, factories give full control over the create executable extension process.
- * </p><p>
- * The factories are responsible for handling the case where the concrete instance implement {@link IExecutableExtension}.
- * </p><p>
- * Given that factories are instantiated as executable extensions, they must provide a 0-argument public constructor.
- * Like any other executable extension, they can configured by implementing {@link org.eclipse.core.runtime.IExecutableExtension} interface.
- * </p>
- *
- * @see org.eclipse.core.runtime.IConfigurationElement
- * @since 3.1
- */
-public interface IExecutableExtensionFactory {
-
- /**
- * Creates and returns a new instance.
- *
- * @exception CoreException if an instance of the executable extension
- * could not be created for any reason
- */
- Object create() throws CoreException;
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtension.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtension.java
deleted file mode 100644
index 49d549e..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtension.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 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;
-
- /**
- * 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 Platform#getBundle(String)
- * @see IExtensionRegistry
- * @since 3.0
- */
- public String getNamespace() 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();
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtensionDelta.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtensionDelta.java
deleted file mode 100644
index cb83847..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtensionDelta.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * An extension delta represents changes to the extension registry.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
-
- * @since 3.0
- */
-public interface IExtensionDelta {
- /**
- * Delta kind constant indicating that an extension has been added to an
- * extension point.
- * @see IExtensionDelta#getKind()
- */
- public int ADDED = 1;
- /**
- * Delta kind constant indicating that an extension has been removed from an
- * extension point.
- * @see IExtensionDelta#getKind()
- */
- public int REMOVED = 2;
-
- /**
- * The kind of this extension delta.
- *
- * @return the kind of change this delta represents
- * @see #ADDED
- * @see #REMOVED
- */
- public int getKind();
-
- /**
- * Returns the affected extension.
- *
- * @return the affected extension
- */
- public IExtension getExtension();
-
- /**
- * Returns the affected extension point.
- *
- * @return the affected extension point
- */
- public IExtensionPoint getExtensionPoint();
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtensionPoint.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtensionPoint.java
deleted file mode 100644
index 7f80dc7..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtensionPoint.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 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;
-
- /**
- * 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 Platform#getBundle(String)
- * @see IExtensionRegistry
- * @since 3.0
- */
- public String getNamespace() 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();
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtensionRegistry.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtensionRegistry.java
deleted file mode 100644
index c2be5c4..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IExtensionRegistry.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * The extension registry holds the master list of all
- * discovered namespaces, extension points and extensions.
- * <p>
- * The extension registry can be queried, by name, for
- * extension points and extensions.
- * </p>
- * <p>
- * The various objects that describe the contents of the extension registry
- * ({@link IExtensionPoint}, {@link IExtension}, and {@link IConfigurationElement})
- * 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 on these object except
- * <code>isValid()</code> will throw {@link InvalidRegistryObjectException}.
- * 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 if it accesses extension registry objects,
- * because it's at risk if plug-in are removed. Similarly, tools that analyze
- * or display the extension registry are vulnerable. Client code can pre-test for
- * invalid objects by calling <code>isValid()</code>, which never throws this exception.
- * However, pre-tests are usually not sufficient because of the possibility of the
- * extension registry 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>
- * Extensions and extension points are declared by generic entities called
- * <cite>namespaces</cite>. The only fact known about namespaces is that they
- * have unique string-based identifiers. One example of a namespace
- * is a plug-in, for which the namespace id is the plug-in id.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * @since 3.0
- */
-public interface IExtensionRegistry {
- /**
- * Adds the given listener for registry change events related to extension points
- * in the given namespace.
- * Has no effect if an identical listener is already registered. After
- * completion of this method, the given listener will be registered for events
- * related to extension points in the specified namespace. If no namespace
- * is specified, the listener will receive notifications for changes to
- * extension points in any namespace.
- * <p>
- * Once registered, a listener starts receiving notification of changes to
- * the registry. Registry change notifications are sent asynchronously.
- * The listener continues to receive notifications until it is removed.
- * </p>
- * @param listener the listener
- * @param namespace the namespace in which to listen for changes
- * @see IRegistryChangeListener
- * @see IRegistryChangeEvent
- * @see #removeRegistryChangeListener(IRegistryChangeListener)
- */
- public void addRegistryChangeListener(IRegistryChangeListener listener, String namespace);
-
- /**
- * Adds the given listener for registry change events.
- * Has no effect if an identical listener is already registered.
- *
- * <p>
- * This method is equivalent to:
- * <pre>
- * addRegistryChangeListener(listener,null);
- * </pre>
- * </p>
- *
- * @param listener the listener
- * @see IRegistryChangeListener
- * @see IRegistryChangeEvent
- * @see #addRegistryChangeListener(IRegistryChangeListener, String)
- * @see #removeRegistryChangeListener(IRegistryChangeListener)
- */
- public void addRegistryChangeListener(IRegistryChangeListener listener);
-
- /**
- * 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
- */
- 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 namespace the namespace for the extension point
- * (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
- */
- public IConfigurationElement[] getConfigurationElementsFor(String namespace, 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 namespace the namespace for the extension point
- * (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
- */
- public IConfigurationElement[] getConfigurationElementsFor(String namespace, String extensionPointName, String extensionId);
-
- /**
- * Returns the specified extension in this extension registry,
- * or <code>null</code> if there is no such extension.
- *
- * @param extensionId the unique identifier of the extension
- * (e.g. <code>"com.example.acme.coolbuilder"</code>)
- * @return the extension, or <code>null</code>
- */
- public IExtension getExtension(String extensionId);
-
- /**
- * Returns the specified extension in this extension 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>
- */
- public IExtension getExtension(String extensionPointId, String extensionId);
-
- /**
- * Returns the specified extension in this extension 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 namespace the namespace for the extension point
- * (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>
- */
- public IExtension getExtension(String namespace, String extensionPointName, String extensionId);
-
- /**
- * Returns the extension point with the given extension point identifier
- * in this extension 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>
- */
- public IExtensionPoint getExtensionPoint(String extensionPointId);
-
- /**
- * Returns the extension point in this extension registry
- * with the given namespace and extension point simple identifier,
- * or <code>null</code> if there is no such extension point.
- *
- * @param namespace the namespace for the given extension point
- * (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>
- */
- public IExtensionPoint getExtensionPoint(String namespace, String extensionPointName);
-
- /**
- * Returns all extension points known to this extension registry.
- * Returns an empty array if there are no extension points.
- *
- * @return the extension points known to this extension registry
- */
- public IExtensionPoint[] getExtensionPoints();
-
- /**
- * Returns all extension points declared in the given namespace. Returns an empty array if
- * there are no extension points declared in the namespace.
- *
- * @param namespace the namespace for the extension points
- * (e.g. <code>"org.eclipse.core.resources"</code>)
- * @return the extension points in this registry declared in the given namespace
- */
- public IExtensionPoint[] getExtensionPoints(String namespace);
-
- /**
- * Returns all extensions declared in the given namespace. Returns an empty array if
- * no extensions are declared in the namespace.
- *
- * @param namespace the namespace for the extensions
- * (e.g. <code>"org.eclipse.core.resources"</code>)
- * @return the extensions in this registry declared in the given namespace
- */
- public IExtension[] getExtensions(String namespace);
-
- /**
- * Returns all namespaces where extensions and/or extension points. Returns an
- * empty array if there are no known extensions/extension points in this registry.
- *
- * @return all namespaces known to this registry
- * @since 3.0
- */
- //TODO This needs to be clarified.
- public String[] getNamespaces();
-
- /**
- * Removes the given registry change listener from this registry.
- * Has no effect if an identical listener is not registered.
- *
- * @param listener the listener
- * @see IRegistryChangeListener
- * @see #addRegistryChangeListener(IRegistryChangeListener)
- * @see #addRegistryChangeListener(IRegistryChangeListener, String)
- */
- public void removeRegistryChangeListener(IRegistryChangeListener listener);
-}
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 5f37a89..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILibrary.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 834ceda..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILog.java
+++ /dev/null
@@ -1,59 +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 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>
- */
-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/ILogListener.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILogListener.java
deleted file mode 100644
index b8c4548..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILogListener.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import java.util.EventListener;
-
-/**
- * A log listener is notified of entries added to a plug-in's log.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see ILog#addLogListener(ILogListener)
- * @see Platform#addLogListener(ILogListener)
- */
-public interface ILogListener extends EventListener {
- /**
- * Notifies this listener that given status has been logged by
- * a plug-in. The listener is free to retain or ignore this status.
- *
- * @param status the status being logged
- * @param plugin the plugin of the log which generated this event
- */
- public void logging(IStatus status, String plugin);
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPath.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPath.java
deleted file mode 100644
index d9eb8ca..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPath.java
+++ /dev/null
@@ -1,504 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * A path is an ordered collection of string segments,
- * separated by a standard separator character, "/".
- * A path may also have a leading and/or a trailing separator.
- * Paths may also be prefixed by an optional device id, which includes
- * the character(s) which separate the device id from the rest
- * of the path. For example, "C:" and "Server/Volume:" are typical
- * device ids.
- * A device independent path has <code>null</code> for a device id.
- * <p>
- * Note that paths are value objects; all operations on paths
- * return a new path; the path that is operated on is unscathed.
- * </p>
- * <p>
- * UNC paths are denoted by leading double-slashes such
- * as <code>//Server/Volume/My/Path</code>. When a new path
- * is constructed all double-slashes are removed except those
- * appearing at the beginning of the path.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see Path
- */
-public interface IPath extends Cloneable {
-
- /**
- * Path separator character constant "/" used in paths.
- */
- public static final char SEPARATOR = '/';
-
- /**
- * Device separator character constant ":" used in paths.
- */
- public static final char DEVICE_SEPARATOR = ':';
-
- /**
- * Returns a new path which is the same as this path but with
- * the given file extension added. If this path is empty, root or has a
- * trailing separator, this path is returned. If this path already
- * has an extension, the existing extension is left and the given
- * extension simply appended. Clients wishing to replace
- * the current extension should first remove the extension and
- * then add the desired one.
- * <p>
- * The file extension portion is defined as the string
- * following the last period (".") character in the last segment.
- * The given extension should not include a leading ".".
- * </p>
- *
- * @param extension the file extension to append
- * @return the new path
- */
- public IPath addFileExtension(String extension);
-
- /**
- * Returns a path with the same segments as this path
- * but with a trailing separator added.
- * This path must have at least one segment.
- * <p>
- * If this path already has a trailing separator,
- * this path is returned.
- * </p>
- *
- * @return the new path
- * @see #hasTrailingSeparator()
- * @see #removeTrailingSeparator()
- */
- public IPath addTrailingSeparator();
-
- /**
- * Returns the canonicalized path obtained from the
- * concatenation of the given string path to the
- * end of this path. The given string path must be a valid
- * path. If it has a trailing separator,
- * the result will have a trailing separator.
- * The device id of this path is preserved (the one
- * of the given string is ignored). Duplicate slashes
- * are removed from the path except at the beginning
- * where the path is considered to be UNC.
- *
- * @param path the string path to concatenate
- * @return the new path
- * @see #isValidPath(String)
- */
- public IPath append(String path);
-
- /**
- * Returns the canonicalized path obtained from the
- * concatenation of the given path's segments to the
- * end of this path. If the given path has a trailing
- * separator, the result will have a trailing separator.
- * The device id of this path is preserved (the one
- * of the given path is ignored). Duplicate slashes
- * are removed from the path except at the beginning
- * where the path is considered to be UNC.
- *
- * @param path the path to concatenate
- * @return the new path
- */
- public IPath append(IPath path);
-
- /**
- * Returns a copy of this path.
- *
- * @return the cloned path
- */
- public Object clone();
-
- /**
- * Returns whether this path equals the given object.
- * <p>
- * Equality for paths is defined to be: same sequence of segments,
- * same absolute/relative status, and same device.
- * Trailing separators are disregarded.
- * Paths are not generally considered equal to objects other than paths.
- * </p>
- *
- * @param obj the other object
- * @return <code>true</code> if the paths are equivalent,
- * and <code>false</code> if they are not
- */
- public boolean equals(Object obj);
-
- /**
- * Returns the device id for this path, or <code>null</code> if this
- * path has no device id. Note that the result will end in ':'.
- *
- * @return the device id, or <code>null</code>
- * @see #setDevice(String)
- */
- public String getDevice();
-
- /**
- * Returns the file extension portion of this path,
- * or <code>null</code> if there is none.
- * <p>
- * The file extension portion is defined as the string
- * following the last period (".") character in the last segment.
- * If there is no period in the last segment, the path has no
- * file extension portion. If the last segment ends in a period,
- * the file extension portion is the empty string.
- * </p>
- *
- * @return the file extension or <code>null</code>
- */
- public String getFileExtension();
-
- /**
- * Returns whether this path has a trailing separator.
- * <p>
- * Note: In the root path ("/"), the separator is considered to
- * be leading rather than trailing.
- * </p>
- *
- * @return <code>true</code> if this path has a trailing
- * separator, and <code>false</code> otherwise
- * @see #addTrailingSeparator()
- * @see #removeTrailingSeparator()
- */
- public boolean hasTrailingSeparator();
-
- /**
- * Returns whether this path is an absolute path (ignoring
- * any device id).
- * <p>
- * Absolute paths start with a path separator.
- * A root path, like <code>/</code> or <code>C:/</code>,
- * is considered absolute. UNC paths are always absolute.
- * </p>
- *
- * @return <code>true</code> if this path is an absolute path,
- * and <code>false</code> otherwise
- */
- public boolean isAbsolute();
-
- /**
- * Returns whether this path has no segments and is not
- * a root path.
- *
- * @return <code>true</code> if this path is empty,
- * and <code>false</code> otherwise
- */
- public boolean isEmpty();
-
- /**
- * Returns whether this path is a prefix of the given path.
- * To be a prefix, this path's segments must
- * appear in the argument path in the same order,
- * and their device ids must match.
- * <p>
- * An empty path is a prefix of all paths with the same device; a root path is a prefix of
- * all absolute paths with the same device.
- * </p>
- * @param anotherPath the other path
- * @return <code>true</code> if this path is a prefix of the given path,
- * and <code>false</code> otherwise
- */
- public boolean isPrefixOf(IPath anotherPath);
-
- /**
- * Returns whether this path is a root path.
- * <p>
- * The root path is the absolute non-UNC path with zero segments;
- * e.g., <code>/</code> or <code>C:/</code>.
- * The separator is considered a leading separator, not a trailing one.
- * </p>
- *
- * @return <code>true</code> if this path is a root path,
- * and <code>false</code> otherwise
- */
- public boolean isRoot();
-
- /**
- * Returns a boolean value indicating whether or not this path
- * is considered to be in UNC form. Return false if this path
- * has a device set or if the first 2 characters of the path string
- * are not <code>Path.SEPARATOR</code>.
- *
- * @return boolean indicating if this path is UNC
- */
- public boolean isUNC();
-
- /**
- * Returns whether the given string is syntactically correct as
- * a path. The device id is the prefix up to and including the device
- * separator for the local file system; the path proper is everything to
- * the right of it, or the entire string if there is no device separator.
- * When the platform location is a file system with no meaningful device
- * separator, the entire string is treated as the path proper.
- * The device id is not checked for validity; the path proper is correct
- * if each of the segments in its canonicalized form is valid.
- *
- * @param path the path to check
- * @return <code>true</code> if the given string is a valid path,
- * and <code>false</code> otherwise
- * @see #isValidSegment(String)
- */
- public boolean isValidPath(String path);
-
- /**
- * Returns whether the given string is valid as a segment in
- * a path. The rules for valid segments are as follows:
- * <ul>
- * <li> the empty string is not valid
- * <li> any string containing the slash character ('/') is not valid
- * <li>any string containing segment or device separator characters
- * on the local file system, such as the backslash ('\') and colon (':')
- * on some file systems.
- * </ul>
- *
- * @param segment the path segment to check
- * @return <code>true</code> if the given path segment is valid,
- * and <code>false</code> otherwise
- */
- public boolean isValidSegment(String segment);
-
- /**
- * Returns the last segment of this path, or
- * <code>null</code> if it does not have any segments.
- *
- * @return the last segment of this path, or <code>null</code>
- */
- public String lastSegment();
-
- /**
- * Returns an absolute path with the segments and device id of this path.
- * Absolute paths start with a path separator. If this path is absolute,
- * it is simply returned.
- *
- * @return the new path
- */
- public IPath makeAbsolute();
-
- /**
- * Returns a relative path with the segments and device id of this path.
- * Absolute paths start with a path separator and relative paths do not.
- * If this path is relative, it is simply returned.
- *
- * @return the new path
- */
- public IPath makeRelative();
-
- /**
- * Return a new path which is the equivalent of this path converted to UNC
- * form (if the given boolean is true) or this path not as a UNC path (if the given
- * boolean is false). If UNC, the returned path will not have a device and the
- * first 2 characters of the path string will be <code>Path.SEPARATOR</code>. If not UNC, the
- * first 2 characters of the returned path string will not be <code>Path.SEPARATOR</code>.
- *
- * @param toUNC true if converting to UNC, false otherwise
- * @return the new path, either in UNC form or not depending on the boolean parameter
- */
- public IPath makeUNC(boolean toUNC);
-
- /**
- * Returns a count of the number of segments which match in
- * this path and the given path (device ids are ignored),
- * comparing in increasing segment number order.
- *
- * @param anotherPath the other path
- * @return the number of matching segments
- */
- public int matchingFirstSegments(IPath anotherPath);
-
- /**
- * Returns a new path which is the same as this path but with
- * the file extension removed. If this path does not have an
- * extension, this path is returned.
- * <p>
- * The file extension portion is defined as the string
- * following the last period (".") character in the last segment.
- * If there is no period in the last segment, the path has no
- * file extension portion. If the last segment ends in a period,
- * the file extension portion is the empty string.
- * </p>
- *
- * @return the new path
- */
- public IPath removeFileExtension();
-
- /**
- * Returns a copy of this path with the given number of segments
- * removed from the beginning. The device id is preserved.
- * The number must be greater or equal zero.
- * If the count is zero, this path is returned.
- * The resulting path will always be a relative path with respect
- * to this path. If the number equals or exceeds the number
- * of segments in this path, an empty relative path is returned.
- *
- * @param count the number of segments to remove
- * @return the new path
- */
- public IPath removeFirstSegments(int count);
-
- /**
- * Returns a copy of this path with the given number of segments
- * removed from the end. The device id is preserved.
- * The number must be greater or equal zero.
- * If the count is zero, this path is returned.
- * <p>
- * If this path has a trailing separator, it will still
- * have a trailing separator after the last segments are removed
- * (assuming there are some segments left). If there is no
- * trailing separator, the result will not have a trailing
- * separator.
- * If the number equals or exceeds the number
- * of segments in this path, an empty path is returned.
- * </p>
- *
- * @param count the number of segments to remove
- * @return the new path
- */
- public IPath removeLastSegments(int count);
-
- /**
- * Returns a path with the same segments as this path
- * but with a trailing separator removed.
- * Does nothing if this path does not have at least one segment.
- * The device id is preserved.
- * <p>
- * If this path does not have a trailing separator,
- * this path is returned.
- * </p>
- *
- * @return the new path
- * @see #addTrailingSeparator()
- * @see #hasTrailingSeparator()
- */
- public IPath removeTrailingSeparator();
-
- /**
- * Returns the specified segment of this path, or
- * <code>null</code> if the path does not have such a segment.
- *
- * @param index the 0-based segment index
- * @return the specified segment, or <code>null</code>
- */
- public String segment(int index);
-
- /**
- * Returns the number of segments in this path.
- * <p>
- * Note that both root and empty paths have 0 segments.
- * </p>
- *
- * @return the number of segments
- */
- public int segmentCount();
-
- /**
- * Returns the segments in this path in order.
- *
- * @return an array of string segments
- */
- public String[] segments();
-
- /**
- * Returns a new path which is the same as this path but with
- * the given device id. The device id must end with a ":".
- * A device independent path is obtained by passing <code>null</code>.
- * <p>
- * For example, "C:" and "Server/Volume:" are typical device ids.
- * </p>
- *
- * @param device the device id or <code>null</code>
- * @return a new path
- * @see #getDevice()
- */
- public IPath setDevice(String device);
-
- /**
- * Returns a <code>java.io.File</code> corresponding to this path.
- *
- * @return the file corresponding to this path
- */
- public java.io.File toFile();
-
- /**
- * Returns a string representation of this path which uses the
- * platform-dependent path separator defined by <code>java.io.File</code>.
- * This method is like <code>toString()</code> except that the
- * latter always uses the same separator (<code>/</code>) regardless of platform.
- * <p>
- * This string is suitable for passing to <code>java.io.File(String)</code>.
- * </p>
- *
- * @return a platform-dependent string representation of this path
- */
- public String toOSString();
-
- /**
- * Returns a platform-neutral string representation of this path. The
- * format is not specified, except that the resulting string can be
- * passed back to the <code>Path#fromPortableString(String)</code>
- * constructor to produce the exact same path on any platform.
- * <p>
- * This string is suitable for passing to <code>Path#fromPortableString(String)</code>.
- * </p>
- *
- * @return a platform-neutral string representation of this path
- * @see Path#fromPortableString(String)
- * @since 3.1
- */
- public String toPortableString();
-
- /**
- * Returns a string representation of this path, including its
- * device id. The same separator, "/", is used on all platforms.
- * <p>
- * Example result strings (without and with device id):
- * <pre>
- * "/foo/bar.txt"
- * "bar.txt"
- * "/foo/"
- * "foo/"
- * ""
- * "/"
- * "C:/foo/bar.txt"
- * "C:bar.txt"
- * "C:/foo/"
- * "C:foo/"
- * "C:"
- * "C:/"
- * </pre>
- * This string is suitable for passing to <code>Path(String)</code>.
- * </p>
- *
- * @return a string representation of this path
- * @see Path
- */
- public String toString();
-
- /**
- * Returns a copy of this path truncated after the
- * given number of segments. The number must not be negative.
- * The device id is preserved.
- * <p>
- * If this path has a trailing separator, the result will too
- * (assuming there are some segments left). If there is no
- * trailing separator, the result will not have a trailing
- * separator.
- * Copying up to segment zero simply means making an copy with
- * no path segments.
- * </p>
- *
- * @param count the segment number at which to truncate the path
- * @return the new path
- */
- public IPath uptoSegment(int count);
-}
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 10f7002..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPlatformRunnable.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * 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
- */
-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.
- */
- 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 bb4b901..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPluginDescriptor.java
+++ /dev/null
@@ -1,524 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 = 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 = 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 e296532..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPluginPrerequisite.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 953d9b0..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPluginRegistry.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 d03417e..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProduct.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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
- * @see org.eclipse.ui.branding.IProductConstants
- * @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 72a0ab4..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProductProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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/IProgressMonitor.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProgressMonitor.java
deleted file mode 100644
index 3a8f2d7..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProgressMonitor.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * The <code>IProgressMonitor</code> interface is implemented
- * by objects that monitor the progress of an activity; the methods
- * in this interface are invoked by code that performs the activity.
- * <p>
- * All activity is broken down into a linear sequence of tasks against
- * which progress is reported. When a task begins, a <code>beginTask(String, int)
- * </code> notification is reported, followed by any number and mixture of
- * progress reports (<code>worked()</code>) and subtask notifications
- * (<code>subTask(String)</code>). When the task is eventually completed, a
- * <code>done()</code> notification is reported. After the <code>done()</code>
- * notification, the progress monitor cannot be reused; i.e., <code>
- * beginTask(String, int)</code> cannot be called again after the call to
- * <code>done()</code>.
- * </p>
- * <p>
- * A request to cancel an operation can be signaled using the
- * <code>setCanceled</code> method. Operations taking a progress
- * monitor are expected to poll the monitor (using <code>isCanceled</code>)
- * periodically and abort at their earliest convenience. Operation can however
- * choose to ignore cancelation requests.
- * </p>
- * <p>
- * Since notification is synchronous with the activity itself, the listener should
- * provide a fast and robust implementation. If the handling of notifications would
- * involve blocking operations, or operations which might throw uncaught exceptions,
- * the notifications should be queued, and the actual processing deferred (or perhaps
- * delegated to a separate thread).
- * </p>
- * <p>
- * Clients may implement this interface.
- * </p>
- */
-public interface IProgressMonitor {
-
- /** Constant indicating an unknown amount of work.
- */
- public final static int UNKNOWN = -1;
-
- /**
- * Notifies that the main task is beginning. This must only be called once
- * on a given progress monitor instance.
- *
- * @param name the name (or description) of the main task
- * @param totalWork the total number of work units into which
- * the main task is been subdivided. If the value is <code>UNKNOWN</code>
- * the implementation is free to indicate progress in a way which
- * doesn't require the total number of work units in advance.
- */
- public void beginTask(String name, int totalWork);
-
- /**
- * Notifies that the work is done; that is, either the main task is completed
- * or the user canceled it. This method may be called more than once
- * (implementations should be prepared to handle this case).
- */
- public void done();
-
- /**
- * Internal method to handle scaling correctly. This method
- * must not be called by a client. Clients should
- * always use the method </code>worked(int)</code>.
- *
- * @param work the amount of work done
- */
- public void internalWorked(double work);
-
- /**
- * Returns whether cancelation of current operation has been requested.
- * Long-running operations should poll to see if cancelation
- * has been requested.
- *
- * @return <code>true</code> if cancellation has been requested,
- * and <code>false</code> otherwise
- * @see #setCanceled(boolean)
- */
- public boolean isCanceled();
-
- /**
- * Sets the cancel state to the given value.
- *
- * @param value <code>true</code> indicates that cancelation has
- * been requested (but not necessarily acknowledged);
- * <code>false</code> clears this flag
- * @see #isCanceled()
- */
- public void setCanceled(boolean value);
-
- /**
- * Sets the task name to the given value. This method is used to
- * restore the task label after a nested operation was executed.
- * Normally there is no need for clients to call this method.
- *
- * @param name the name (or description) of the main task
- * @see #beginTask(java.lang.String, int)
- */
- public void setTaskName(String name);
-
- /**
- * Notifies that a subtask of the main task is beginning.
- * Subtasks are optional; the main task might not have subtasks.
- *
- * @param name the name (or description) of the subtask
- */
- public void subTask(String name);
-
- /**
- * Notifies that a given number of work unit of the main task
- * has been completed. Note that this amount represents an
- * installment, as opposed to a cumulative amount of work done
- * to date.
- *
- * @param work the number of work units just completed
- */
- public void worked(int work);
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProgressMonitorWithBlocking.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProgressMonitorWithBlocking.java
deleted file mode 100644
index 23a2bac..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IProgressMonitorWithBlocking.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * An extension to the IProgressMonitor interface for monitors that want to
- * support feedback when an activity is blocked due to concurrent activity in
- * another thread.
- * <p>
- * When a monitor that supports this extension is passed to an operation, the
- * operation should call <code>setBlocked</code> whenever it knows that it
- * must wait for a lock that is currently held by another thread. The operation
- * should continue to check for and respond to cancelation requests while
- * blocked. When the operation is no longer blocked, it must call <code>clearBlocked</code>
- * to clear the blocked state.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see IProgressMonitor
- * @since 3.0
- */
-public interface IProgressMonitorWithBlocking extends IProgressMonitor {
- /**
- * Indicates that this operation is blocked by some background activity. If
- * a running operation ever calls <code>setBlocked</code>, it must
- * eventually call <code>clearBlocked</code> before the operation
- * completes.
- * <p>
- * If the caller is blocked by a currently executing job, this method will return
- * an <code>IJobStatus</code> indicating the job that is currently blocking
- * the caller. If this blocking job is not known, this method will return a plain
- * informational <code>IStatus</code> object.
- * </p>
- *
- * @param reason an optional status object whose message describes the
- * reason why this operation is blocked, or <code>null</code> if this
- * information is not available.
- * @see #clearBlocked()
- * @see org.eclipse.core.runtime.jobs.IJobStatus
- */
- public void setBlocked(IStatus reason);
-
- /**
- * Clears the blocked state of the running operation. If a running
- * operation ever calls <code>setBlocked</code>, it must eventually call
- * <code>clearBlocked</code> before the operation completes.
- *
- * @see #setBlocked(IStatus)
- */
- public void clearBlocked();
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IRegistryChangeEvent.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IRegistryChangeEvent.java
deleted file mode 100644
index f7af951..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IRegistryChangeEvent.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * Registry change events describe changes to the extension registry.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * @since 3.0
- * @see IExtensionRegistry
- * @see IRegistryChangeListener
- */
-public interface IRegistryChangeEvent {
- /**
- * Returns all extension deltas for all hosts. Returns an empty array if there are
- * no deltas in this event.
- *
- * @return all extension deltas
- */
- public IExtensionDelta[] getExtensionDeltas();
-
- /**
- * Returns all extension deltas for the given namespace. Returns an empty array if there are
- * no deltas in this event for any extension points provided in the given namespace.
- *
- * @param namespace the namespace for the extension deltas
- * @return all extension deltas for the given namespace
- */
- public IExtensionDelta[] getExtensionDeltas(String namespace);
-
- /**
- * Returns all the extension deltas for the given namespace and extension point. Returns an
- * empty array if there are no deltas in this event for the given extension point.
- *
- * @param namespace the namespace for the extension point
- * @param extensionPoint the simple identifier of the
- * extension point (e.g. <code>"builders"</code>)
- * @return all extension deltas for the given extension point
- */
- public IExtensionDelta[] getExtensionDeltas(String namespace, String extensionPoint);
-
- /**
- * Returns the delta for the given namespace, extension point and extension.
- * Returns <code>null</code> if none exists in this event.
- *
- * @param namespace the namespace for the extension point
- * @param extensionPoint the simple identifier of the
- * extension point (e.g. <code>"builders"</code>)
- * @param extension the unique identifier of the extension
- * @return the extension delta, or <code>null</code>
- */
- public IExtensionDelta getExtensionDelta(String namespace, String extensionPoint, String extension);
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IRegistryChangeListener.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IRegistryChangeListener.java
deleted file mode 100644
index 8c908af..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IRegistryChangeListener.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import java.util.EventListener;
-
-/**
- * A registry change listener is notified of changes to extensions points in the
- * registry. These changes arise from subsequent manipulation of the registry after
- * it was initially created.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @since 3.0
- * @see IExtensionRegistry
- * @see IRegistryChangeEvent
- */
-public interface IRegistryChangeListener extends EventListener {
- /**
- * Notifies this listener that some registry changes are happening, or have
- * already happened.
- * <p>
- * The supplied event gives details. This event object (and the deltas in it) is valid
- * only for the duration of the invocation of this method.
- * </p> <p>
- * Note: This method is called by the platform; it is not intended
- * to be called directly by clients.
- * </p>
- *
- * @param event the registry change event
- * @see IRegistryChangeEvent
- */
- public void registryChanged(IRegistryChangeEvent event);
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ISafeRunnable.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ISafeRunnable.java
deleted file mode 100644
index 02a7ce1..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ISafeRunnable.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * Safe runnables represent blocks of code and associated exception
- * handlers. They are typically used when a plug-in needs to call some
- * untrusted code (e.g., code contributed by another plug-in via an
- * extension).
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see Platform#run(ISafeRunnable)
- */
-public interface ISafeRunnable {
- /**
- * Handles an exception thrown by this runnable's <code>run</code>
- * method. The processing done here should be specific to the
- * particular usecase for this runnable. Generalized exception
- * processing (e.g., logging in the platform's log) is done by the
- * Platform's run mechanism.
- *
- * @param exception an exception which occurred during processing
- * the body of this runnable (i.e., in <code>run()</code>)
- * @see Platform#run(ISafeRunnable)
- */
- public void handleException(Throwable exception);
-
- /**
- * Runs this runnable. Any exceptions thrown from this method will
- * be passed to this runnable's <code>handleException</code>
- * method.
- *
- * @exception Exception if a problem occurred while running this method.
- * The exception will be processed by <code>handleException</code>
- * @see Platform#run(ISafeRunnable)
- */
- public void run() throws Exception;
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IStatus.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IStatus.java
deleted file mode 100644
index a241885..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IStatus.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * A status object represents the outcome of an operation.
- * All <code>CoreException</code>s carry a status object to indicate
- * what went wrong. Status objects are also returned by methods needing
- * to provide details of failures (e.g., validation methods).
- * <p>
- * A status carries the following information:
- * <ul>
- * <li> plug-in identifier (required)</li>
- * <li> severity (required)</li>
- * <li> status code (required)</li>
- * <li> message (required) - localized to current locale</li>
- * <li> exception (optional) - for problems stemming from a failure at
- * a lower level</li>
- * </ul>
- * Some status objects, known as multi-statuses, have other status objects
- * as children.
- * </p>
- * <p>
- * The class <code>Status</code> is the standard public implementation
- * of status objects; the subclass <code>MultiStatus</code> is the
- * implements multi-status objects.
- * </p>
- * @see MultiStatus
- * @see Status
- */
-public interface IStatus {
-
- /** Status severity constant (value 0) indicating this status represents the nominal case.
- * This constant is also used as the status code representing the nominal case.
- * @see #getSeverity()
- * @see #isOK()
- */
- public static final int OK = 0;
-
- /** Status type severity (bit mask, value 1) indicating this status is informational only.
- * @see #getSeverity()
- * @see #matches(int)
- */
- public static final int INFO = 0x01;
-
- /** Status type severity (bit mask, value 2) indicating this status represents a warning.
- * @see #getSeverity()
- * @see #matches(int)
- */
- public static final int WARNING = 0x02;
-
- /** Status type severity (bit mask, value 4) indicating this status represents an error.
- * @see #getSeverity()
- * @see #matches(int)
- */
- public static final int ERROR = 0x04;
-
- /** Status type severity (bit mask, value 8) indicating this status represents a
- * cancelation
- * @see #getSeverity()
- * @see #matches(int)
- * @since 3.0
- */
- public static final int CANCEL = 0x08;
-
- /**
- * Returns a list of status object immediately contained in this
- * multi-status, or an empty list if this is not a multi-status.
- *
- * @return an array of status objects
- * @see #isMultiStatus()
- */
- public IStatus[] getChildren();
-
- /**
- * Returns the plug-in-specific status code describing the outcome.
- *
- * @return plug-in-specific status code
- */
- public int getCode();
-
- /**
- * Returns the relevant low-level exception, or <code>null</code> if none.
- * For example, when an operation fails because of a network communications
- * failure, this might return the <code>java.io.IOException</code>
- * describing the exact nature of that failure.
- *
- * @return the relevant low-level exception, or <code>null</code> if none
- */
- public Throwable getException();
-
- /**
- * Returns the message describing the outcome.
- * The message is localized to the current locale.
- *
- * @return a localized message
- */
- public String getMessage();
-
- /**
- * Returns the unique identifier of the plug-in associated with this status
- * (this is the plug-in that defines the meaning of the status code).
- *
- * @return the unique identifier of the relevant plug-in
- */
- public String getPlugin();
-
- /**
- * Returns the severity. The severities are as follows (in
- * descending order):
- * <ul>
- * <li><code>CANCEL</code> - cancelation occurred</li>
- * <li><code>ERROR</code> - a serious error (most severe)</li>
- * <li><code>WARNING</code> - a warning (less severe)</li>
- * <li><code>INFO</code> - an informational ("fyi") message (least severe)</li>
- * <li><code>OK</code> - everything is just fine</li>
- * </ul>
- * <p>
- * The severity of a multi-status is defined to be the maximum
- * severity of any of its children, or <code>OK</code> if it has
- * no children.
- * </p>
- *
- * @return the severity: one of <code>OK</code>, <code>ERROR</code>,
- * <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
- * @see #matches(int)
- */
- public int getSeverity();
-
- /**
- * Returns whether this status is a multi-status.
- * A multi-status describes the outcome of an operation
- * involving multiple operands.
- * <p>
- * The severity of a multi-status is derived from the severities
- * of its children; a multi-status with no children is
- * <code>OK</code> by definition.
- * A multi-status carries a plug-in identifier, a status code,
- * a message, and an optional exception. Clients may treat
- * multi-status objects in a multi-status unaware way.
- * </p>
- *
- * @return <code>true</code> for a multi-status,
- * <code>false</code> otherwise
- * @see #getChildren()
- */
- public boolean isMultiStatus();
-
- /**
- * Returns whether this status indicates everything is okay
- * (neither info, warning, nor error).
- *
- * @return <code>true</code> if this status has severity
- * <code>OK</code>, and <code>false</code> otherwise
- */
- public boolean isOK();
-
- /**
- * Returns whether the severity of this status matches the given
- * severity mask. Note that a status with severity <code>OK</code>
- * will never match; use <code>isOK</code> instead to detect
- * a status with a severity of <code>OK</code>.
- *
- * @param severityMask a mask formed by bitwise or'ing severity mask
- * constants (<code>ERROR</code>, <code>WARNING</code>,
- * <code>INFO</code>, <code>CANCEL</code>)
- * @return <code>true</code> if there is at least one match,
- * <code>false</code> if there are no matches
- * @see #getSeverity()
- * @see #CANCEL
- * @see #ERROR
- * @see #WARNING
- * @see #INFO
- */
- public boolean matches(int severityMask);
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/InvalidRegistryObjectException.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/InvalidRegistryObjectException.java
deleted file mode 100644
index b2495d4..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/InvalidRegistryObjectException.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.runtime;
-
-
-/**
- * An unchecked exception indicating that an attempt to access
- * an extension registry object that is no longer valid.
- * <p>
- * This exception is thrown by methods on extension registry
- * objects. It is not intended to be instantiated or
- * subclassed by clients.
- * </p>
- *
- * @since 3.1
- */
-public class InvalidRegistryObjectException extends RuntimeException {
- /*
- * Declare a stable serialVersionUID.
- */
- private static final long serialVersionUID = 1L;
-
- private static final String MESSAGE = "Invalid registry object"; //$NON-NLS-1$
-
- /**
- * Creates a new exception instance with null as its detail message.
- */
- public InvalidRegistryObjectException() {
- super(MESSAGE);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/MultiStatus.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/MultiStatus.java
deleted file mode 100644
index 0225c40..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/MultiStatus.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import org.eclipse.core.internal.runtime.Assert;
-
-/**
- * A concrete multi-status implementation,
- * suitable either for instantiating or subclassing.
- */
-public class MultiStatus extends Status {
-
- /** List of child statuses.
- */
- private IStatus[] children;
-
- /**
- * Creates and returns a new multi-status object with the given children.
- *
- * @param pluginId the unique identifier of the relevant plug-in
- * @param code the plug-in-specific status code
- * @param newChildren the list of children status objects
- * @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 MultiStatus(String pluginId, int code, IStatus[] newChildren, String message, Throwable exception) {
- this(pluginId, code, message, exception);
- Assert.isLegal(newChildren != null);
- int maxSeverity = getSeverity();
- for (int i = 0; i < newChildren.length; i++) {
- Assert.isLegal(newChildren[i] != null);
- int severity = newChildren[i].getSeverity();
- if (severity > maxSeverity)
- maxSeverity = severity;
- }
- this.children = new IStatus[newChildren.length];
- setSeverity(maxSeverity);
- System.arraycopy(newChildren, 0, this.children, 0, newChildren.length);
- }
-
- /**
- * Creates and returns a new multi-status object with no children.
- *
- * @param pluginId the unique identifier of the relevant plug-in
- * @param code the plug-in-specific status code
- * @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 MultiStatus(String pluginId, int code, String message, Throwable exception) {
- super(OK, pluginId, code, message, exception);
- children = new IStatus[0];
- }
-
- /**
- * Adds the given status to this multi-status.
- *
- * @param status the new child status
- */
- public void add(IStatus status) {
- Assert.isLegal(status != null);
- IStatus[] result = new IStatus[children.length + 1];
- System.arraycopy(children, 0, result, 0, children.length);
- result[result.length - 1] = status;
- children = result;
- int newSev = status.getSeverity();
- if (newSev > getSeverity()) {
- setSeverity(newSev);
- }
- }
-
- /**
- * Adds all of the children of the given status to this multi-status.
- * Does nothing if the given status has no children (which includes
- * the case where it is not a multi-status).
- *
- * @param status the status whose children are to be added to this one
- */
- public void addAll(IStatus status) {
- Assert.isLegal(status != null);
- IStatus[] statuses = status.getChildren();
- for (int i = 0; i < statuses.length; i++) {
- add(statuses[i]);
- }
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the corresponding method on <code>IStatus</code>.
- */
- public IStatus[] getChildren() {
- return children;
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the corresponding method on <code>IStatus</code>.
- */
- public boolean isMultiStatus() {
- return true;
- }
-
- /**
- * Merges the given status into this multi-status.
- * Equivalent to <code>add(status)</code> if the
- * given status is not a multi-status.
- * Equivalent to <code>addAll(status)</code> if the
- * given status is a multi-status.
- *
- * @param status the status to merge into this one
- * @see #add(IStatus)
- * @see #addAll(IStatus)
- */
- public void merge(IStatus status) {
- Assert.isLegal(status != null);
- if (!status.isMultiStatus()) {
- add(status);
- } else {
- addAll(status);
- }
- }
-
- /**
- * Returns a string representation of the status, suitable
- * for debugging purposes only.
- */
- public String toString() {
- StringBuffer buf = new StringBuffer(super.toString());
- buf.append(" children=["); //$NON-NLS-1$
- for (int i = 0; i < children.length; i++) {
- if (i != 0) {
- buf.append(" "); //$NON-NLS-1$
- }
- buf.append(children[i].toString());
- }
- buf.append("]"); //$NON-NLS-1$
- return buf.toString();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/NullProgressMonitor.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/NullProgressMonitor.java
deleted file mode 100644
index 6c54d47..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/NullProgressMonitor.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * A default progress monitor implementation suitable for
- * subclassing.
- * <p>
- * This implementation supports cancelation. The default
- * implementations of the other methods do nothing.
- * </p>
- */
-public class NullProgressMonitor implements IProgressMonitor {
-
- /**
- * Indicates whether cancel has been requested.
- */
- private boolean cancelled = false;
-
- /**
- * Constructs a new progress monitor.
- */
- public NullProgressMonitor() {
- super();
- }
-
- /**
- * This implementation does nothing.
- * Subclasses may override this method to do interesting
- * processing when a task begins.
- *
- * @see IProgressMonitor#beginTask(String, int)
- */
- public void beginTask(String name, int totalWork) {
- // do nothing
- }
-
- /**
- * This implementation does nothing.
- * Subclasses may override this method to do interesting
- * processing when a task is done.
- *
- * @see IProgressMonitor#done()
- */
- public void done() {
- // do nothing
- }
-
- /**
- * This implementation does nothing.
- * Subclasses may override this method.
- *
- * @see IProgressMonitor#internalWorked(double)
- */
- public void internalWorked(double work) {
- // do nothing
- }
-
- /**
- * This implementation returns the value of the internal
- * state variable set by <code>setCanceled</code>.
- * Subclasses which override this method should
- * override <code>setCanceled</code> as well.
- *
- * @see IProgressMonitor#isCanceled()
- * @see IProgressMonitor#setCanceled(boolean)
- */
- public boolean isCanceled() {
- return cancelled;
- }
-
- /**
- * This implementation sets the value of an internal state variable.
- * Subclasses which override this method should override
- * <code>isCanceled</code> as well.
- *
- * @see IProgressMonitor#isCanceled()
- * @see IProgressMonitor#setCanceled(boolean)
- */
- public void setCanceled(boolean cancelled) {
- this.cancelled = cancelled;
- }
-
- /**
- * This implementation does nothing.
- * Subclasses may override this method to do something
- * with the name of the task.
- *
- * @see IProgressMonitor#setTaskName(String)
- */
- public void setTaskName(String name) {
- // do nothing
- }
-
- /**
- * This implementation does nothing.
- * Subclasses may override this method to do interesting
- * processing when a subtask begins.
- *
- * @see IProgressMonitor#subTask(String)
- */
- public void subTask(String name) {
- // do nothing
- }
-
- /**
- * This implementation does nothing.
- * Subclasses may override this method to do interesting
- * processing when some work has been completed.
- *
- * @see IProgressMonitor#worked(int)
- */
- public void worked(int work) {
- // do nothing
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/OperationCanceledException.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/OperationCanceledException.java
deleted file mode 100644
index c013735..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/OperationCanceledException.java
+++ /dev/null
@@ -1,42 +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;
-
-/**
- * This exception is thrown to blow out of a long-running method
- * when the user cancels it.
- * <p>
- * This class is not intended to be subclassed by clients but
- * may be instantiated.
- * </p>
- */
-public final class OperationCanceledException extends RuntimeException {
- /**
- * All serializable objects should have a stable serialVersionUID
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Creates a new exception.
- */
- public OperationCanceledException() {
- super();
- }
-
- /**
- * Creates a new exception with the given message.
- *
- * @param message the message for the exception
- */
- public OperationCanceledException(String message) {
- super(message);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Path.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Path.java
deleted file mode 100644
index 22a25ec..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Path.java
+++ /dev/null
@@ -1,987 +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.File;
-import org.eclipse.core.internal.runtime.Assert;
-
-/**
- * The standard implementation of the <code>IPath</code> interface.
- * Paths are always maintained in canonicalized form. That is, parent
- * references (i.e., <code>../../</code>) and duplicate separators are
- * resolved. For example,
- * <pre> new Path("/a/b").append("../foo/bar")</pre>
- * will yield the path
- * <pre> /a/foo/bar</pre>
- * <p>
- * This class is not intended to be subclassed by clients but
- * may be instantiated.
- * </p>
- * @see IPath
- */
-public class Path implements IPath, Cloneable {
- /** masks for separator values */
- private static final int HAS_LEADING = 1;
- private static final int IS_UNC = 2;
- private static final int HAS_TRAILING = 4;
-
- private static final int ALL_SEPARATORS = HAS_LEADING | IS_UNC | HAS_TRAILING;
-
- /** Constant empty string value. */
- private static final String EMPTY_STRING = ""; //$NON-NLS-1$
-
- /** Constant value indicating no segments */
- private static final String[] NO_SEGMENTS = new String[0];
-
- /** Constant value containing the empty path with no device. */
- public static final Path EMPTY = new Path(EMPTY_STRING);
-
- /** Mask for all bits that are involved in the hash code */
- private static final int HASH_MASK = ~HAS_TRAILING;
-
-
- /** Constant root path string (<code>"/"</code>). */
- private static final String ROOT_STRING = "/"; //$NON-NLS-1$
-
- /** Constant value containing the root path with no device. */
- public static final Path ROOT = new Path(ROOT_STRING);
-
- /** Constant value indicating if the current platform is Windows */
- private static final boolean WINDOWS = java.io.File.separatorChar == '\\';
-
- /** The device id string. May be null if there is no device. */
- private String device = null;
-
- //Private implementation note: the segments and separators
- //arrays are never modified, so that they can be shared between
- //path instances
-
- /** The path segments */
- private String[] segments;
-
- /** flags indicating separators (has leading, is UNC, has trailing) */
- private int separators;
-
- /**
- * Constructs a new path from the given string path.
- * The string path must represent a valid file system path
- * on the local file system.
- * The path is canonicalized and double slashes are removed
- * except at the beginning. (to handle UNC paths). All forward
- * slashes ('/') are treated as segment delimiters, and any
- * segment and device delimiters for the local file system are
- * also respected.
- *
- * @param pathString the portable string path
- * @see IPath#toPortableString()
- * @since 3.1
- */
- public static IPath fromOSString(String pathString) {
- return new Path(pathString);
- }
-
- /**
- * Constructs a new path from the given path string.
- * The path string must have been produced by a previous
- * call to <code>IPath.toPortableString</code>.
- *
- * @param pathString the portable path string
- * @see IPath#toPortableString()
- * @since 3.1
- */
- public static IPath fromPortableString(String pathString) {
- int firstMatch = pathString.indexOf(DEVICE_SEPARATOR) +1;
- //no extra work required if no device characters
- if (firstMatch <= 0)
- return new Path().initialize(null, pathString);
- //if we find a single colon, then the path has a device
- String devicePart = null;
- int pathLength = pathString.length();
- if (firstMatch == pathLength || pathString.charAt(firstMatch) != DEVICE_SEPARATOR) {
- devicePart = pathString.substring(0, firstMatch);
- pathString = pathString.substring(firstMatch, pathLength);
- }
- //optimize for no colon literals
- if (pathString.indexOf(DEVICE_SEPARATOR) == -1)
- return new Path().initialize(devicePart, pathString);
- //contract colon literals
- char[] chars = pathString.toCharArray();
- int readOffset = 0, writeOffset = 0, length = chars.length;
- while (readOffset < length) {
- if (chars[readOffset] == DEVICE_SEPARATOR)
- if (++readOffset >= length)
- break;
- chars[writeOffset++] = chars[readOffset++];
- }
- return new Path().initialize(devicePart, new String(chars, 0, writeOffset));
- }
-
- /* (Intentionally not included in javadoc)
- * Private constructor.
- */
- private Path() {
- // not allowed
- }
-
- /**
- * Constructs a new path from the given string path.
- * The string path must represent a valid file system path
- * on the local file system.
- * The path is canonicalized and double slashes are removed
- * except at the beginning. (to handle UNC paths). All forward
- * slashes ('/') are treated as segment delimiters, and any
- * segment and device delimiters for the local file system are
- * also respected (such as colon (':') and backslash ('\') on some file systems).
- *
- * @param fullPath the string path
- * @see #isValidPath(String)
- */
- public Path(String fullPath) {
- String devicePart = null;
- if (WINDOWS) {
- //convert backslash to forward slash
- fullPath = fullPath.indexOf('\\') == -1 ? fullPath : fullPath.replace('\\', SEPARATOR);
- //extract device
- int i = fullPath.indexOf(DEVICE_SEPARATOR);
- if (i != -1) {
- //remove leading slash from device part to handle output of URL.getFile()
- int start = fullPath.charAt(0) == SEPARATOR ? 1 : 0;
- devicePart = fullPath.substring(start, i + 1);
- fullPath = fullPath.substring(i + 1, fullPath.length());
- }
- }
- initialize(devicePart, fullPath);
- }
-
- /**
- * Constructs a new path from the given device id and string path.
- * The given string path must be valid.
- * The path is canonicalized and double slashes are removed except
- * at the beginning (to handle UNC paths). All forward
- * slashes ('/') are treated as segment delimiters, and any
- * segment delimiters for the local file system are
- * also respected (such as backslash ('\') on some file systems).
- *
- * @param device the device id
- * @param path the string path
- * @see #isValidPath(String)
- * @see #setDevice(String)
- */
- public Path(String device, String path) {
- if (WINDOWS) {
- //convert backslash to forward slash
- path = path.indexOf('\\') == -1 ? path : path.replace('\\', SEPARATOR);
- }
- initialize(device, path);
- }
-
- /* (Intentionally not included in javadoc)
- * Private constructor.
- */
- private Path(String device, String[] segments, int _separators) {
- // no segment validations are done for performance reasons
- this.segments = segments;
- this.device = device;
- //hash code is cached in all but the bottom three bits of the separators field
- this.separators = (computeHashCode() << 3) | (_separators & ALL_SEPARATORS);
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#addFileExtension
- */
- public IPath addFileExtension(String extension) {
- if (isRoot() || isEmpty() || hasTrailingSeparator())
- return this;
- int len = segments.length;
- String[] newSegments = new String[len];
- System.arraycopy(segments, 0, newSegments, 0, len - 1);
- newSegments[len - 1] = segments[len - 1] + '.' + extension;
- return new Path(device, newSegments, separators);
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#addTrailingSeparator
- */
- public IPath addTrailingSeparator() {
- if (hasTrailingSeparator() || isRoot()) {
- return this;
- }
- //XXX workaround, see 1GIGQ9V
- if (isEmpty()) {
- return new Path(device, segments, HAS_LEADING);
- }
- return new Path(device, segments, separators | HAS_TRAILING);
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#append(IPath)
- */
- public IPath append(IPath tail) {
- //optimize some easy cases
- if (tail == null || tail.segmentCount() == 0)
- return this;
- if (this.isEmpty())
- return tail.setDevice(device).makeRelative();
- if (this.isRoot())
- return tail.setDevice(device).makeAbsolute();
-
- //concatenate the two segment arrays
- int myLen = segments.length;
- int tailLen = tail.segmentCount();
- String[] newSegments = new String[myLen + tailLen];
- System.arraycopy(segments, 0, newSegments, 0, myLen);
- for (int i = 0; i < tailLen; i++) {
- newSegments[myLen + i] = tail.segment(i);
- }
- //use my leading separators and the tail's trailing separator
- Path result = new Path(device, newSegments, (separators & (HAS_LEADING | IS_UNC)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0));
- String tailFirstSegment = newSegments[myLen];
- if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$
- result.canonicalize();
- }
- return result;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#append(java.lang.String)
- */
- public IPath append(String tail) {
- //optimize addition of a single segment
- if (tail.indexOf(SEPARATOR) == -1 && tail.indexOf("\\") == -1 && tail.indexOf(DEVICE_SEPARATOR) == -1) { //$NON-NLS-1$
- int tailLength = tail.length();
- if (tailLength < 3) {
- //some special cases
- if (tailLength == 0 || ".".equals(tail)) { //$NON-NLS-1$
- return this;
- }
- if ("..".equals(tail)) //$NON-NLS-1$
- return removeLastSegments(1);
- }
- //just add the segment
- int myLen = segments.length;
- String[] newSegments = new String[myLen + 1];
- System.arraycopy(segments, 0, newSegments, 0, myLen);
- newSegments[myLen] = tail;
- return new Path(device, newSegments, separators & ~HAS_TRAILING);
- }
- //go with easy implementation
- return append(new Path(tail));
- }
-
- /**
- * Destructively converts this path to its canonical form.
- * <p>
- * In its canonical form, a path does not have any
- * "." segments, and parent references ("..") are collapsed
- * where possible.
- * </p>
- * @return true if the path was modified, and false otherwise.
- */
- private boolean canonicalize() {
- //look for segments that need canonicalizing
- for (int i = 0, max = segments.length; i < max; i++) {
- String segment = segments[i];
- if (segment.charAt(0) == '.' && (segment.equals("..") || segment.equals("."))) { //$NON-NLS-1$ //$NON-NLS-2$
- //path needs to be canonicalized
- collapseParentReferences();
- //paths of length 0 have no trailing separator
- if (segments.length == 0)
- separators &= (HAS_LEADING | IS_UNC);
- //recompute hash because canonicalize affects hash
- separators = (separators & ALL_SEPARATORS) | (computeHashCode() << 3);
- return true;
- }
- }
- return false;
- }
-
- /* (Intentionally not included in javadoc)
- * Clones this object.
- */
- public Object clone() {
- try {
- return super.clone();
- } catch (CloneNotSupportedException e) {
- return null;
- }
- }
-
- /**
- * Destructively removes all occurrences of ".." segments from this path.
- */
- private void collapseParentReferences() {
- int segmentCount = segments.length;
- String[] stack = new String[segmentCount];
- int stackPointer = 0;
- for (int i = 0; i < segmentCount; i++) {
- String segment = segments[i];
- if (segment.equals("..")) { //$NON-NLS-1$
- if (stackPointer == 0) {
- // if the stack is empty we are going out of our scope
- // so we need to accumulate segments. But only if the original
- // path is relative. If it is absolute then we can't go any higher than
- // root so simply toss the .. references.
- if (!isAbsolute())
- stack[stackPointer++] = segment; //stack push
- } else {
- // if the top is '..' then we are accumulating segments so don't pop
- if ("..".equals(stack[stackPointer - 1])) //$NON-NLS-1$
- stack[stackPointer++] = ".."; //$NON-NLS-1$
- else
- stackPointer--;
- //stack pop
- }
- //collapse current references
- } else if (!segment.equals(".") || (i == 0 && !isAbsolute())) //$NON-NLS-1$
- stack[stackPointer++] = segment; //stack push
- }
- //if the number of segments hasn't changed, then no modification needed
- if (stackPointer == segmentCount)
- return;
- //build the new segment array backwards by popping the stack
- String[] newSegments = new String[stackPointer];
- System.arraycopy(stack, 0, newSegments, 0, stackPointer);
- this.segments = newSegments;
- }
-
- /**
- * Removes duplicate slashes from the given path, with the exception
- * of leading double slash which represents a UNC path.
- */
- private String collapseSlashes(String path) {
- int length = path.length();
- // if the path is only 0, 1 or 2 chars long then it could not possibly have illegal
- // duplicate slashes.
- if (length < 3)
- return path;
- // check for an occurrence of // in the path. Start at index 1 to ensure we skip leading UNC //
- // If there are no // then there is nothing to collapse so just return.
- if (path.indexOf("//", 1) == -1) //$NON-NLS-1$
- return path;
- // We found an occurrence of // in the path so do the slow collapse.
- char[] result = new char[path.length()];
- int count = 0;
- boolean hasPrevious = false;
- char[] characters = path.toCharArray();
- for (int index = 0; index < characters.length; index++) {
- char c = characters[index];
- if (c == SEPARATOR) {
- if (hasPrevious) {
- // skip double slashes, except for beginning of UNC.
- // note that a UNC path can't have a device.
- if (device == null && index == 1) {
- result[count] = c;
- count++;
- }
- } else {
- hasPrevious = true;
- result[count] = c;
- count++;
- }
- } else {
- hasPrevious = false;
- result[count] = c;
- count++;
- }
- }
- return new String(result, 0, count);
- }
-
- /* (Intentionally not included in javadoc)
- * Computes the hash code for this object.
- */
- private int computeHashCode() {
- int hash = device == null ? 17 : device.hashCode();
- int segmentCount = segments.length;
- for (int i = 0; i < segmentCount; i++) {
- //this function tends to given a fairly even distribution
- hash = hash * 37 + segments[i].hashCode();
- }
- return hash;
- }
-
- /* (Intentionally not included in javadoc)
- * Returns the size of the string that will be created by toString or toOSString.
- */
- private int computeLength() {
- int length = 0;
- if (device != null)
- length += device.length();
- if ((separators & HAS_LEADING) != 0)
- length++;
- if ((separators & IS_UNC) != 0)
- length++;
- //add the segment lengths
- int max = segments.length;
- if (max > 0) {
- for (int i = 0; i < max; i++) {
- length += segments[i].length();
- }
- //add the separator lengths
- length += max - 1;
- }
- if ((separators & HAS_TRAILING) != 0)
- length++;
- return length;
- }
-
- /* (Intentionally not included in javadoc)
- * Returns the number of segments in the given path
- */
- private int computeSegmentCount(String path) {
- int len = path.length();
- if (len == 0 || (len == 1 && path.charAt(0) == SEPARATOR)) {
- return 0;
- }
- int count = 1;
- int prev = -1;
- int i;
- while ((i = path.indexOf(SEPARATOR, prev + 1)) != -1) {
- if (i != prev + 1 && i != len) {
- ++count;
- }
- prev = i;
- }
- if (path.charAt(len - 1) == SEPARATOR) {
- --count;
- }
- return count;
- }
-
- /**
- * Computes the segment array for the given canonicalized path.
- */
- private String[] computeSegments(String path) {
- // performance sensitive --- avoid creating garbage
- int segmentCount = computeSegmentCount(path);
- if (segmentCount == 0)
- return NO_SEGMENTS;
- String[] newSegments = new String[segmentCount];
- int len = path.length();
- // check for initial slash
- int firstPosition = (path.charAt(0) == SEPARATOR) ? 1 : 0;
- // check for UNC
- if (firstPosition == 1 && len > 1 && (path.charAt(1) == SEPARATOR))
- firstPosition = 2;
- int lastPosition = (path.charAt(len - 1) != SEPARATOR) ? len - 1 : len - 2;
- // for non-empty paths, the number of segments is
- // the number of slashes plus 1, ignoring any leading
- // and trailing slashes
- int next = firstPosition;
- for (int i = 0; i < segmentCount; i++) {
- int start = next;
- int end = path.indexOf(SEPARATOR, next);
- if (end == -1) {
- newSegments[i] = path.substring(start, lastPosition + 1);
- } else {
- newSegments[i] = path.substring(start, end);
- }
- next = end + 1;
- }
- return newSegments;
- }
- /**
- * Returns the platform-neutral encoding of the given segment onto
- * the given string buffer. This escapes literal colon characters with double colons.
- */
- private void encodeSegment(String string, StringBuffer buf) {
- int len = string.length();
- for (int i = 0; i < len; i++) {
- char c = string.charAt(i);
- buf.append(c);
- if (c == DEVICE_SEPARATOR)
- buf.append(DEVICE_SEPARATOR);
- }
- }
-
- /* (Intentionally not included in javadoc)
- * Compares objects for equality.
- */
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof Path))
- return false;
- Path target = (Path) obj;
- //check leading separators and hash code
- if ((separators & HASH_MASK) != (target.separators & HASH_MASK))
- return false;
- String[] targetSegments = target.segments;
- int i = segments.length;
- //check segment count
- if (i != targetSegments.length)
- return false;
- //check segments in reverse order - later segments more likely to differ
- while (--i >= 0)
- if (!segments[i].equals(targetSegments[i]))
- return false;
- //check device last (least likely to differ)
- return device == target.device || (device != null && device.equals(target.device));
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#getDevice
- */
- public String getDevice() {
- return device;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#getFileExtension
- */
- public String getFileExtension() {
- if (hasTrailingSeparator()) {
- return null;
- }
- String lastSegment = lastSegment();
- if (lastSegment == null) {
- return null;
- }
- int index = lastSegment.lastIndexOf('.');
- if (index == -1) {
- return null;
- }
- return lastSegment.substring(index + 1);
- }
-
- /* (Intentionally not included in javadoc)
- * Computes the hash code for this object.
- */
- public int hashCode() {
- return separators & HASH_MASK;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#hasTrailingSeparator2
- */
- public boolean hasTrailingSeparator() {
- return (separators & HAS_TRAILING) != 0;
- }
-
- /*
- * Initialize the current path with the given string.
- */
- private IPath initialize(String deviceString, String path) {
- Assert.isNotNull(path);
- this.device = deviceString;
-
- path = collapseSlashes(path);
- int len = path.length();
-
- //compute the separators array
- if (len < 2) {
- if (len == 1 && path.charAt(0) == SEPARATOR) {
- this.separators = HAS_LEADING;
- } else {
- this.separators = 0;
- }
- } else {
- boolean hasLeading = path.charAt(0) == SEPARATOR;
- boolean isUNC = hasLeading && path.charAt(1) == SEPARATOR;
- //UNC path of length two has no trailing separator
- boolean hasTrailing = !(isUNC && len == 2) && path.charAt(len - 1) == SEPARATOR;
- separators = hasLeading ? HAS_LEADING : 0;
- if (isUNC)
- separators |= IS_UNC;
- if (hasTrailing)
- separators |= HAS_TRAILING;
- }
- //compute segments and ensure canonical form
- segments = computeSegments(path);
- if (!canonicalize()) {
- //compute hash now because canonicalize didn't need to do it
- separators = (separators & ALL_SEPARATORS) | (computeHashCode() << 3);
- }
- return this;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#isAbsolute
- */
- public boolean isAbsolute() {
- //it's absolute if it has a leading separator
- return (separators & HAS_LEADING) != 0;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#isEmpty
- */
- public boolean isEmpty() {
- //true if no segments and no leading prefix
- return segments.length == 0 && ((separators & ALL_SEPARATORS) != HAS_LEADING);
-
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#isPrefixOf
- */
- public boolean isPrefixOf(IPath anotherPath) {
- if (device == null) {
- if (anotherPath.getDevice() != null) {
- return false;
- }
- } else {
- if (!device.equalsIgnoreCase(anotherPath.getDevice())) {
- return false;
- }
- }
- if (isEmpty() || (isRoot() && anotherPath.isAbsolute())) {
- return true;
- }
- int len = segments.length;
- if (len > anotherPath.segmentCount()) {
- return false;
- }
- for (int i = 0; i < len; i++) {
- if (!segments[i].equals(anotherPath.segment(i)))
- return false;
- }
- return true;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#isRoot
- */
- public boolean isRoot() {
- //must have no segments, a leading separator, and not be a UNC path.
- return this == ROOT || (segments.length == 0 && ((separators & ALL_SEPARATORS) == HAS_LEADING));
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#isUNC
- */
- public boolean isUNC() {
- if (device != null)
- return false;
- return (separators & IS_UNC) != 0;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#isValidPath(String)
- */
- public boolean isValidPath(String path) {
- Path test = new Path(path);
- for (int i = 0, max = test.segmentCount(); i < max; i++)
- if (!isValidSegment(test.segment(i)))
- return false;
- return true;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#isValidSegment(String)
- */
- public boolean isValidSegment(String segment) {
- int size = segment.length();
- if (size == 0)
- return false;
- for (int i = 0; i < size; i++) {
- char c = segment.charAt(i);
- if (c == '/')
- return false;
- if (WINDOWS && (c == '\\' || c == ':'))
- return false;
- }
- return true;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#lastSegment()
- */
- public String lastSegment() {
- int len = segments.length;
- return len == 0 ? null : segments[len - 1];
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#makeAbsolute()
- */
- public IPath makeAbsolute() {
- if (isAbsolute()) {
- return this;
- }
- Path result = new Path(device, segments, separators | HAS_LEADING);
- //may need canonicalizing if it has leading ".." or "." segments
- if (result.segmentCount() > 0) {
- String first = result.segment(0);
- if (first.equals("..") || first.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$
- result.canonicalize();
- }
- }
- return result;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#makeRelative()
- */
- public IPath makeRelative() {
- if (!isAbsolute()) {
- return this;
- }
- return new Path(device, segments, separators & HAS_TRAILING);
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#makeUNC(boolean)
- */
- public IPath makeUNC(boolean toUNC) {
- // if we are already in the right form then just return
- if (!(toUNC ^ isUNC()))
- return this;
-
- int newSeparators = this.separators;
- if (toUNC) {
- newSeparators |= HAS_LEADING | IS_UNC;
- } else {
- //mask out the UNC bit
- newSeparators &= HAS_LEADING | HAS_TRAILING;
- }
- return new Path(toUNC ? null : device, segments, newSeparators);
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#matchingFirstSegments(IPath)
- */
- public int matchingFirstSegments(IPath anotherPath) {
- Assert.isNotNull(anotherPath);
- int anotherPathLen = anotherPath.segmentCount();
- int max = Math.min(segments.length, anotherPathLen);
- int count = 0;
- for (int i = 0; i < max; i++) {
- if (!segments[i].equals(anotherPath.segment(i))) {
- return count;
- }
- count++;
- }
- return count;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#removeFileExtension()
- */
- public IPath removeFileExtension() {
- String extension = getFileExtension();
- if (extension == null || extension.equals("")) { //$NON-NLS-1$
- return this;
- }
- String lastSegment = lastSegment();
- int index = lastSegment.lastIndexOf(extension) - 1;
- return removeLastSegments(1).append(lastSegment.substring(0, index));
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#removeFirstSegments(int)
- */
- public IPath removeFirstSegments(int count) {
- if (count == 0)
- return this;
- if (count >= segments.length) {
- return new Path(device, NO_SEGMENTS, 0);
- }
- Assert.isLegal(count > 0);
- int newSize = segments.length - count;
- String[] newSegments = new String[newSize];
- System.arraycopy(this.segments, count, newSegments, 0, newSize);
-
- //result is always a relative path
- return new Path(device, newSegments, separators & HAS_TRAILING);
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#removeLastSegments(int)
- */
- public IPath removeLastSegments(int count) {
- if (count == 0)
- return this;
- if (count >= segments.length) {
- //result will have no trailing separator
- return new Path(device, NO_SEGMENTS, separators & (HAS_LEADING | IS_UNC));
- }
- Assert.isLegal(count > 0);
- int newSize = segments.length - count;
- String[] newSegments = new String[newSize];
- System.arraycopy(this.segments, 0, newSegments, 0, newSize);
- return new Path(device, newSegments, separators);
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#removeTrailingSeparator()
- */
- public IPath removeTrailingSeparator() {
- if (!hasTrailingSeparator()) {
- return this;
- }
- return new Path(device, segments, separators & (HAS_LEADING | IS_UNC));
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#segment(int)
- */
- public String segment(int index) {
- if (index >= segments.length)
- return null;
- return segments[index];
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#segmentCount()
- */
- public int segmentCount() {
- return segments.length;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#segments()
- */
- public String[] segments() {
- String[] segmentCopy = new String[segments.length];
- System.arraycopy(segments, 0, segmentCopy, 0, segments.length);
- return segmentCopy;
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#setDevice(String)
- */
- public IPath setDevice(String value) {
- if (value != null) {
- Assert.isTrue(value.indexOf(IPath.DEVICE_SEPARATOR) == (value.length() - 1), "Last character should be the device separator"); //$NON-NLS-1$
- }
- //return the receiver if the device is the same
- if (value == device || (value != null && value.equals(device)))
- return this;
-
- return new Path(value, segments, separators);
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#toFile()
- */
- public File toFile() {
- return new File(toOSString());
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#toOSString()
- */
- public String toOSString() {
- //Note that this method is identical to toString except
- //it uses the OS file separator instead of the path separator
- int resultSize = computeLength();
- if (resultSize <= 0)
- return EMPTY_STRING;
- char FILE_SEPARATOR = File.separatorChar;
- char[] result = new char[resultSize];
- int offset = 0;
- if (device != null) {
- int size = device.length();
- device.getChars(0, size, result, offset);
- offset += size;
- }
- if ((separators & HAS_LEADING) != 0)
- result[offset++] = FILE_SEPARATOR;
- if ((separators & IS_UNC) != 0)
- result[offset++] = FILE_SEPARATOR;
- int len = segments.length - 1;
- if (len >= 0) {
- //append all but the last segment, with separators
- for (int i = 0; i < len; i++) {
- int size = segments[i].length();
- segments[i].getChars(0, size, result, offset);
- offset += size;
- result[offset++] = FILE_SEPARATOR;
- }
- //append the last segment
- int size = segments[len].length();
- segments[len].getChars(0, size, result, offset);
- offset += size;
- }
- if ((separators & HAS_TRAILING) != 0)
- result[offset++] = FILE_SEPARATOR;
- return new String(result);
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#toPortableString()
- */
- public String toPortableString() {
- int resultSize = computeLength();
- if (resultSize <= 0)
- return EMPTY_STRING;
- StringBuffer result = new StringBuffer(resultSize);
- if (device != null)
- result.append(device);
- if ((separators & HAS_LEADING) != 0)
- result.append(SEPARATOR);
- if ((separators & IS_UNC) != 0)
- result.append(SEPARATOR);
- int len = segments.length;
- //append all segments with separators
- for (int i = 0; i < len; i++) {
- if (segments[i].indexOf(DEVICE_SEPARATOR) >= 0)
- encodeSegment(segments[i], result);
- else
- result.append(segments[i]);
- if (i < len-1 || (separators & HAS_TRAILING) != 0)
- result.append(SEPARATOR);
- }
- return result.toString();
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#toString()
- */
- public String toString() {
- int resultSize = computeLength();
- if (resultSize <= 0)
- return EMPTY_STRING;
- char[] result = new char[resultSize];
- int offset = 0;
- if (device != null) {
- int size = device.length();
- device.getChars(0, size, result, offset);
- offset += size;
- }
- if ((separators & HAS_LEADING) != 0)
- result[offset++] = SEPARATOR;
- if ((separators & IS_UNC) != 0)
- result[offset++] = SEPARATOR;
- int len = segments.length - 1;
- if (len >= 0) {
- //append all but the last segment, with separators
- for (int i = 0; i < len; i++) {
- int size = segments[i].length();
- segments[i].getChars(0, size, result, offset);
- offset += size;
- result[offset++] = SEPARATOR;
- }
- //append the last segment
- int size = segments[len].length();
- segments[len].getChars(0, size, result, offset);
- offset += size;
- }
- if ((separators & HAS_TRAILING) != 0)
- result[offset++] = SEPARATOR;
- return new String(result);
- }
-
- /* (Intentionally not included in javadoc)
- * @see IPath#uptoSegment(int)
- */
- public IPath uptoSegment(int count) {
- if (count == 0)
- return new Path(device, NO_SEGMENTS, separators & (HAS_LEADING | IS_UNC));
- if (count >= segments.length)
- return this;
- Assert.isTrue(count > 0, "Invalid parameter to Path.uptoSegment"); //$NON-NLS-1$
- String[] newSegments = new String[count];
- System.arraycopy(segments, 0, newSegments, 0, count);
- return new Path(device, newSegments, separators);
- }
-}
\ No newline at end of file
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 b71d6e6..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Platform.java
+++ /dev/null
@@ -1,1378 +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.IOException;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.*;
-import org.eclipse.core.internal.runtime.*;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.core.runtime.preferences.IPreferencesService;
-import org.eclipse.osgi.service.datalocation.Location;
-import org.eclipse.osgi.service.resolver.PlatformAdmin;
-import org.osgi.framework.Bundle;
-
-/**
- * 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>
- */
-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"; //$NON-NLS-1$
-
- /**
- * 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 "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>
- */
- public static void addAuthorizationInfo(URL serverUrl, String realm, String authScheme, Map info) throws CoreException {
- InternalPlatform.getDefault().addAuthorizationInfo(serverUrl, realm, authScheme, info);
- }
-
- /**
- * 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)
- */
- 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>
- */
- public static void addProtectionSpace(URL resourceUrl, String realm) throws CoreException {
- InternalPlatform.getDefault().addProtectionSpace(resourceUrl, realm);
- }
-
- /**
- * 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)
- */
- public static URL asLocalURL(URL url) throws IOException {
- return InternalPlatform.getDefault().asLocalURL(url);
- }
-
- /**
- * Takes down the splash screen if one was put up.
- */
- 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>
- */
- public static void flushAuthorizationInfo(URL serverUrl, String realm, String authScheme) throws CoreException {
- InternalPlatform.getDefault().flushAuthorizationInfo(serverUrl, realm, authScheme);
- }
-
- /**
- * Returns the adapter manager used for extending
- * <code>IAdaptable</code> objects.
- *
- * @return the adapter manager for this platform
- * @see IAdapterManager
- */
- 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
- */
- public static Map getAuthorizationInfo(URL serverUrl, String realm, String authScheme) {
- return InternalPlatform.getDefault().getAuthorizationInfo(serverUrl, realm, authScheme);
- }
-
- /**
- * 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>.
- *
- * @return the command line used to start the platform
- */
- public static String[] getCommandLineArgs() {
- return InternalPlatform.getDefault().getCommandLineArgs();
- }
-
- /**
- * Returns the content type manager.
- *
- * @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>
- *
- * @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>
- *
- * @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.
- */
- 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
- */
- 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
- */
- public static String getProtectionSpace(URL resourceUrl) {
- return InternalPlatform.getDefault().getProtectionSpace(resourceUrl);
- }
-
- /**
- * 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)
- */
- 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)
- */
- public static URL resolve(URL url) throws IOException {
- return InternalPlatform.getDefault().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
- */
- public static void run(ISafeRunnable runnable) {
- InternalPlatform.getDefault().run(runnable);
- }
-
- /**
- * Returns the platform job manager.
- *
- * @return the platform's job manager
- * @since 3.0
- */
- public static IJobManager getJobManager() {
- return InternalPlatform.getDefault().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
- */
- public static URL find(Bundle bundle, IPath path) {
- return FindSupport.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
- */
- public static URL find(Bundle bundle, IPath path, Map override) {
- return FindSupport.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
- */
- 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)
- *
- * @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
- */
- 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
- */
- 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
- */
- 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
- */
- 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>.
- *
- * @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>.
- *
- * @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.
- *
- * @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.
- *
- * @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
- */
- 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>
- *
- * @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" = "osgi.instance.area".
- *</p>
- * @return the location of the platform's instance data area or <code>null</code> if none
- * @since 3.0
- */
- public static Location getInstanceLocation() {
- return InternalPlatform.getDefault().getInstanceLocation();
- }
-
- /**
- * Returns the currently registered bundle group providers
- * @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.
- *
- * @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
- */
- public static IProduct getProduct() {
- return InternalPlatform.getDefault().getProduct();
- }
-
- /**
- * Registers the given bundle group provider with the platform
- * @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
- * @param provider a provider to de-register
- * @since 3.0
- */
- 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" = "osgi.configuration.area".
- *</p>
- * @return the location of the platform's configuration data area or <code>null</code> if none
- * @since 3.0
- */
- 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" = "osgi.user.area".
- *</p>
- * @return the location of the platform's user data area or <code>null</code> if none
- * @since 3.0
- */
- 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" = "osgi.install.area".
- *</p>
- * @return the location of the platform's installation area or <code>null</code> if none
- * @since 3.0
- */
- public static Location getInstallLocation() {
- return InternalPlatform.getDefault().getInstallLocation();
- }
-
- /**
- * Checks if the specified bundle is a fragment bundle.
- *
- * @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.
- *
- * @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.
- *
- * @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 resolved 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.
- *
- * @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 resolved Bundles with the specified name that match the
- * specified version and match rule, or <tt>null</tt> if no resolved 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.
- *
- * @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
- */
- 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
- */
- 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
- */
- 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
- */
- 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.
- *
- * @return whether or not the platform is running in debug mode
- * @since 3.0
- */
- public static boolean inDebugMode() {
- return System.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.
- *
- * @return whether or not the platform is running in development mode
- * @since 3.0
- */
- public static boolean inDevelopmentMode() {
- return System.getProperty("osgi.dev") != null; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/PlatformObject.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/PlatformObject.java
deleted file mode 100644
index bc8570c..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/PlatformObject.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import org.eclipse.core.internal.runtime.InternalPlatform;
-
-/**
- * An abstract superclass implementing the <code>IAdaptable</code>
- * interface. <code>getAdapter</code> invocations are directed
- * to the platform's adapter manager.
- * <p>
- * Note: In situations where it would be awkward to subclass this
- * class, the same affect can be achieved simply by implementing
- * the <code>IAdaptable</code> interface and explicitly forwarding
- * the <code>getAdapter</code> request to the platform's
- * adapter manager. The method would look like:
- * <pre>
- * public Object getAdapter(Class adapter) {
- * return Platform.getAdapterManager().getAdapter(this, adapter);
- * }
- * </pre>
- * </p>
- * <p>
- * Clients may subclass.
- * </p>
- *
- * @see Platform#getAdapterManager()
- * @see IAdaptable
- */
-public abstract class PlatformObject implements IAdaptable {
- /**
- * Constructs a new platform object.
- */
- public PlatformObject() {
- super();
- }
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found.
- * <p>
- * This implementation of the method declared by <code>IAdaptable</code>
- * passes the request along to the platform's adapter manager; roughly
- * <code>Platform.getAdapterManager().getAdapter(this, adapter)</code>.
- * Subclasses may override this method (however, if they do so, they
- * should invoke the method on their superclass to ensure that the
- * Platform's adapter manager is consulted).
- * </p>
- *
- * @param adapter the class to adapt to
- * @return the adapted object or <code>null</code>
- * @see IAdaptable#getAdapter(Class)
- * @see Platform#getAdapterManager()
- */
- public Object getAdapter(Class adapter) {
- return InternalPlatform.getDefault().getAdapterManager().getAdapter(this, adapter);
- }
-}
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 d04ba6b..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Plugin.java
+++ /dev/null
@@ -1,720 +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.*;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.*;
-import org.eclipse.core.internal.preferences.PreferenceForwarder;
-import org.eclipse.core.internal.runtime.*;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.*;
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * 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>
- */
-public abstract class Plugin implements BundleActivator {
-
- /**
- * String constant used for the default scope name for legacy
- * Eclipse plug-in preferences.
- *
- * @since 3.0
- */
- public static final String PLUGIN_PREFERENCE_SCOPE = InstanceScope.SCOPE;
-
- /**
- * 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 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_BASE_NAME = "preferences"; //$NON-NLS-1$
- 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 PreferenceForwarder 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 {
- if ((bundle.getState() & (Bundle.STARTING | Bundle.ACTIVE | Bundle.STOPPING)) == 0)
- bundle.start();
- } 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>
- */
- public final URL find(IPath path) {
- return FindSupport.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>
- */
- public final URL find(IPath path, Map override) {
- return FindSupport.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
- */
- 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
- */
- 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
- */
- public final Preferences getPluginPreferences() {
- if (preferences != null) {
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Plugin preferences already loaded for: " + bundle.getSymbolicName()); //$NON-NLS-1$
- return preferences;
- }
-
- if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
- Policy.debug("Loading preferences for plugin: " + bundle.getSymbolicName()); //$NON-NLS-1$
- preferences = new PreferenceForwarder(this, bundle.getSymbolicName());
- 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
- */
- 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();
- try {
- preferences.flush();
- } catch (BackingStoreException e) {
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, Messages.preferences_saveProblems, e);
- InternalPlatform.getDefault().log(status);
- }
- }
-
- /**
- * 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
- */
- 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)
- */
- public final InputStream openStream(IPath file) throws IOException {
- return FindSupport.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 platform searches for the correct localized version
- * of the specified file using the users current locale, and Java
- * naming convention for localized resource files (locale suffix appended
- * to the specified file extension).
- * <p>
- * The caller must close the returned stream when done.
- * </p>
- *
- * @param file path relative to plug-in installation location
- * @param localized <code>true</code> for the localized version
- * of the file, and <code>false</code> for the file exactly
- * as specified
- * @return an input stream
- * @exception IOException if the given path cannot be found in this plug-in
- */
- public final InputStream openStream(IPath file, boolean localized) throws IOException {
- return FindSupport.openStream(bundle, file, localized);
- }
-
- /**
- * 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
- */
- 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>
- * 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>
- * <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>
- * <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,
- * as this method will be invoked in the event of a failure during startup.
- * </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>
- * <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/PluginVersionIdentifier.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/PluginVersionIdentifier.java
deleted file mode 100644
index dc104e8..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/PluginVersionIdentifier.java
+++ /dev/null
@@ -1,482 +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.util.StringTokenizer;
-import java.util.Vector;
-import org.eclipse.core.internal.runtime.Assert;
-import org.eclipse.core.internal.runtime.Messages;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * <p>
- * Version identifier for a plug-in. In its string representation,
- * it consists of up to 4 tokens separated by a decimal point.
- * The first 3 tokens are positive integer numbers, the last token
- * is an uninterpreted string (no whitespace characters allowed).
- * For example, the following are valid version identifiers
- * (as strings):
- * <ul>
- * <li><code>0.0.0</code></li>
- * <li><code>1.0.127564</code></li>
- * <li><code>3.7.2.build-127J</code></li>
- * <li><code>1.9</code> (interpreted as <code>1.9.0</code>)</li>
- * <li><code>3</code> (interpreted as <code>3.0.0</code>)</li>
- * </ul>
- * </p>
- * <p>
- * The version identifier can be decomposed into a major, minor,
- * service level component and qualifier components. A difference
- * in the major component is interpreted as an incompatible version
- * change. A difference in the minor (and not the major) component
- * is interpreted as a compatible version change. The service
- * level component is interpreted as a cumulative and compatible
- * service update of the minor version component. The qualifier is
- * not interpreted, other than in version comparisons. The
- * qualifiers are compared using lexicographical string comparison.
- * </p>
- * <p>
- * Version identifiers can be matched as perfectly equal, equivalent,
- * compatible or greaterOrEqual.
- * </p>
- * <p>
- * Clients may instantiate; not intended to be subclassed by clients.
- * </p>
- * @see java.lang.String#compareTo(java.lang.String)
- */
-public final class PluginVersionIdentifier {
-
- private int major = 0;
- private int minor = 0;
- private int service = 0;
- private String qualifier = ""; //$NON-NLS-1$
-
- private static final String SEPARATOR = "."; //$NON-NLS-1$
-
- /**
- * Creates a plug-in version identifier from its components.
- *
- * @param major major component of the version identifier
- * @param minor minor component of the version identifier
- * @param service service update component of the version identifier
- */
- public PluginVersionIdentifier(int major, int minor, int service) {
- this(major, minor, service, null);
- }
-
- /**
- * Creates a plug-in version identifier from its components.
- *
- * @param major major component of the version identifier
- * @param minor minor component of the version identifier
- * @param service service update component of the version identifier
- * @param qualifier qualifier component of the version identifier.
- * Qualifier characters that are not a letter or a digit are replaced.
- */
- public PluginVersionIdentifier(int major, int minor, int service, String qualifier) {
-
- // Do the test outside of the assert so that they 'Policy.bind'
- // will not be evaluated each time (including cases when we would
- // have passed by the assert).
-
- if (major < 0)
- Assert.isTrue(false, NLS.bind(Messages.parse_postiveMajor, major + SEPARATOR + minor + SEPARATOR + service + SEPARATOR + qualifier));
- if (minor < 0)
- Assert.isTrue(false, NLS.bind(Messages.parse_postiveMinor, major + SEPARATOR + minor + SEPARATOR + service + SEPARATOR + qualifier));
- if (service < 0)
- Assert.isTrue(false, NLS.bind(Messages.parse_postiveService, major + SEPARATOR + minor + SEPARATOR + service + SEPARATOR + qualifier));
- if (qualifier == null)
- qualifier = ""; //$NON-NLS-1$
-
- this.major = major;
- this.minor = minor;
- this.service = service;
- this.qualifier = verifyQualifier(qualifier);
- }
-
- /**
- * Creates a plug-in version identifier from the given string.
- * The string representation consists of up to 4 tokens
- * separated by decimal point.
- * For example, the following are valid version identifiers
- * (as strings):
- * <ul>
- * <li><code>0.0.0</code></li>
- * <li><code>1.0.127564</code></li>
- * <li><code>3.7.2.build-127J</code></li>
- * <li><code>1.9</code> (interpreted as <code>1.9.0</code>)</li>
- * <li><code>3</code> (interpreted as <code>3.0.0</code>)</li>
- * </ul>
- * </p>
- *
- * @param versionId string representation of the version identifier.
- * Qualifier characters that are not a letter or a digit are replaced.
- */
- public PluginVersionIdentifier(String versionId) {
- Object[] parts = parseVersion(versionId);
- this.major = ((Integer) parts[0]).intValue();
- this.minor = ((Integer) parts[1]).intValue();
- this.service = ((Integer) parts[2]).intValue();
- this.qualifier = (String) parts[3];
- }
-
- /**
- * Validates the given string as a plug-in version identifier.
- *
- * @param version the string to validate
- * @return a status object with code <code>IStatus.OK</code> if
- * the given string is valid as a plug-in version identifier, otherwise a status
- * object indicating what is wrong with the string
- * @since 2.0
- */
- public static IStatus validateVersion(String version) {
- try {
- parseVersion(version);
- } catch (RuntimeException e) {
- return new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, e.getMessage(), e);
- }
- return Status.OK_STATUS;
- }
-
- private static Object[] parseVersion(String versionId) {
-
- // Do the test outside of the assert so that they 'Policy.bind'
- // will not be evaluated each time (including cases when we would
- // have passed by the assert).
- if (versionId == null)
- Assert.isNotNull(null, Messages.parse_emptyPluginVersion);
- String s = versionId.trim();
- if (s.equals("")) //$NON-NLS-1$
- Assert.isTrue(false, Messages.parse_emptyPluginVersion);
- if (s.startsWith(SEPARATOR))
- Assert.isTrue(false, NLS.bind(Messages.parse_separatorStartVersion, s));
- if (s.endsWith(SEPARATOR))
- Assert.isTrue(false, NLS.bind(Messages.parse_separatorEndVersion, s));
- if (s.indexOf(SEPARATOR + SEPARATOR) != -1)
- Assert.isTrue(false, NLS.bind(Messages.parse_doubleSeparatorVersion, s));
-
- StringTokenizer st = new StringTokenizer(s, SEPARATOR);
- Vector elements = new Vector(4);
-
- while (st.hasMoreTokens())
- elements.addElement(st.nextToken());
-
- int elementSize = elements.size();
-
- if (elementSize <= 0)
- Assert.isTrue(false, NLS.bind(Messages.parse_oneElementPluginVersion, s));
- if (elementSize > 4)
- Assert.isTrue(false, NLS.bind(Messages.parse_fourElementPluginVersion, s));
-
- int[] numbers = new int[3];
- try {
- numbers[0] = Integer.parseInt((String) elements.elementAt(0));
- if (numbers[0] < 0)
- Assert.isTrue(false, NLS.bind(Messages.parse_postiveMajor, s));
- } catch (NumberFormatException nfe) {
- Assert.isTrue(false, NLS.bind(Messages.parse_numericMajorComponent, s));
- }
-
- try {
- if (elementSize >= 2) {
- numbers[1] = Integer.parseInt((String) elements.elementAt(1));
- if (numbers[1] < 0)
- Assert.isTrue(false, NLS.bind(Messages.parse_postiveMinor, s));
- } else
- numbers[1] = 0;
- } catch (NumberFormatException nfe) {
- Assert.isTrue(false, NLS.bind(Messages.parse_numericMinorComponent, s));
- }
-
- try {
- if (elementSize >= 3) {
- numbers[2] = Integer.parseInt((String) elements.elementAt(2));
- if (numbers[2] < 0)
- Assert.isTrue(false, NLS.bind(Messages.parse_postiveService, s));
- } else
- numbers[2] = 0;
- } catch (NumberFormatException nfe) {
- Assert.isTrue(false, NLS.bind(Messages.parse_numericServiceComponent, s));
- }
-
- // "result" is a 4-element array with the major, minor, service, and qualifier
- Object[] result = new Object[4];
- result[0] = new Integer(numbers[0]);
- result[1] = new Integer(numbers[1]);
- result[2] = new Integer(numbers[2]);
- if (elementSize >= 4)
- result[3] = verifyQualifier((String) elements.elementAt(3));
- else
- result[3] = ""; //$NON-NLS-1$
- return result;
- }
-
- /**
- * Compare version identifiers for equality. Identifiers are
- * equal if all of their components are equal.
- *
- * @param object an object to compare
- * @return whether or not the two objects are equal
- */
- public boolean equals(Object object) {
- if (!(object instanceof PluginVersionIdentifier))
- return false;
- PluginVersionIdentifier v = (PluginVersionIdentifier) object;
- return v.getMajorComponent() == major && v.getMinorComponent() == minor && v.getServiceComponent() == service && v.getQualifierComponent().equals(qualifier);
- }
-
- /**
- * Returns a hash code value for the object.
- *
- * @return an integer which is a hash code value for this object.
- */
- public int hashCode() {
- int code = major + minor + service; // R1.0 result
- if (qualifier.equals("")) //$NON-NLS-1$
- return code;
- else
- return code + qualifier.hashCode();
- }
-
- /**
- * Returns the major (incompatible) component of this
- * version identifier.
- *
- * @return the major version
- */
- public int getMajorComponent() {
- return major;
- }
-
- /**
- * Returns the minor (compatible) component of this
- * version identifier.
- *
- * @return the minor version
- */
- public int getMinorComponent() {
- return minor;
- }
-
- /**
- * Returns the service level component of this
- * version identifier.
- *
- * @return the service level
- */
- public int getServiceComponent() {
- return service;
- }
-
- /**
- * Returns the qualifier component of this
- * version identifier.
- *
- * @return the qualifier
- */
- public String getQualifierComponent() {
- return qualifier;
- }
-
- /**
- * Compares two version identifiers to see if this one is
- * greater than or equal to the argument.
- * <p>
- * A version identifier is considered to be greater than or equal
- * if its major component is greater than the argument major
- * component, or the major components are equal and its minor component
- * is greater than the argument minor component, or the
- * major and minor components are equal and its service component is
- * greater than the argument service component, or the major, minor and
- * service components are equal and the qualifier component is
- * greater than the argument qualifier component (using lexicographic
- * string comparison), or all components are equal.
- * </p>
- *
- * @param id the other version identifier
- * @return <code>true</code> is this version identifier
- * is compatible with the given version identifier, and
- * <code>false</code> otherwise
- * @since 2.0
- */
- public boolean isGreaterOrEqualTo(PluginVersionIdentifier id) {
- if (id == null)
- return false;
- if (major > id.getMajorComponent())
- return true;
- if ((major == id.getMajorComponent()) && (minor > id.getMinorComponent()))
- return true;
- if ((major == id.getMajorComponent()) && (minor == id.getMinorComponent()) && (service > id.getServiceComponent()))
- return true;
- if ((major == id.getMajorComponent()) && (minor == id.getMinorComponent()) && (service == id.getServiceComponent()) && (qualifier.compareTo(id.getQualifierComponent()) >= 0))
- return true;
- else
- return false;
- }
-
- /**
- * Compares two version identifiers for compatibility.
- * <p>
- * A version identifier is considered to be compatible if its major
- * component equals to the argument major component, and its minor component
- * is greater than or equal to the argument minor component.
- * If the minor components are equal, than the service level of the
- * version identifier must be greater than or equal to the service level
- * of the argument identifier. If the service levels are equal, the two
- * version identifiers are considered to be equivalent if this qualifier is
- * greater or equal to the qualifier of the argument (using lexicographic
- * string comparison).
- * </p>
- *
- * @param id the other version identifier
- * @return <code>true</code> is this version identifier
- * is compatible with the given version identifier, and
- * <code>false</code> otherwise
- */
- public boolean isCompatibleWith(PluginVersionIdentifier id) {
- if (id == null)
- return false;
- if (major != id.getMajorComponent())
- return false;
- if (minor > id.getMinorComponent())
- return true;
- if (minor < id.getMinorComponent())
- return false;
- if (service > id.getServiceComponent())
- return true;
- if (service < id.getServiceComponent())
- return false;
- if (qualifier.compareTo(id.getQualifierComponent()) >= 0)
- return true;
- else
- return false;
- }
-
- /**
- * Compares two version identifiers for equivalency.
- * <p>
- * Two version identifiers are considered to be equivalent if their major
- * and minor component equal and are at least at the same service level
- * as the argument. If the service levels are equal, the two version
- * identifiers are considered to be equivalent if this qualifier is
- * greater or equal to the qualifier of the argument (using lexicographic
- * string comparison).
- *
- * </p>
- *
- * @param id the other version identifier
- * @return <code>true</code> is this version identifier
- * is equivalent to the given version identifier, and
- * <code>false</code> otherwise
- */
- public boolean isEquivalentTo(PluginVersionIdentifier id) {
- if (id == null)
- return false;
- if (major != id.getMajorComponent())
- return false;
- if (minor != id.getMinorComponent())
- return false;
- if (service > id.getServiceComponent())
- return true;
- if (service < id.getServiceComponent())
- return false;
- if (qualifier.compareTo(id.getQualifierComponent()) >= 0)
- return true;
- else
- return false;
- }
-
- /**
- * Compares two version identifiers for perfect equality.
- * <p>
- * Two version identifiers are considered to be perfectly equal if their
- * major, minor, service and qualifier components are equal
- * </p>
- *
- * @param id the other version identifier
- * @return <code>true</code> is this version identifier
- * is perfectly equal to the given version identifier, and
- * <code>false</code> otherwise
- * @since 2.0
- */
- public boolean isPerfect(PluginVersionIdentifier id) {
- if (id == null)
- return false;
- if ((major != id.getMajorComponent()) || (minor != id.getMinorComponent()) || (service != id.getServiceComponent()) || (!qualifier.equals(id.getQualifierComponent())))
- return false;
- else
- return true;
- }
-
- /**
- * Compares two version identifiers for order using multi-decimal
- * comparison.
- *
- * @param id the other version identifier
- * @return <code>true</code> is this version identifier
- * is greater than the given version identifier, and
- * <code>false</code> otherwise
- */
- public boolean isGreaterThan(PluginVersionIdentifier id) {
-
- if (id == null) {
- if (major == 0 && minor == 0 && service == 0 && qualifier.equals("")) //$NON-NLS-1$
- return false;
- else
- return true;
- }
-
- if (major > id.getMajorComponent())
- return true;
- if (major < id.getMajorComponent())
- return false;
- if (minor > id.getMinorComponent())
- return true;
- if (minor < id.getMinorComponent())
- return false;
- if (service > id.getServiceComponent())
- return true;
- if (service < id.getServiceComponent())
- return false;
- if (qualifier.compareTo(id.getQualifierComponent()) > 0)
- return true;
- else
- return false;
-
- }
-
- /**
- * Returns the string representation of this version identifier.
- * The result satisfies
- * <code>vi.equals(new PluginVersionIdentifier(vi.toString()))</code>.
- *
- * @return the string representation of this plug-in version identifier
- */
- public String toString() {
- String base = major + SEPARATOR + minor + SEPARATOR + service; // R1.0 result
- if (qualifier.equals("")) //$NON-NLS-1$
- return base;
- else
- return base + SEPARATOR + qualifier;
- }
-
- private static String verifyQualifier(String s) {
- char[] chars = s.trim().toCharArray();
- boolean whitespace = false;
- for (int i = 0; i < chars.length; i++) {
- if (!Character.isLetterOrDigit(chars[i])) {
- chars[i] = '-';
- whitespace = true;
- }
- }
- return whitespace ? new String(chars) : s;
- }
-}
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 ef079e0..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Preferences.java
+++ /dev/null
@@ -1,1262 +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.*;
-import java.util.*;
-import org.eclipse.core.internal.preferences.PreferencesService;
-import org.eclipse.core.internal.runtime.ListenerList;
-import org.eclipse.core.internal.runtime.Messages;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IPreferencesService;
-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];
-
- /**
- * 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 = Platform.getPreferencesService();
- OutputStream output = null;
- FileOutputStream fos = null;
- try {
- fos = new FileOutputStream(file);
- output = new BufferedOutputStream(fos);
- IEclipsePreferences node = (IEclipsePreferences) service.getRootNode().node(Plugin.PLUGIN_PREFERENCE_SCOPE);
- service.exportPreferences(node, output, (String[]) null);
- output.flush();
- fos.getFD().sync();
- } catch (IOException e) {
- String message = NLS.bind(Messages.preferences_errorWriting, file, e.getMessage());
- IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, 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(Messages.preferences_fileNotFound, path.toOSString());
- throw new CoreException(new Status(IStatus.ERROR, Platform.PI_RUNTIME, 1, msg, null));
- }
- IPreferencesService service = Platform.getPreferencesService();
- InputStream input = null;
- try {
- input = new BufferedInputStream(new FileInputStream(path.toFile()));
- service.importPreferences(input);
- } catch (FileNotFoundException e) {
- String msg = NLS.bind(Messages.preferences_fileNotFound, path.toOSString());
- throw new CoreException(new Status(IStatus.ERROR, Platform.PI_RUNTIME, 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) Platform.getPreferencesService();
- 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 Platform#run()
- }
-
- public void run() throws Exception {
- l.propertyChange(pe);
- }
- };
- Platform.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/ProgressMonitorWrapper.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ProgressMonitorWrapper.java
deleted file mode 100644
index 4431163..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ProgressMonitorWrapper.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import org.eclipse.core.internal.runtime.Assert;
-
-/**
- * An abstract wrapper around a progress monitor which,
- * unless overridden, forwards <code>IProgressMonitor</code>
- * and <code>IProgressMonitorWithBlocking</code> methods to the wrapped progress monitor.
- * <p>
- * Clients may subclass.
- * </p>
- */
-public abstract class ProgressMonitorWrapper implements IProgressMonitor, IProgressMonitorWithBlocking {
-
- /** The wrapped progress monitor. */
- private IProgressMonitor progressMonitor;
-
- /**
- * Creates a new wrapper around the given monitor.
- *
- * @param monitor the progress monitor to forward to
- */
- protected ProgressMonitorWrapper(IProgressMonitor monitor) {
- Assert.isNotNull(monitor);
- progressMonitor = monitor;
- }
-
- /**
- * This implementation of a <code>IProgressMonitor</code>
- * method forwards to the wrapped progress monitor.
- * Clients may override this method to do additional
- * processing.
- *
- * @see IProgressMonitor#beginTask(String, int)
- */
- public void beginTask(String name, int totalWork) {
- progressMonitor.beginTask(name, totalWork);
- }
-
- /**
- * This implementation of a <code>IProgressMonitorWithBlocking</code>
- * method forwards to the wrapped progress monitor.
- * Clients may override this method to do additional
- * processing.
- *
- * @see IProgressMonitorWithBlocking#clearBlocked()
- * @since 3.0
- */
- public void clearBlocked() {
- if (progressMonitor instanceof IProgressMonitorWithBlocking)
- ((IProgressMonitorWithBlocking) progressMonitor).clearBlocked();
- }
-
- /**
- * This implementation of a <code>IProgressMonitor</code>
- * method forwards to the wrapped progress monitor.
- * Clients may override this method to do additional
- * processing.
- *
- * @see IProgressMonitor#done()
- */
- public void done() {
- progressMonitor.done();
- }
-
- /**
- * Returns the wrapped progress monitor.
- *
- * @return the wrapped progress monitor
- */
- public IProgressMonitor getWrappedProgressMonitor() {
- return progressMonitor;
- }
-
- /**
- * This implementation of a <code>IProgressMonitor</code>
- * method forwards to the wrapped progress monitor.
- * Clients may override this method to do additional
- * processing.
- *
- * @see IProgressMonitor#internalWorked(double)
- */
- public void internalWorked(double work) {
- progressMonitor.internalWorked(work);
- }
-
- /**
- * This implementation of a <code>IProgressMonitor</code>
- * method forwards to the wrapped progress monitor.
- * Clients may override this method to do additional
- * processing.
- *
- * @see IProgressMonitor#isCanceled()
- */
- public boolean isCanceled() {
- return progressMonitor.isCanceled();
- }
-
- /**
- * This implementation of a <code>IProgressMonitorWithBlocking</code>
- * method forwards to the wrapped progress monitor.
- * Clients may override this method to do additional
- * processing.
- *
- * @see IProgressMonitorWithBlocking#setBlocked(IStatus)
- * @since 3.0
- */
- public void setBlocked(IStatus reason) {
- if (progressMonitor instanceof IProgressMonitorWithBlocking)
- ((IProgressMonitorWithBlocking) progressMonitor).setBlocked(reason);
- }
-
- /**
- * This implementation of a <code>IProgressMonitor</code>
- * method forwards to the wrapped progress monitor.
- * Clients may override this method to do additional
- * processing.
- *
- * @see IProgressMonitor#setCanceled(boolean)
- */
- public void setCanceled(boolean b) {
- progressMonitor.setCanceled(b);
- }
-
- /**
- * This implementation of a <code>IProgressMonitor</code>
- * method forwards to the wrapped progress monitor.
- * Clients may override this method to do additional
- * processing.
- *
- * @see IProgressMonitor#setTaskName(String)
- */
- public void setTaskName(String name) {
- progressMonitor.setTaskName(name);
- }
-
- /**
- * This implementation of a <code>IProgressMonitor</code>
- * method forwards to the wrapped progress monitor.
- * Clients may override this method to do additional
- * processing.
- *
- * @see IProgressMonitor#subTask(String)
- */
- public void subTask(String name) {
- progressMonitor.subTask(name);
- }
-
- /**
- * This implementation of a <code>IProgressMonitor</code>
- * method forwards to the wrapped progress monitor.
- * Clients may override this method to do additional
- * processing.
- *
- * @see IProgressMonitor#worked(int)
- */
- public void worked(int work) {
- progressMonitor.worked(work);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/QualifiedName.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/QualifiedName.java
deleted file mode 100644
index 8204b9a..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/QualifiedName.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-import org.eclipse.core.internal.runtime.Assert;
-
-/**
- * Qualified names are two-part names: qualifier and local name.
- * The qualifier must be in URI form (see RFC2396).
- * Note however that the qualifier may be <code>null</code> if
- * the default name space is being used. The empty string is not
- * a valid local name.
- * <p>
- * This class is not intended to be subclassed by clients.
- * </p>
- */
-public final class QualifiedName {
-
- /** Qualifier part (potentially <code>null</code>). */
- /*package*/
- String qualifier = null;
-
- /** Local name part. */
- /*package*/
- String localName = null;
-
- /**
- * Creates and returns a new qualified name with the given qualifier
- * and local name. The local name must not be the empty string.
- * The qualifier may be <code>null</code>.
- * <p>
- * Clients may instantiate.
- * </p>
- * @param qualifier the qualifier string, or <code>null</code>
- * @param localName the local name string
- */
- public QualifiedName(String qualifier, String localName) {
- Assert.isLegal(localName != null && localName.length() != 0);
- this.qualifier = qualifier;
- this.localName = localName;
- }
-
- /**
- * Returns whether this qualified name is equivalent to the given object.
- * <p>
- * Qualified names are equal if and only if they have the same
- * qualified parts and local parts.
- * Qualified names are not equal to objects other than qualified names.
- * </p>
- *
- * @param obj the object to compare to
- * @return <code>true</code> if these are equivalent qualified
- * names, and <code>false</code> otherwise
- */
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof QualifiedName)) {
- return false;
- }
- QualifiedName qName = (QualifiedName) obj;
- /* There may or may not be a qualifier */
- if (qualifier == null && qName.getQualifier() != null) {
- return false;
- }
- if (qualifier != null && !qualifier.equals(qName.getQualifier())) {
- return false;
- }
- return localName.equals(qName.getLocalName());
- }
-
- /**
- * Returns the local part of this name.
- *
- * @return the local name string
- */
- public String getLocalName() {
- return localName;
- }
-
- /**
- * Returns the qualifier part for this qualified name, or <code>null</code>
- * if none.
- *
- * @return the qualifier string, or <code>null</code>
- */
- public String getQualifier() {
- return qualifier;
- }
-
- /* (Intentionally omitted from javadoc)
- * Implements the method <code>Object.hashCode</code>.
- *
- * Returns the hash code for this qualified name.
- */
- public int hashCode() {
- return (qualifier == null ? 0 : qualifier.hashCode()) + localName.hashCode();
- }
-
- /**
- * Converts this qualified name into a string, suitable for
- * debug purposes only.
- */
- public String toString() {
- return (getQualifier() == null ? "" : getQualifier() + ':') + getLocalName(); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Status.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Status.java
deleted file mode 100644
index cb96dc8..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Status.java
+++ /dev/null
@@ -1,230 +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 org.eclipse.core.internal.runtime.*;
-import org.eclipse.core.internal.runtime.Assert;
-
-/**
- * A concrete status implementation, suitable either for
- * instantiating or subclassing.
- */
-public class Status implements IStatus {
- /**
- * A standard OK status with an "ok" message.
- *
- * @since 3.0
- */
- public static final IStatus OK_STATUS = new Status(OK, Platform.PI_RUNTIME, OK, Messages.ok, null);
- /**
- * A standard CANCEL status with no message.
- *
- * @since 3.0
- */
- public static final IStatus CANCEL_STATUS = new Status(CANCEL, Platform.PI_RUNTIME, 1, "", null); //$NON-NLS-1$
- /**
- * The severity. One of
- * <ul>
- * <li><code>CANCEL</code></li>
- * <li><code>ERROR</code></li>
- * <li><code>WARNING</code></li>
- * <li><code>INFO</code></li>
- * <li>or <code>OK</code> (0)</li>
- * </ul>
- */
- private int severity = OK;
-
- /** Unique identifier of plug-in.
- */
- private String pluginId;
-
- /** Plug-in-specific status code.
- */
- private int code;
-
- /** Message, localized to the current locale.
- */
- private String message;
-
- /** Wrapped exception, or <code>null</code> if none.
- */
- private Throwable exception = null;
-
- /** Constant to avoid generating garbage.
- */
- private static final IStatus[] theEmptyStatusArray = new IStatus[0];
-
- /**
- * Creates a new status object. The created status has no children.
- *
- * @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
- * <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
- * @param pluginId the unique identifier of the relevant plug-in
- * @param code the plug-in-specific status code, or <code>OK</code>
- * @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 Status(int severity, String pluginId, int code, String message, Throwable exception) {
- setSeverity(severity);
- setPlugin(pluginId);
- setCode(code);
- setMessage(message);
- setException(exception);
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the corresponding method on <code>IStatus</code>.
- */
- public IStatus[] getChildren() {
- return theEmptyStatusArray;
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the corresponding method on <code>IStatus</code>.
- */
- public int getCode() {
- return code;
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the corresponding method on <code>IStatus</code>.
- */
- public Throwable getException() {
- return exception;
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the corresponding method on <code>IStatus</code>.
- */
- public String getMessage() {
- return message;
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the corresponding method on <code>IStatus</code>.
- */
- public String getPlugin() {
- return pluginId;
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the corresponding method on <code>IStatus</code>.
- */
- public int getSeverity() {
- return severity;
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the corresponding method on <code>IStatus</code>.
- */
- public boolean isMultiStatus() {
- return false;
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the corresponding method on <code>IStatus</code>.
- */
- public boolean isOK() {
- return severity == OK;
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the corresponding method on <code>IStatus</code>.
- */
- public boolean matches(int severityMask) {
- return (severity & severityMask) != 0;
- }
-
- /**
- * Sets the status code.
- *
- * @param code the plug-in-specific status code, or <code>OK</code>
- */
- protected void setCode(int code) {
- this.code = code;
- }
-
- /**
- * Sets the exception.
- *
- * @param exception a low-level exception, or <code>null</code> if not
- * applicable
- */
- protected void setException(Throwable exception) {
- this.exception = exception;
- }
-
- /**
- * Sets the message.
- *
- * @param message a human-readable message, localized to the
- * current locale
- */
- protected void setMessage(String message) {
- Assert.isLegal(message != null);
- this.message = message;
- }
-
- /**
- * Sets the plug-in id.
- *
- * @param pluginId the unique identifier of the relevant plug-in
- */
- protected void setPlugin(String pluginId) {
- Assert.isLegal(pluginId != null && pluginId.length() > 0);
- this.pluginId = pluginId;
- }
-
- /**
- * Sets the severity.
- *
- * @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
- * <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
- */
- protected void setSeverity(int severity) {
- Assert.isLegal(severity == OK || severity == ERROR || severity == WARNING || severity == INFO || severity == CANCEL);
- this.severity = severity;
- }
-
- /**
- * Returns a string representation of the status, suitable
- * for debugging purposes only.
- */
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("Status "); //$NON-NLS-1$
- if (severity == OK) {
- buf.append("OK"); //$NON-NLS-1$
- } else if (severity == ERROR) {
- buf.append("ERROR"); //$NON-NLS-1$
- } else if (severity == WARNING) {
- buf.append("WARNING"); //$NON-NLS-1$
- } else if (severity == INFO) {
- buf.append("INFO"); //$NON-NLS-1$
- } else if (severity == CANCEL) {
- buf.append("CANCEL"); //$NON-NLS-1$
- } else {
- buf.append("severity="); //$NON-NLS-1$
- buf.append(severity);
- }
- buf.append(": "); //$NON-NLS-1$
- buf.append(pluginId);
- buf.append(" code="); //$NON-NLS-1$
- buf.append(code);
- buf.append(' ');
- buf.append(message);
- buf.append(' ');
- buf.append(exception);
- return buf.toString();
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/SubProgressMonitor.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/SubProgressMonitor.java
deleted file mode 100644
index 4257710..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/SubProgressMonitor.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime;
-
-/**
- * A progress monitor that uses a given amount of work ticks
- * from a parent monitor. It can be used as follows:
- * <pre>
- * try {
- * pm.beginTask("Main Task", 100);
- * doSomeWork(pm, 30);
- * SubProgressMonitor subMonitor= new SubProgressMonitor(pm, 40);
- * try {
- * subMonitor.beginTask("", 300);
- * doSomeWork(subMonitor, 300);
- * } finally {
- * subMonitor.done();
- * }
- * doSomeWork(pm, 30);
- * } finally {
- * pm.done();
- * }
- * </pre>
- * <p>
- * This class may be instantiated or subclassed by clients.
- * </p>
- */
-public class SubProgressMonitor extends ProgressMonitorWrapper {
-
- /**
- * Style constant indicating that calls to <code>subTask</code>
- * should not have any effect.
- *
- * @see #SubProgressMonitor(IProgressMonitor,int,int)
- */
- public static final int SUPPRESS_SUBTASK_LABEL = 1 << 1;
- /**
- * Style constant indicating that the main task label
- * should be prepended to the subtask label.
- *
- * @see #SubProgressMonitor(IProgressMonitor,int,int)
- */
- public static final int PREPEND_MAIN_LABEL_TO_SUBTASK = 1 << 2;
-
- private int parentTicks = 0;
- private double sentToParent = 0.0;
- private double scale = 0.0;
- private int nestedBeginTasks = 0;
- private boolean usedUp = false;
- private boolean hasSubTask = false;
- private int style;
- private String mainTaskLabel;
-
- /**
- * Creates a new sub-progress monitor for the given monitor. The sub
- * progress monitor uses the given number of work ticks from its
- * parent monitor.
- *
- * @param monitor the parent progress monitor
- * @param ticks the number of work ticks allocated from the
- * parent monitor
- */
- public SubProgressMonitor(IProgressMonitor monitor, int ticks) {
- this(monitor, ticks, 0);
- }
-
- /**
- * Creates a new sub-progress monitor for the given monitor. The sub
- * progress monitor uses the given number of work ticks from its
- * parent monitor.
- *
- * @param monitor the parent progress monitor
- * @param ticks the number of work ticks allocated from the
- * parent monitor
- * @param style one of
- * <ul>
- * <li> <code>SUPPRESS_SUBTASK_LABEL</code> </li>
- * <li> <code>PREPEND_MAIN_LABEL_TO_SUBTASK</code> </li>
- * </ul>
- * @see #SUPPRESS_SUBTASK_LABEL
- * @see #PREPEND_MAIN_LABEL_TO_SUBTASK
- */
- public SubProgressMonitor(IProgressMonitor monitor, int ticks, int style) {
- super(monitor);
- this.parentTicks = ticks;
- this.style = style;
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the method <code>IProgressMonitor.beginTask</code>.
- *
- * Starts a new main task. Since this progress monitor is a sub
- * progress monitor, the given name will NOT be used to update
- * the progress bar's main task label. That means the given
- * string will be ignored. If style <code>PREPEND_MAIN_LABEL_TO_SUBTASK
- * <code> is specified, then the given string will be prepended to
- * every string passed to <code>subTask(String)</code>.
- */
- public void beginTask(String name, int totalWork) {
- nestedBeginTasks++;
- // Ignore nested begin task calls.
- if (nestedBeginTasks > 1) {
- return;
- }
- // be safe: if the argument would cause math errors (zero or
- // negative), just use 0 as the scale. This disables progress for
- // this submonitor.
- scale = totalWork <= 0 ? 0 : (double) parentTicks / (double) totalWork;
- if ((style & PREPEND_MAIN_LABEL_TO_SUBTASK) != 0) {
- mainTaskLabel = name;
- }
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the method <code>IProgressMonitor.done</code>.
- */
- public void done() {
- // Ignore if more done calls than beginTask calls or if we are still
- // in some nested beginTasks
- if (nestedBeginTasks == 0 || --nestedBeginTasks > 0)
- return;
- // Send any remaining ticks and clear out the subtask text
- double remaining = parentTicks - sentToParent;
- if (remaining > 0)
- super.internalWorked(remaining);
- //clear the sub task if there was one
- if (hasSubTask)
- subTask(""); //$NON-NLS-1$
- sentToParent = 0;
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the internal method <code>IProgressMonitor.internalWorked</code>.
- */
- public void internalWorked(double work) {
- if (usedUp || nestedBeginTasks != 1) {
- return;
- }
-
- double realWork = scale * work;
- super.internalWorked(realWork);
- sentToParent += realWork;
- if (sentToParent >= parentTicks) {
- usedUp = true;
- }
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the method <code>IProgressMonitor.subTask</code>.
- */
- public void subTask(String name) {
- if ((style & SUPPRESS_SUBTASK_LABEL) != 0) {
- return;
- }
- hasSubTask = true;
- String label = name;
- if ((style & PREPEND_MAIN_LABEL_TO_SUBTASK) != 0 && mainTaskLabel != null && mainTaskLabel.length() > 0) {
- label = mainTaskLabel + ' ' + label;
- }
- super.subTask(label);
- }
-
- /* (Intentionally not javadoc'd)
- * Implements the method <code>IProgressMonitor.worked</code>.
- */
- public void worked(int work) {
- internalWorked(work);
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/BinarySignatureDescriber.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/BinarySignatureDescriber.java
deleted file mode 100644
index 15d22e6..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/BinarySignatureDescriber.java
+++ /dev/null
@@ -1,119 +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 java.util.*;
-import org.eclipse.core.internal.runtime.Messages;
-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(Messages.content_badInitializationData, XMLRootElementContentDescriber.class.getName());
- throw new CoreException(new Status(IStatus.ERROR, Platform.PI_RUNTIME, 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(Messages.content_badInitializationData, BinarySignatureDescriber.class.getName());
- throw new CoreException(new Status(IStatus.ERROR, Platform.PI_RUNTIME, 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.runtime/src/org/eclipse/core/runtime/content/IContentDescriber.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/IContentDescriber.java
deleted file mode 100644
index 4e13faa..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/IContentDescriber.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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.runtime/src/org/eclipse/core/runtime/content/IContentDescription.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/IContentDescription.java
deleted file mode 100644
index f1a7da6..0000000
--- a/bundles/org.eclipse.core.runtime/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.runtime.Platform;
-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(Platform.PI_RUNTIME, "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(Platform.PI_RUNTIME, "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.runtime/src/org/eclipse/core/runtime/content/IContentType.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/IContentType.java
deleted file mode 100644
index 55cacaf..0000000
--- a/bundles/org.eclipse.core.runtime/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.runtime/src/org/eclipse/core/runtime/content/IContentTypeManager.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/IContentTypeManager.java
deleted file mode 100644
index 425640e..0000000
--- a/bundles/org.eclipse.core.runtime/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.runtime/src/org/eclipse/core/runtime/content/IContentTypeMatcher.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/IContentTypeMatcher.java
deleted file mode 100644
index 6d65274..0000000
--- a/bundles/org.eclipse.core.runtime/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 recomended
- * 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 recomended
- * 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 recomended
- * 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 recomended
- * 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.runtime/src/org/eclipse/core/runtime/content/IContentTypeSettings.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/IContentTypeSettings.java
deleted file mode 100644
index c2d6502..0000000
--- a/bundles/org.eclipse.core.runtime/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.runtime/src/org/eclipse/core/runtime/content/ITextContentDescriber.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/ITextContentDescriber.java
deleted file mode 100644
index 4d4e6ac..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/ITextContentDescriber.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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.runtime/src/org/eclipse/core/runtime/content/XMLRootElementContentDescriber.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/XMLRootElementContentDescriber.java
deleted file mode 100644
index 007480a..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/XMLRootElementContentDescriber.java
+++ /dev/null
@@ -1,138 +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 java.util.Hashtable;
-import javax.xml.parsers.ParserConfigurationException;
-import org.eclipse.core.internal.content.XMLContentDescriber;
-import org.eclipse.core.internal.content.XMLRootHandler;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.internal.runtime.Messages;
-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
- */
-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 = Messages.content_parserConfiguration;
- InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, 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(Messages.content_badInitializationData, XMLRootElementContentDescriber.class.getName());
- throw new CoreException(new Status(IStatus.ERROR, Platform.PI_RUNTIME, 0, message, null));
- }
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/package.html b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/package.html
deleted file mode 100644
index fa292a8..0000000
--- a/bundles/org.eclipse.core.runtime/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.runtime/src/org/eclipse/core/runtime/dynamichelpers/ExtensionTracker.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/ExtensionTracker.java
deleted file mode 100644
index 64e3ffd..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/ExtensionTracker.java
+++ /dev/null
@@ -1,279 +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.dynamichelpers;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.internal.registry.ReferenceHashSet;
-import org.eclipse.core.internal.runtime.ListenerList;
-import org.eclipse.core.runtime.*;
-
-/**
- * Implementation of the IExtensionTracker.
- * @see org.eclipse.core.runtime.dynamichelpers.IExtensionTracker
- * @since 3.1
- */
-public class ExtensionTracker implements IExtensionTracker, IRegistryChangeListener {
- //Map keeping the association between extensions and a set of objects. Key: IExtension, value: ReferenceHashSet.
- private Map extensionToObjects = new HashMap();
- private ListenerList handlers = new ListenerList();
- private final Object lock = new Object();
- private boolean closed = false;
-
- private static final Object[] EMPTY_ARRAY = new Object[0];
-
- /**
- * Construct a new instance of the extension tracker.
- */
- public ExtensionTracker() {
- Platform.getExtensionRegistry().addRegistryChangeListener(this);
- }
-
- /* (non-Javadoc)
- * @see IExtensionTracker@registerHandler(IExtensionChangeHandler, IFilter)
- */
- public void registerHandler(IExtensionChangeHandler handler, IFilter filter) {
- synchronized (lock) {
- if (closed)
- return;
- // TODO need to store the filter with the handler
- handlers.add(new HandlerWrapper(handler, filter));
- }
- }
-
- /* (non-Javadoc)
- * @see IExtensionTracker@unregisterHandler(IExtensionChangeHandler)
- */
- public void unregisterHandler(IExtensionChangeHandler handler) {
- synchronized (lock) {
- if (closed)
- return;
- handlers.remove(new HandlerWrapper(handler, null));
- }
- }
-
- /* (non-Javadoc)
- * @see IExtensionTracker@registerObject(IExtension, Object, int)
- */
- public void registerObject(IExtension element, Object object, int referenceType) {
- if (element == null || object == null)
- return;
-
- synchronized (lock) {
- if (closed)
- return;
-
- ReferenceHashSet associatedObjects = (ReferenceHashSet) extensionToObjects.get(element);
- if (associatedObjects == null) {
- associatedObjects = new ReferenceHashSet();
- extensionToObjects.put(element, associatedObjects);
- }
- associatedObjects.add(object, referenceType);
- }
- }
-
- /**
- * Implementation of IRegistryChangeListener interface. This method must not
- * be called by clients.
- */
- public void registryChanged(IRegistryChangeEvent event) {
- IExtensionDelta delta[] = event.getExtensionDeltas();
- int len = delta.length;
- for (int i = 0; i < len; i++)
- switch (delta[i].getKind()) {
- case IExtensionDelta.ADDED :
- doAdd(delta[i]);
- break;
- case IExtensionDelta.REMOVED :
- doRemove(delta[i]);
- break;
- default :
- break;
- }
- }
-
- /**
- * Notify all handlers whose filter matches that the given delta occured
- * If the list of objects is not null then this is a removal and the handlers
- * will be given a chance to process the list. If it is null then the notification is
- * an addition.
- * @param delta the change to broadcast
- * @param objects the objects to pass to the handlers on removals
- */
- private void notify(IExtensionDelta delta, Object[] objects) {
- // Get a copy of the handlers for safe notification
- Object[] handlersCopy = null;
- synchronized (lock) {
- if (closed)
- return;
-
- if (handlers == null || handlers.isEmpty())
- return;
- handlersCopy = handlers.getListeners();
- }
-
- for (int i = 0; i < handlersCopy.length; i++) {
- HandlerWrapper wrapper = (HandlerWrapper) handlersCopy[i];
- if (wrapper.filter == null || wrapper.filter.matches(delta.getExtensionPoint())) {
- if (objects == null)
- applyAdd(wrapper.handler, delta.getExtension());
- else
- applyRemove(wrapper.handler, delta.getExtension(), objects);
- }
- }
- }
-
- protected void applyAdd(IExtensionChangeHandler handler, IExtension extension) {
- handler.addExtension(this, extension);
- }
-
- private void doAdd(IExtensionDelta delta) {
- notify(delta, null);
- }
-
- private void doRemove(IExtensionDelta delta) {
- Object[] removedObjects = null;
- synchronized (lock) {
- if (closed)
- return;
-
- ReferenceHashSet associatedObjects = (ReferenceHashSet) extensionToObjects.remove(delta.getExtension());
- if (associatedObjects == null)
- return;
- //Copy the objects early so we don't hold the lock too long
- removedObjects = associatedObjects.toArray();
- }
- notify(delta, removedObjects);
- }
-
- protected void applyRemove(IExtensionChangeHandler handler, IExtension removedExtension, Object[] removedObjects) {
- handler.removeExtension(removedExtension, removedObjects);
- }
-
- /* (non-Javadoc)
- * @see IExtensionTracker@getObjects(IExtension)
- */
- public Object[] getObjects(IExtension element) {
- synchronized (lock) {
- if (closed)
- return EMPTY_ARRAY;
- ReferenceHashSet objectSet = (ReferenceHashSet) extensionToObjects.get(element);
- if (objectSet == null)
- return EMPTY_ARRAY;
-
- return objectSet.toArray();
- }
- }
-
- /* (non-Javadoc)
- * @see IExtensionTracker@close()
- */
- public void close() {
- synchronized (lock) {
- if (closed)
- return;
-
- Platform.getExtensionRegistry().removeRegistryChangeListener(this);
- extensionToObjects = null;
- handlers = null;
-
- closed = true;
- }
- }
-
- /* (non-Javadoc)
- * @see IExtensionTracker@unregisterObject(IExtension, Object)
- */
- public void unregisterObject(IExtension extension, Object object) {
- synchronized (lock) {
- if (closed)
- return;
- ReferenceHashSet associatedObjects = (ReferenceHashSet) extensionToObjects.get(extension);
- if (associatedObjects != null)
- associatedObjects.remove(object);
- }
- }
-
- /* (non-Javadoc)
- * @see IExtensionTracker@unregisterObject(IExtension)
- */
- public Object[] unregisterObject(IExtension extension) {
- synchronized (lock) {
- if (closed)
- return EMPTY_ARRAY;
- ReferenceHashSet associatedObjects = (ReferenceHashSet) extensionToObjects.remove(extension);
- if (associatedObjects == null)
- return EMPTY_ARRAY;
- return associatedObjects.toArray();
- }
- }
-
- /**
- * Return an instance of filter matching all changes for the given extension point.
- * @param xpt the extension point
- * @return a filter
- */
- public static IFilter createExtensionPointFilter(final IExtensionPoint xpt) {
- return new IFilter() {
- public boolean matches(IExtensionPoint target) {
- return xpt.equals(target);
- }
- };
- }
-
- /**
- * Return an instance of filter matching all changes for the given extension points.
- * @param xpts the extension points used to filter
- * @return a filter
- */
- public static IFilter createExtensionPointFilter(final IExtensionPoint[] xpts) {
- return new IFilter() {
- public boolean matches(IExtensionPoint target) {
- for (int i = 0; i < xpts.length; i++)
- if (xpts[i].equals(target))
- return true;
- return false;
- }
- };
- }
-
- /**
- * Return an instance of filter matching all changes from a given plugin.
- * @param id the plugin id
- * @return a filter
- */
- public static IFilter createNamespaceFilter(final String id) {
- return new IFilter() {
- public boolean matches(IExtensionPoint target) {
- return id.equals(target.getNamespace());
- }
- };
- }
-
- private class HandlerWrapper {
- IExtensionChangeHandler handler;
- IFilter filter;
-
- public HandlerWrapper(IExtensionChangeHandler handler, IFilter filter) {
- this.handler = handler;
- this.filter = filter;
- }
-
- public boolean equals(Object target) {
- return handler.equals(((HandlerWrapper) target).handler);
- }
-
- public int hashCode() {
- return handler.hashCode();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/IExtensionChangeHandler.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/IExtensionChangeHandler.java
deleted file mode 100644
index 1637876..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/IExtensionChangeHandler.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.dynamichelpers;
-
-import org.eclipse.core.runtime.IExtension;
-
-/**
- * Extension change handlers are notified of changes for a given extension
- * point in the context of an extension tracker.
- *
- * @since 3.1
- */
-public interface IExtensionChangeHandler {
-
- /**
- * This method is called whenever an extension conforming to the extension point filter
- * is being added to the registry.
- * This method does not automatically register objects to the tracker.
- * @param tracker a tracker to which the handler has been registered.
- * @param extension the extension being added.
- */
- public void addExtension(IExtensionTracker tracker, IExtension extension);
-
- /**
- * This method is called after the removal of an extension.
- * @param extension the extension being removed
- * @param objects the objects that were associated with the removed extension
- */
- public void removeExtension(IExtension extension, Object[] objects);
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/IExtensionTracker.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/IExtensionTracker.java
deleted file mode 100644
index 6eb43f4..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/IExtensionTracker.java
+++ /dev/null
@@ -1,99 +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.dynamichelpers;
-
-import org.eclipse.core.internal.registry.ReferenceHashSet;
-import org.eclipse.core.runtime.IExtension;
-
-/**
- * An extension tracker keeps associations between extensions and their derived objects on an extension basis.
- * All extensions being added in a tracker will automatically be removed when the extension is uninstalled from the registry.
- * Users interested in extension removal can register a handler that will let them know when an object is being removed.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @since 3.1
- */
-public interface IExtensionTracker {
-
- /**
- * Constant for strong (normal) reference holding.
- *
- * Value <code>1</code>.
- */
- public static final int REF_STRONG = ReferenceHashSet.HARD;
-
- /**
- * Constant for soft reference holding.
- *
- * Value <code>2</code>.
- */
- public static final int REF_SOFT = ReferenceHashSet.SOFT;
-
- /**
- * Constant for weak reference holding.
- *
- * Value <code>3</code>.
- */
- public static final int REF_WEAK = ReferenceHashSet.WEAK;
-
- /**
- * Register an extension change handler with this tracker using the given filter
- * @param handler the handler to be registered
- * @param filter the filter to use to choose interesting changes
- */
- public void registerHandler(IExtensionChangeHandler handler, IFilter filter);
-
- /**
- * Unregister the given extension change handler previously registered with this tracker
- * @param handler the handler to be unregistered
- */
- public void unregisterHandler(IExtensionChangeHandler handler);
-
- /**
- * Create an association between the given extension and the given object.
- * The referenceType indicates how strongly the object is being kept in memory.
- * There is 3 possible values: strong, soft, weak.
- * @param extension : an extension
- * @param object : the object to associate with the extension
- * @param referenceType : one of REF_STRONG, REF_SOFT, REF_WEAK
- */
- public void registerObject(IExtension extension, Object object, int referenceType);
-
- /**
- * Remove an association between the given extension and the given object.
- * @param extension : the extension under which the object has been registered
- * @param object : the object to unregister
- */
- public void unregisterObject(IExtension extension, Object object);
-
- /**
- * Remove all the objects associated with the given extension and return them.
- * @param extension : the extension for which the objects are removed
- * @return the objects that were associated with the extension.
- */
- public Object[] unregisterObject(IExtension extension);
-
- /**
- * Get all the objects that have been associated with the given extension.
- * All objects registered strongly will be return unless they have been unregistered.
- * The objects registered softly or weakly may not be returned if they have been garbage collected.
- * @param extension the extension for which the object must be returned
- * @return an array of objects associated with this extension, or an empty array if no association exists
- */
- public Object[] getObjects(IExtension extension);
-
- /**
- * Close the tracker. All registered objects are freed and all handlers are being automatically removed.
- */
- public void close();
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/IFilter.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/IFilter.java
deleted file mode 100644
index 1dc0203..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/IFilter.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.runtime.dynamichelpers;
-
-import org.eclipse.core.runtime.IExtensionPoint;
-
-/**
- * A filter compares the given object to some pattern and returns true
- * if the two match and false otherwise..
- *
- * The API can be implemented by clients, however factory methods are
- * available on IExtensionTracker.
- *
- * @since 3.1
- */
-public interface IFilter {
- /**
- * Return true if the given object matches the criteria for this filter
- * @param target the object to match
- * @return true if the target matches this filter, false otherwise
- */
- public boolean matches(IExtensionPoint target);
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/package.html b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/package.html
deleted file mode 100644
index 2ad57b4..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/dynamichelpers/package.html
+++ /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">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides helpers to facilitate the authoring of dynamic plug-ins.
-<h2>
-Package Specification</h2>
-This package specifies the API for tracking extensions life-cycle.
-</p>
-</body>
-</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/IJobChangeEvent.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/IJobChangeEvent.java
deleted file mode 100644
index e4bd4d0..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/IJobChangeEvent.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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.runtime/src/org/eclipse/core/runtime/jobs/IJobChangeListener.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/IJobChangeListener.java
deleted file mode 100644
index e642581..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/IJobChangeListener.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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.runtime/src/org/eclipse/core/runtime/jobs/IJobManager.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/IJobManager.java
deleted file mode 100644
index 4f2d024..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/IJobManager.java
+++ /dev/null
@@ -1,381 +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.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 {
- /**
- * 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();
-
- /**
- * 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>
- * 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)
- */
- 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()
- */
- 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 for internal use by the platform-related plug-ins.
- * Clients 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()
- */
- 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.runtime/src/org/eclipse/core/runtime/jobs/IJobStatus.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/IJobStatus.java
deleted file mode 100644
index cbcb855..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/IJobStatus.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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.runtime/src/org/eclipse/core/runtime/jobs/ILock.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/ILock.java
deleted file mode 100644
index 539e807..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/ILock.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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.runtime/src/org/eclipse/core/runtime/jobs/ISchedulingRule.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/ISchedulingRule.java
deleted file mode 100644
index 3f08a7c..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/ISchedulingRule.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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.runtime/src/org/eclipse/core/runtime/jobs/Job.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/Job.java
deleted file mode 100644
index ba62432..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/Job.java
+++ /dev/null
@@ -1,635 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.jobs;
-
-import org.eclipse.core.internal.jobs.InternalJob;
-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, Platform.PI_RUNTIME, 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;
-
- /**
- * 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();
- }
-
- /**
- * 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 another 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 any other job.
- *
- * @return <code>true</code> if this job is blocking a waiting 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.
- * <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
- * <tt>RUNNING</tt> state, or as soon as this job enters the <tt>NONE</tt> state.
- * </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
- */
- 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 <code>IStatus.CANCEL</code>. The singleton
- * cancel status <code>Status.CANCEL_STATUS</code> can be used for
- * this purpose.
- * <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 <code>Job.ASYNC_FINISH</code>. 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. After the specified delay,
- * the job is added to a queue of waiting jobs, and will be run when it arrives
- * at the beginning of the queue. 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. 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 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 <code>Job.ASYNC_FINISH</code> 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 <code>SLEEPING</code> 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 <code>WAITING</code> 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 <code>WAITING</code> 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.runtime/src/org/eclipse/core/runtime/jobs/JobChangeAdapter.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/JobChangeAdapter.java
deleted file mode 100644
index 55fbdda..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/JobChangeAdapter.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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.runtime/src/org/eclipse/core/runtime/jobs/LockListener.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/LockListener.java
deleted file mode 100644
index 651448e..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/LockListener.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.jobs;
-
-import org.eclipse.core.internal.jobs.JobManager;
-import org.eclipse.core.internal.jobs.LockManager;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-
-/**
- * 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) InternalPlatform.getDefault().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.runtime/src/org/eclipse/core/runtime/jobs/MultiRule.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/MultiRule.java
deleted file mode 100644
index a6c2849..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/MultiRule.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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.runtime/src/org/eclipse/core/runtime/jobs/ProgressProvider.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/ProgressProvider.java
deleted file mode 100644
index 719954c..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/ProgressProvider.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 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#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.runtime/src/org/eclipse/core/runtime/jobs/package.html b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/jobs/package.html
deleted file mode 100644
index 1e6256b..0000000
--- a/bundles/org.eclipse.core.runtime/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/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 dad4693..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/package.html
+++ /dev/null
@@ -1,20 +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 plug-ins and the plug-in registry.
-<h2>
-Package Specification</h2>
-This package specifies the API related to running the platform itself. This includes
-area such as the definition and management of plug-ins and the starting, stopping and maintaining the
-platform itself. In addition, this API supplies various utility types such as <tt>Path</tt>,
-<tt>IPath</tt> and various flavours of progress monitors.
-<p>
-Clients writing plug-ins or accessing plug-in functionality will likely be interested in the types
-provided by this package.
-</p>
-</body>
-</html>
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/AbstractPreferenceInitializer.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/AbstractPreferenceInitializer.java
deleted file mode 100644
index 5387407..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/AbstractPreferenceInitializer.java
+++ /dev/null
@@ -1,52 +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.preferences;
-
-/**
- * Abstract class used to aid in default preference value initialization.
- * Clients who extend the <code>org.eclipse.core.runtime.preferences</code>
- * extension point are able to specify a class within an <code>initializer</code>
- * element.
- *
- * @since 3.0
- */
-public abstract class AbstractPreferenceInitializer {
-
- /**
- * Default constructor for the class.
- */
- public AbstractPreferenceInitializer() {
- super();
- }
-
- /**
- * This method is called by the preference initializer to initialize default
- * preference values. Clients should get the correct node for their
- * bundle and then set the default values on it. For example:
- * <pre>
- * public void initializeDefaultPreferences() {
- * Preferences node = new DefaultScope().getNode("my.bundle.id");
- * node.put(key, value);
- * }
- * </pre>
- * <p>
- * <em>Note: Clients should only set default preference values for their
- * own bundle.</em>
- * </p>
- * <p>
- * <em>Note:</em> Clients should not call this method. It will be called
- * automatically by the preference initializer when the appropriate default
- * preference node is accessed.
- * </p>
- */
- public abstract void initializeDefaultPreferences();
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/ConfigurationScope.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/ConfigurationScope.java
deleted file mode 100644
index 9ab8de4..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/ConfigurationScope.java
+++ /dev/null
@@ -1,76 +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.preferences;
-
-import java.net.URL;
-import org.eclipse.core.internal.preferences.AbstractScope;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.service.datalocation.Location;
-
-/**
- * Object representing the configuration scope in the Eclipse preferences
- * hierarchy. Can be used as a context for searching for preference
- * values (in the IPreferencesService APIs) or for determining the
- * correct preference node to set values in the store.
- * <p>
- * Configuration preferences are stored on a per configuration basis in the
- * platform's configuration area as specified by {@link Platform#getConfigurationLocation}.
- * </p>
- * <p>
- * The path for preferences defined in the configuration scope hierarchy
- * is as follows: <code>/configuration/<qualifier></code>
- * </p>
- * <p>
- * This class is not intended to be subclassed. This class may be instantiated.
- * </p>
- * @see Platform#getConfigurationLocation()
- * @since 3.0
- */
-public final class ConfigurationScope extends AbstractScope {
-
- /**
- * String constant (value of <code>"configuration"</code>) used for the
- * scope name for the configuration preference scope.
- */
- public static final String SCOPE = "configuration"; //$NON-NLS-1$
-
- /**
- * Create and return a new configuration scope instance.
- */
- public ConfigurationScope() {
- super();
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IScopeContext#getName()
- */
- public String getName() {
- return SCOPE;
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IScopeContext#getLocation()
- */
- public IPath getLocation() {
- IPath result = null;
- Location location = InternalPlatform.getDefault().getConfigurationLocation();
- if (!location.isReadOnly()) {
- URL url = location.getURL();
- if (url != null) {
- result = new Path(url.getFile());
- if (result.isEmpty())
- result = null;
- }
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/DefaultScope.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/DefaultScope.java
deleted file mode 100644
index 925c266..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/DefaultScope.java
+++ /dev/null
@@ -1,70 +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.preferences;
-
-import org.eclipse.core.internal.preferences.AbstractScope;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Object representing the default scope in the Eclipse preferences
- * hierarchy. Can be used as a context for searching for preference
- * values (in the IPreferencesService APIs) or for determining the
- * correct preference node to set values in the store.
- * <p>
- * Default preferences are not persisted to disk.
- * </p>
- * <p>
- * The path for preferences defined in the default scope hierarchy
- * is as follows: <code>/default/<qualifier></code>
- * </p>
- * <p>
- * Note about product preference customization:
- * Clients who define their own {@link org.eclipse.core.runtime.IProduct}
- * are able to specify a product key of "<code>preferenceCustomization</code>".
- * (defined as a constant in {@link org.eclipse.ui.branding.IProductConstants})
- * Its value is either a {@link java.net.URL} or a file-system path to a
- * file whose contents are used to customize default preferences.
- * </p>
- * <p>
- * This class is not intended to be subclassed. This class may be instantiated.
- * </p>
- * @since 3.0
- */
-public final class DefaultScope extends AbstractScope {
-
- /**
- * String constant (value of <code>"default"</code>) used for the
- * scope name for the default preference scope.
- */
- public static final String SCOPE = "default"; //$NON-NLS-1$
-
- /**
- * Create and return a new default scope instance.
- */
- public DefaultScope() {
- super();
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IScopeContext#getName()
- */
- public String getName() {
- return SCOPE;
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IScopeContext#getLocation()
- */
- public IPath getLocation() {
- // We don't persist defaults so return null.
- return null;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IEclipsePreferences.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IEclipsePreferences.java
deleted file mode 100644
index a5d49ca..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IEclipsePreferences.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.preferences;
-
-import java.util.EventObject;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * This interface describes Eclipse extensions to the preference
- * story. It provides means for both preference and node change
- * listeners.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see org.osgi.service.prefs.Preferences
- * @since 3.0
- */
-public interface IEclipsePreferences extends Preferences {
-
- /**
- * An event object which describes the details of a change in the
- * preference node hierarchy. The child node is the one which
- * was added or removed.
- *
- * @see IEclipsePreferences.INodeChangeListener
- * @since 3.0
- */
- public final class NodeChangeEvent extends EventObject {
- /**
- * All serializable objects should have a stable serialVersionUID
- */
- private static final long serialVersionUID = 1L;
-
- private Preferences child;
-
- /**
- * Constructor for a new node change event object.
- *
- * @param parent the parent node
- * @param child the child node
- */
- public NodeChangeEvent(Preferences parent, Preferences child) {
- super(parent);
- this.child = child;
- }
-
- /**
- * Return the parent node for this event. This is the parent
- * of the node which was added or removed.
- *
- * @return the parent node
- */
- public Preferences getParent() {
- return (Preferences) getSource();
- }
-
- /**
- * Return the child node for this event. This is the node
- * which was added or removed.
- * <p>
- * Note: The child node may have been removed as a result of
- * the bundle supplying its implementation being un-installed. In this case
- * the only method which can safely be called on the child is #name().
- * </p>
- * @return the child node
- */
- public Preferences getChild() {
- return child;
- }
- }
-
- /**
- * A listener to be used to receive preference node change events.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @since 3.0
- */
- public interface INodeChangeListener {
-
- /**
- * Notification that a child node was added to the preference hierarchy.
- * The given event must not be <code>null</code>.
- *
- * @param event an event specifying the details about the new node
- * @see IEclipsePreferences.NodeChangeEvent
- * @see IEclipsePreferences#addNodeChangeListener(IEclipsePreferences.INodeChangeListener)
- * @see IEclipsePreferences#removeNodeChangeListener(IEclipsePreferences.INodeChangeListener)
- */
- public void added(NodeChangeEvent event);
-
- /**
- * Notification that a child node was removed from the preference hierarchy.
- * The given event must not be <code>null</code>.
- *
- * @param event an event specifying the details about the removed node
- * @see IEclipsePreferences.NodeChangeEvent
- * @see IEclipsePreferences#addNodeChangeListener(IEclipsePreferences.INodeChangeListener)
- * @see IEclipsePreferences#removeNodeChangeListener(IEclipsePreferences.INodeChangeListener)
- */
- public void removed(NodeChangeEvent event);
- }
-
- /**
- * An event object describing the details of a change to a preference
- * in the preference store.
- *
- * @see IEclipsePreferences.IPreferenceChangeListener
- * @since 3.0
- */
- public final class PreferenceChangeEvent extends EventObject {
- /**
- * All serializable objects should have a stable serialVersionUID
- */
- private static final long serialVersionUID = 1L;
-
- private String key;
- private Object newValue;
- private Object oldValue;
-
- /**
- * Constructor for a new preference change event. The node and the
- * key must not be <code>null</code>. The old and new preference
- * values must be either a <code>String</code> or <code>null</code>.
- *
- * @param node the node on which the change occurred
- * @param key the preference key
- * @param oldValue the old preference value, as a <code>String</code>
- * or <code>null</code>
- * @param newValue the new preference value, as a <code>String</code>
- * or <code>null</code>
- */
- public PreferenceChangeEvent(Object node, String key, Object oldValue, Object newValue) {
- super(node);
- if (key == null || !(node instanceof Preferences))
- throw new IllegalArgumentException();
- this.key = key;
- this.newValue = newValue;
- this.oldValue = oldValue;
- }
-
- /**
- * Return the preference node on which the change occurred.
- * Must not be <code>null</code>.
- *
- * @return the node
- */
- public Preferences getNode() {
- return (Preferences) source;
- }
-
- /**
- * Return the key of the preference which was changed.
- * Must not be <code>null</code>.
- *
- * @return the preference key
- */
- public String getKey() {
- return key;
- }
-
- /**
- * Return the new value for the preference encoded as a
- * <code>String</code>, or <code>null</code> if the
- * preference was removed.
- *
- * @return the new value or <code>null</code>
- */
- public Object getNewValue() {
- return newValue;
- }
-
- /**
- * Return the old value for the preference encoded as a
- * <code>String</code>, or <code>null</code> if the
- * preference was removed or if it cannot be determined.
- *
- * @return the old value or <code>null</code>
- */
- public Object getOldValue() {
- return oldValue;
- }
- }
-
- /**
- * A listener used to receive changes to preference values in the preference store.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @since 3.0
- */
- public interface IPreferenceChangeListener {
-
- /**
- * Notification that a preference value has changed in the preference store.
- * The given event object describes the change details and must not
- * be <code>null</code>.
- *
- * @param event the event details
- * @see IEclipsePreferences.PreferenceChangeEvent
- * @see IEclipsePreferences#addPreferenceChangeListener(IEclipsePreferences.IPreferenceChangeListener)
- * @see IEclipsePreferences#removePreferenceChangeListener(IEclipsePreferences.IPreferenceChangeListener)
- */
- public void preferenceChange(PreferenceChangeEvent event);
- }
-
- /**
- * Register the given listener for changes to this node. Duplicate calls
- * to this method with the same listener will have no effect. The given
- * listener argument must not be <code>null</code>.
- *
- * @param listener the node change listener to add
- * @throws IllegalStateException if this node or an ancestor has been removed
- * @see #removeNodeChangeListener(IEclipsePreferences.INodeChangeListener)
- * @see IEclipsePreferences.INodeChangeListener
- */
- public void addNodeChangeListener(INodeChangeListener listener);
-
- /**
- * De-register the given listener from receiving event change notifications
- * for this node. Calling this method with a listener which is not registered
- * has no effect. The given listener argument must not be <code>null</code>.
- *
- * @param listener the node change listener to remove
- * @throws IllegalStateException if this node or an ancestor has been removed
- * @see #addNodeChangeListener(IEclipsePreferences.INodeChangeListener)
- * @see IEclipsePreferences.INodeChangeListener
- */
- public void removeNodeChangeListener(INodeChangeListener listener);
-
- /**
- * Register the given listener for notification of preference changes to this node.
- * 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 preference change listener to register
- * @throws IllegalStateException if this node or an ancestor has been removed
- * @see #removePreferenceChangeListener(IEclipsePreferences.IPreferenceChangeListener)
- * @see IEclipsePreferences.IPreferenceChangeListener
- */
- public void addPreferenceChangeListener(IPreferenceChangeListener listener);
-
- /**
- * De-register the given listener from receiving notification of preference changes
- * to this node. 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 preference change listener to remove
- * @throws IllegalStateException if this node or an ancestor has been removed
- * @see #addPreferenceChangeListener(IEclipsePreferences.IPreferenceChangeListener)
- * @see IEclipsePreferences.IPreferenceChangeListener
- */
- public void removePreferenceChangeListener(IPreferenceChangeListener listener);
-
- /**
- * Remove this node from the preference hierarchy. If this node is the scope
- * root, then do not remove this node, only remove this node's children.
- * <p>
- * Functionally equivalent to calling {@link Preferences#removeNode()}.
- * See the spec of {@link Preferences#removeNode()} for more details.
- * </p>
- * <p>
- * Implementors must send the appropriate {@link NodeChangeEvent}
- * to listeners who are registered on this node's parent.
- * </p>
- * <p>
- * When this node is removed, its associated preference and node change
- * listeners should be removed as well.
- * </p>
- * @throws BackingStoreException if there was a problem removing this node
- * @see org.osgi.service.prefs.Preferences#removeNode()
- * @see NodeChangeEvent
- */
- public void removeNode() throws BackingStoreException;
-
- /**
- * Return the preferences node with the given path. The given path must
- * not be <code>null</code>.
- * <p>
- * See the spec of {@link Preferences#node(String)} for more details.
- * </p>
- * <p>
- * Note that if the node does not yet exist and is created, then the appropriate
- * {@link NodeChangeEvent} must be sent to listeners who are
- * registered at this node.
- * </p>
- * @param path the path of the node
- * @return the node
- * @see org.osgi.service.prefs.Preferences#node(String)
- * @see NodeChangeEvent
- */
- public Preferences node(String path);
-
- /**
- * 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 children.
- *
- * @param visitor the visitor
- * @see IPreferenceNodeVisitor#visit(IEclipsePreferences)
- * @throws BackingStoreException
- */
- public void accept(IPreferenceNodeVisitor visitor) throws BackingStoreException;
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IExportedPreferences.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IExportedPreferences.java
deleted file mode 100644
index 70ad2de..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IExportedPreferences.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.preferences;
-
-/**
- * Represents a node in the preference hierarchy which is used in
- * the import/export mechanism.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * @since 3.0
- */
-public interface IExportedPreferences extends IEclipsePreferences {
-
- /**
- * Return <code>true</code> if this node was an export root
- * when the preferences were exported, and <code>false</code>
- * otherwise. This information is used during the import to clear
- * nodes when importing a node's (and its children's) preferences.
- *
- * @return <code>true</code> if this node is an export root
- * and <code>false</code> otherwise
- */
- public boolean isExportRoot();
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IPreferenceFilter.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IPreferenceFilter.java
deleted file mode 100644
index 459cd51..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IPreferenceFilter.java
+++ /dev/null
@@ -1,77 +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.preferences;
-
-import java.util.Map;
-
-/**
- * Preference filters are used to describe the relationship between the
- * preference tree and a data set when importing/exporting preferences.
- * <p>
- * For instance, a client is able to create a preference filter describing
- * which preference nodes/keys should be used when exporting the
- * "Key Bindings" preferences. When the export happens, the tree is
- * trimmed and only the applicable preferences will be exported.
- * </p>
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @since 3.1
- */
-public interface IPreferenceFilter {
-
- /**
- * Return an array of scopes that this preference filter is applicable for. The list
- * of scopes must not be <code>null</code>.
- * <p>
- * For example:
- * <code>new String[] {InstanceScope.SCOPE, ConfigurationScope.SCOPE};</code>
- * </p>
- *
- * @return the array of scopes
- */
- public String[] getScopes();
-
- /**
- * Return a mapping which defines the nodes and keys that this filter
- * applies to.
- * <p>
- * If the map is <code>null</code> then this filter is applicable for all
- * nodes within the scope. The map can also be <code>null</code> if
- * the given scope is not known to this filter.
- * </p>
- * <p>
- * The keys in the table are Strings and describe the node path. The values are
- * an optional array of {@link PreferenceFilterEntry} objects describing the list of
- * applicable keys in that node. If the value is null then the whole node is
- * considered applicable.
- * </p>
- * <p>
- * key: <code>String</code> (node)<br>
- * value: <code>PreferenceFilterEntry[]</code> or <code>null</code> (preference keys)<br>
- * </p>
- * <p>
- * For example:
- * <pre>
- * "org.eclipse.core.resources" -> null
- * "org.eclipse.ui" -> new PreferenceFilterEntry[] {
- * new PreferenceFilterEntry("DEFAULT_PERSPECTIVE_LOCATION"),
- * new PreferenceFilterEntry("SHOW_INTRO_ON_STARTUP")}
- * </pre>
- * </p>
- *
- * @return the mapping table
- * @see PreferenceFilterEntry
- */
- public Map getMapping(String scope);
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IPreferenceNodeVisitor.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IPreferenceNodeVisitor.java
deleted file mode 100644
index 7d2a61f..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IPreferenceNodeVisitor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.preferences;
-
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * This interface is implemented by objects that visit preference nodes.
- * <p>
- * Usage:
- * <pre>
- * class Visitor implements IPreferenceNodeVisitor {
- * public boolean visit(IEclipsePreferences node) {
- * // your code here
- * return true;
- * }
- * }
- * IEclipsePreferences root = ...;
- * root.accept(new Visitor());
- * </pre>
- * </p><p>
- * Clients may implement this interface.
- * </p>
- *
- * @see IEclipsePreferences#accept(IPreferenceNodeVisitor)
- * @since 3.0
- */
-public interface IPreferenceNodeVisitor {
-
- /**
- * Visits the given preference node.
- *
- * @param node the node to visit
- * @return <code>true</code> if the node's children should
- * be visited; <code>false</code> if they should be skipped
- * @throws BackingStoreException
- */
- public boolean visit(IEclipsePreferences node) throws BackingStoreException;
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IPreferencesService.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IPreferencesService.java
deleted file mode 100644
index 1428700..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IPreferencesService.java
+++ /dev/null
@@ -1,618 +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.preferences;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * The preference service provides facilities for dealing with the default scope
- * precedence lookup order, querying the preference store for values using this order,
- * accessing the root of the preference store node hierarchy, and importing/exporting
- * preferences.
- * <p>
- * The default-default preference search look-up order as defined by the platform
- * is: project, instance, configuration, default.
- * </p><p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * @since 3.0
- */
-public interface IPreferencesService {
-
- /**
- * Lookup the given key in the specified preference nodes in the given order.
- * Return the value from the first node the key is found in. If the key is not
- * defined in any of the given nodes, then return the specified default value.
- * <p>
- * Immediately returns the default value if the node list is <code>null</code>.
- * If any of the individual entries in the node list are <code>null</code> then
- * skip over them and move on to the next node in the list.
- * </p>
- * @param key the preference key
- * @param defaultValue the default value
- * @param nodes the list of nodes to search, or <code>null</code>
- * @return the stored preference value or the specified default value
- * @see org.osgi.service.prefs.Preferences
- */
- public String get(String key, String defaultValue, Preferences[] nodes);
-
- /**
- * Return the value stored in the preference store for the given key.
- * If the key is not defined then return the specified default value.
- * Use the canonical scope lookup order for finding the preference value.
- * <p>
- * The semantics of this method are to calculate the appropriate
- * {@link Preferences} nodes in the preference hierarchy to use
- * and then call the {@link #get(String, String, Preferences[])}
- * method. The order of the nodes is calculated by consulting the default
- * scope lookup order as set by {@link #setDefaultLookupOrder(String, String, String[])}.
- * </p><p>
- * The specified key may either refer to a simple key or be the concatenation of the
- * path of a child node and key. If the key contains a slash ("/") character, then a
- * double-slash must be used to denote the end of they child path and the beginning
- * of the key. Otherwise it is assumed that the key is the last segment of the path.
- * The following are some examples of keys and their meanings:
- * <ul>
- * <li>"a" - look for a value for the property "a"
- * <li>"//a" - look for a value for the property "a"
- * <li>"///a" - look for a value for the property "/a"
- * <li>"//a//b" - look for a value for the property "a//b"
- * <li>"a/b/c" - look in the child node "a/b" for property "c"
- * <li>"/a/b/c" - look in the child node "a/b" for property "c"
- * <li>"/a/b//c" - look in the child node "a/b" for the property "c"
- * <li>"a/b//c/d" - look in the child node "a/b" for the property "c/d"
- * <li>"/a/b//c/d" - look in the child node "a/b" for the property "c/d"
- * <li>"/a/b//c//d" - look in the child node "a/b" for the property "c//d"
- * </ul>
- * </p><p>
- * Callers may specify an array of scope context objects to aid in the
- * determination of the correct nodes. For each entry in the lookup
- * order, the array of contexts is consulted and if one matching the
- * scope exists, then it is used to calculate the node. Otherwise a
- * default calculation algorithm is used.
- * </p><p>
- * An example of a qualifier for an Eclipse 2.1 preference is the
- * plug-in identifier. (e.g. "org.eclipse.core.resources" for "description.autobuild")
- * </p>
- * @param qualifier a namespace qualifier for the preference
- * @param key the name of the preference (optionally including its path)
- * @param defaultValue the value to use if the preference is not defined
- * @param contexts optional context objects to help scopes determine which nodes to search, or <code>null</code>
- * @return the value of the preference or the given default value
- * @see IScopeContext
- * @see #get(java.lang.String, java.lang.String, org.osgi.service.prefs.Preferences[])
- * @see #getLookupOrder(java.lang.String, java.lang.String)
- * @see #getDefaultLookupOrder(java.lang.String, java.lang.String)
- */
- public boolean getBoolean(String qualifier, String key, boolean defaultValue, IScopeContext[] contexts);
-
- /**
- * Return the value stored in the preference store for the given key.
- * If the key is not defined then return the specified default value.
- * Use the canonical scope lookup order for finding the preference value.
- * <p>
- * The semantics of this method are to calculate the appropriate
- * {@link Preferences} nodes in the preference hierarchy to use
- * and then call the {@link #get(String, String, Preferences[])}
- * method. The order of the nodes is calculated by consulting the default
- * scope lookup order as set by {@link #setDefaultLookupOrder(String, String, String[])}.
- * </p><p>
- * The specified key may either refer to a simple key or be the concatenation of the
- * path of a child node and key. If the key contains a slash ("/") character, then a
- * double-slash must be used to denote the end of they child path and the beginning
- * of the key. Otherwise it is assumed that the key is the last segment of the path.
- * The following are some examples of keys and their meanings:
- * <ul>
- * <li>"a" - look for a value for the property "a"
- * <li>"//a" - look for a value for the property "a"
- * <li>"///a" - look for a value for the property "/a"
- * <li>"//a//b" - look for a value for the property "a//b"
- * <li>"a/b/c" - look in the child node "a/b" for property "c"
- * <li>"/a/b/c" - look in the child node "a/b" for property "c"
- * <li>"/a/b//c" - look in the child node "a/b" for the property "c"
- * <li>"a/b//c/d" - look in the child node "a/b" for the property "c/d"
- * <li>"/a/b//c/d" - look in the child node "a/b" for the property "c/d"
- * <li>"/a/b//c//d" - look in the child node "a/b" for the property "c//d"
- * </ul>
- * </p><p>
- * Callers may specify an array of scope context objects to aid in the
- * determination of the correct nodes. For each entry in the lookup
- * order, the array of contexts is consulted and if one matching the
- * scope exists, then it is used to calculate the node. Otherwise a
- * default calculation algorithm is used.
- * </p><p>
- * An example of a qualifier for an Eclipse 2.1 preference is the
- * plug-in identifier. (e.g. "org.eclipse.core.resources" for "description.autobuild")
- * </p>
- * @param qualifier a namespace qualifier for the preference
- * @param key the name of the preference (optionally including its path)
- * @param defaultValue the value to use if the preference is not defined
- * @param contexts optional context objects to help scopes determine which nodes to search, or <code>null</code>
- * @return the value of the preference or the given default value
- * @see IScopeContext
- * @see #get(java.lang.String, java.lang.String, org.osgi.service.prefs.Preferences[])
- * @see #getLookupOrder(java.lang.String, java.lang.String)
- * @see #getDefaultLookupOrder(java.lang.String, java.lang.String)
- */
- public byte[] getByteArray(String qualifier, String key, byte[] defaultValue, IScopeContext[] contexts);
-
- /**
- * Return the value stored in the preference store for the given key.
- * If the key is not defined then return the specified default value.
- * Use the canonical scope lookup order for finding the preference value.
- * <p>
- * The semantics of this method are to calculate the appropriate
- * {@link Preferences} nodes in the preference hierarchy to use
- * and then call the {@link #get(String, String, Preferences[])}
- * method. The order of the nodes is calculated by consulting the default
- * scope lookup order as set by {@link #setDefaultLookupOrder(String, String, String[])}.
- * </p><p>
- * The specified key may either refer to a simple key or be the concatenation of the
- * path of a child node and key. If the key contains a slash ("/") character, then a
- * double-slash must be used to denote the end of they child path and the beginning
- * of the key. Otherwise it is assumed that the key is the last segment of the path.
- * The following are some examples of keys and their meanings:
- * <ul>
- * <li>"a" - look for a value for the property "a"
- * <li>"//a" - look for a value for the property "a"
- * <li>"///a" - look for a value for the property "/a"
- * <li>"//a//b" - look for a value for the property "a//b"
- * <li>"a/b/c" - look in the child node "a/b" for property "c"
- * <li>"/a/b/c" - look in the child node "a/b" for property "c"
- * <li>"/a/b//c" - look in the child node "a/b" for the property "c"
- * <li>"a/b//c/d" - look in the child node "a/b" for the property "c/d"
- * <li>"/a/b//c/d" - look in the child node "a/b" for the property "c/d"
- * <li>"/a/b//c//d" - look in the child node "a/b" for the property "c//d"
- * </ul>
- * </p><p>
- * Callers may specify an array of scope context objects to aid in the
- * determination of the correct nodes. For each entry in the lookup
- * order, the array of contexts is consulted and if one matching the
- * scope exists, then it is used to calculate the node. Otherwise a
- * default calculation algorithm is used.
- * </p><p>
- * An example of a qualifier for an Eclipse 2.1 preference is the
- * plug-in identifier. (e.g. "org.eclipse.core.resources" for "description.autobuild")
- * </p>
- * @param qualifier a namespace qualifier for the preference
- * @param key the name of the preference (optionally including its path)
- * @param defaultValue the value to use if the preference is not defined
- * @param contexts optional context objects to help scopes determine which nodes to search, or <code>null</code>
- * @return the value of the preference or the given default value
- * @see IScopeContext
- * @see #get(java.lang.String, java.lang.String, org.osgi.service.prefs.Preferences[])
- * @see #getLookupOrder(java.lang.String, java.lang.String)
- * @see #getDefaultLookupOrder(java.lang.String, java.lang.String)
- */
- public double getDouble(String qualifier, String key, double defaultValue, IScopeContext[] contexts);
-
- /**
- * Return the value stored in the preference store for the given key.
- * If the key is not defined then return the specified default value.
- * Use the canonical scope lookup order for finding the preference value.
- * <p>
- * The semantics of this method are to calculate the appropriate
- * {@link Preferences} nodes in the preference hierarchy to use
- * and then call the {@link #get(String, String, Preferences[])}
- * method. The order of the nodes is calculated by consulting the default
- * scope lookup order as set by {@link #setDefaultLookupOrder(String, String, String[])}.
- * </p><p>
- * The specified key may either refer to a simple key or be the concatenation of the
- * path of a child node and key. If the key contains a slash ("/") character, then a
- * double-slash must be used to denote the end of they child path and the beginning
- * of the key. Otherwise it is assumed that the key is the last segment of the path.
- * The following are some examples of keys and their meanings:
- * <ul>
- * <li>"a" - look for a value for the property "a"
- * <li>"//a" - look for a value for the property "a"
- * <li>"///a" - look for a value for the property "/a"
- * <li>"//a//b" - look for a value for the property "a//b"
- * <li>"a/b/c" - look in the child node "a/b" for property "c"
- * <li>"/a/b/c" - look in the child node "a/b" for property "c"
- * <li>"/a/b//c" - look in the child node "a/b" for the property "c"
- * <li>"a/b//c/d" - look in the child node "a/b" for the property "c/d"
- * <li>"/a/b//c/d" - look in the child node "a/b" for the property "c/d"
- * <li>"/a/b//c//d" - look in the child node "a/b" for the property "c//d"
- * </ul>
- * </p><p>
- * Callers may specify an array of scope context objects to aid in the
- * determination of the correct nodes. For each entry in the lookup
- * order, the array of contexts is consulted and if one matching the
- * scope exists, then it is used to calculate the node. Otherwise a
- * default calculation algorithm is used.
- * </p><p>
- * An example of a qualifier for an Eclipse 2.1 preference is the
- * plug-in identifier. (e.g. "org.eclipse.core.resources" for "description.autobuild")
- * </p>
- * @param qualifier a namespace qualifier for the preference
- * @param key the name of the preference (optionally including its path)
- * @param defaultValue the value to use if the preference is not defined
- * @param contexts optional context objects to help scopes determine which nodes to search, or <code>null</code>
- * @return the value of the preference or the given default value
- * @see IScopeContext
- * @see #get(java.lang.String, java.lang.String, org.osgi.service.prefs.Preferences[])
- * @see #getLookupOrder(java.lang.String, java.lang.String)
- * @see #getDefaultLookupOrder(java.lang.String, java.lang.String)
- */
- public float getFloat(String qualifier, String key, float defaultValue, IScopeContext[] contexts);
-
- /**
- * Return the value stored in the preference store for the given key.
- * If the key is not defined then return the specified default value.
- * Use the canonical scope lookup order for finding the preference value.
- * <p>
- * The semantics of this method are to calculate the appropriate
- * {@link Preferences} nodes in the preference hierarchy to use
- * and then call the {@link #get(String, String, Preferences[])}
- * method. The order of the nodes is calculated by consulting the default
- * scope lookup order as set by {@link #setDefaultLookupOrder(String, String, String[])}.
- * </p><p>
- * The specified key may either refer to a simple key or be the concatenation of the
- * path of a child node and key. If the key contains a slash ("/") character, then a
- * double-slash must be used to denote the end of they child path and the beginning
- * of the key. Otherwise it is assumed that the key is the last segment of the path.
- * The following are some examples of keys and their meanings:
- * <ul>
- * <li>"a" - look for a value for the property "a"
- * <li>"//a" - look for a value for the property "a"
- * <li>"///a" - look for a value for the property "/a"
- * <li>"//a//b" - look for a value for the property "a//b"
- * <li>"a/b/c" - look in the child node "a/b" for property "c"
- * <li>"/a/b/c" - look in the child node "a/b" for property "c"
- * <li>"/a/b//c" - look in the child node "a/b" for the property "c"
- * <li>"a/b//c/d" - look in the child node "a/b" for the property "c/d"
- * <li>"/a/b//c/d" - look in the child node "a/b" for the property "c/d"
- * <li>"/a/b//c//d" - look in the child node "a/b" for the property "c//d"
- * </ul>
- * </p><p>
- * Callers may specify an array of scope context objects to aid in the
- * determination of the correct nodes. For each entry in the lookup
- * order, the array of contexts is consulted and if one matching the
- * scope exists, then it is used to calculate the node. Otherwise a
- * default calculation algorithm is used.
- * </p><p>
- * An example of a qualifier for an Eclipse 2.1 preference is the
- * plug-in identifier. (e.g. "org.eclipse.core.resources" for "description.autobuild")
- * </p>
- * @param qualifier a namespace qualifier for the preference
- * @param key the name of the preference (optionally including its path)
- * @param defaultValue the value to use if the preference is not defined
- * @param contexts optional context objects to help scopes determine which nodes to search, or <code>null</code>
- * @return the value of the preference or the given default value
- * @see IScopeContext
- * @see #get(java.lang.String, java.lang.String, org.osgi.service.prefs.Preferences[])
- * @see #getLookupOrder(java.lang.String, java.lang.String)
- * @see #getDefaultLookupOrder(java.lang.String, java.lang.String)
- */
- public int getInt(String qualifier, String key, int defaultValue, IScopeContext[] contexts);
-
- /**
- * Return the value stored in the preference store for the given key.
- * If the key is not defined then return the specified default value.
- * Use the canonical scope lookup order for finding the preference value.
- * <p>
- * The semantics of this method are to calculate the appropriate
- * {@link Preferences} nodes in the preference hierarchy to use
- * and then call the {@link #get(String, String, Preferences[])}
- * method. The order of the nodes is calculated by consulting the default
- * scope lookup order as set by {@link #setDefaultLookupOrder(String, String, String[])}.
- * </p><p>
- * The specified key may either refer to a simple key or be the concatenation of the
- * path of a child node and key. If the key contains a slash ("/") character, then a
- * double-slash must be used to denote the end of they child path and the beginning
- * of the key. Otherwise it is assumed that the key is the last segment of the path.
- * The following are some examples of keys and their meanings:
- * <ul>
- * <li>"a" - look for a value for the property "a"
- * <li>"//a" - look for a value for the property "a"
- * <li>"///a" - look for a value for the property "/a"
- * <li>"//a//b" - look for a value for the property "a//b"
- * <li>"a/b/c" - look in the child node "a/b" for property "c"
- * <li>"/a/b/c" - look in the child node "a/b" for property "c"
- * <li>"/a/b//c" - look in the child node "a/b" for the property "c"
- * <li>"a/b//c/d" - look in the child node "a/b" for the property "c/d"
- * <li>"/a/b//c/d" - look in the child node "a/b" for the property "c/d"
- * <li>"/a/b//c//d" - look in the child node "a/b" for the property "c//d"
- * </ul>
- * </p><p>
- * Callers may specify an array of scope context objects to aid in the
- * determination of the correct nodes. For each entry in the lookup
- * order, the array of contexts is consulted and if one matching the
- * scope exists, then it is used to calculate the node. Otherwise a
- * default calculation algorithm is used.
- * </p><p>
- * An example of a qualifier for an Eclipse 2.1 preference is the
- * plug-in identifier. (e.g. "org.eclipse.core.resources" for "description.autobuild")
- * </p>
- * @param qualifier a namespace qualifier for the preference
- * @param key the name of the preference (optionally including its path)
- * @param defaultValue the value to use if the preference is not defined
- * @param contexts optional context objects to help scopes determine which nodes to search, or <code>null</code>
- * @return the value of the preference or the given default value
- * @see IScopeContext
- * @see #get(java.lang.String, java.lang.String, org.osgi.service.prefs.Preferences[])
- * @see #getLookupOrder(java.lang.String, java.lang.String)
- * @see #getDefaultLookupOrder(java.lang.String, java.lang.String)
- */
- public long getLong(String qualifier, String key, long defaultValue, IScopeContext[] contexts);
-
- /**
- * Return the value stored in the preference store for the given key.
- * If the key is not defined then return the specified default value.
- * Use the canonical scope lookup order for finding the preference value.
- * <p>
- * The semantics of this method are to calculate the appropriate
- * {@link Preferences} nodes in the preference hierarchy to use
- * and then call the {@link #get(String, String, Preferences[])}
- * method. The order of the nodes is calculated by consulting the default
- * scope lookup order as set by {@link #setDefaultLookupOrder(String, String, String[])}.
- * </p><p>
- * The specified key may either refer to a simple key or be the concatenation of the
- * path of a child node and key. If the key contains a slash ("/") character, then a
- * double-slash must be used to denote the end of they child path and the beginning
- * of the key. Otherwise it is assumed that the key is the last segment of the path.
- * The following are some examples of keys and their meanings:
- * <ul>
- * <li>"a" - look for a value for the property "a"
- * <li>"//a" - look for a value for the property "a"
- * <li>"///a" - look for a value for the property "/a"
- * <li>"//a//b" - look for a value for the property "a//b"
- * <li>"a/b/c" - look in the child node "a/b" for property "c"
- * <li>"/a/b/c" - look in the child node "a/b" for property "c"
- * <li>"/a/b//c" - look in the child node "a/b" for the property "c"
- * <li>"a/b//c/d" - look in the child node "a/b" for the property "c/d"
- * <li>"/a/b//c/d" - look in the child node "a/b" for the property "c/d"
- * <li>"/a/b//c//d" - look in the child node "a/b" for the property "c//d"
- * </ul>
- * </p><p>
- * Callers may specify an array of scope context objects to aid in the
- * determination of the correct nodes. For each entry in the lookup
- * order, the array of contexts is consulted and if one matching the
- * scope exists, then it is used to calculate the node. Otherwise a
- * default calculation algorithm is used.
- * </p><p>
- * An example of a qualifier for an Eclipse 2.1 preference is the
- * plug-in identifier. (e.g. "org.eclipse.core.resources" for "description.autobuild")
- * </p>
- * @param qualifier a namespace qualifier for the preference
- * @param key the name of the preference (optionally including its path)
- * @param defaultValue the value to use if the preference is not defined
- * @param contexts optional context objects to help scopes determine which nodes to search, or <code>null</code>
- * @return the value of the preference or the given default value
- * @see IScopeContext
- * @see #get(java.lang.String, java.lang.String, org.osgi.service.prefs.Preferences[])
- * @see #getLookupOrder(java.lang.String, java.lang.String)
- * @see #getDefaultLookupOrder(java.lang.String, java.lang.String)
- */
- public String getString(String qualifier, String key, String defaultValue, IScopeContext[] contexts);
-
- /**
- * Return the root node of the Eclipse preference hierarchy.
- *
- * @return the root of the hierarchy
- */
- public IEclipsePreferences getRootNode();
-
- /**
- * Exports all preferences for the given preference node and all its children to the specified
- * output stream. It is the responsibility of the client to close the given output stream.
- * <p>
- * If the given export list is <code>null</code> then all preferences for all sub-nodes
- * of the given node are exported to the given stream. Otherwise the export list is
- * consulted before exporting each preference value. If there is a string match then
- * the preference is not exported. The exclusion can also occur at a per-node level.
- * Wild cards are <em>not</em> accepted in the excludes list as a basic String compare
- * is done. The basic algorithm is similar to the following:
- * <pre>
- * String fullPath = node.absolutePath() + '/' + key;
- * if (!fullPath.startsWith(excludesList[i]))
- * // export preference
- * </pre>
- * </p>
- * <p>
- * The values stored in the resulting stream are suitable for later being read by the
- * by {@link #importPreferences(InputStream)} or {@link #readPreferences(InputStream)} methods.
- * </p>
- * @param node the node to treat as the root of the export
- * @param output the stream to write to
- * @param excludesList a list of path prefixes to exclude from the export, or <code>null</code>
- * @return a status object describing success or detailing failure reasons
- * @throws CoreException if there was a problem exporting the preferences
- * @throws IllegalArgumentException if the node or stream is <code>null</code>
- * @see #importPreferences(java.io.InputStream)
- * @see #readPreferences(InputStream)
- */
- public IStatus exportPreferences(IEclipsePreferences node, OutputStream output, String[] excludesList) throws CoreException;
-
- /**
- * Loads preferences from the given file and stores them in the preferences store.
- * Existing values are over-ridden by those from the stream. The stream must not be
- * <code>null</code> and is closed upon return from this method.
- * <p>
- * This file must have been written by the
- * {@link #exportPreferences(IEclipsePreferences, OutputStream, String[])}
- * method.
- * </p>
- * <p>
- * This method is equivalent to calling <code>applyPreferences(readPreferences(input));</code>.
- * </p>
- * @param input the stream to load the preferences from
- * @return a status object describing success or detailing failure reasons
- * @throws CoreException if there are problems importing the preferences
- * @throws IllegalArgumentException if the stream is <code>null</code>
- * @see #exportPreferences(IEclipsePreferences, OutputStream, String[])
- */
- public IStatus importPreferences(InputStream input) throws CoreException;
-
- /**
- * Take the given preference tree and apply it to the Eclipse
- * global preference hierarchy. If a node is an export root, then
- * remove it from the global tree before adding any preferences
- * contained in it or its children. The given preferences object
- * must not be <code>null</code>.
- * <p>
- * Before the tree is applied to the global preference tree,
- * the registered <code>PreferenceModifyListener</code> objects
- * are called and given the opportunity to modify the tree.
- * </p>
- *
- * @param preferences the preferences to apply globally
- * @return status object indicating success or failure
- * @throws IllegalArgumentException if the preferences are <code>null</code>
- * @throws CoreException if there are problems applying the preferences
- * @see PreferenceModifyListener
- */
- public IStatus applyPreferences(IExportedPreferences preferences) throws CoreException;
-
- /**
- * Read from the given input stream and create a node hierarchy
- * representing the preferences and their values. The given input stream
- * must not be <code>null</code>. The result of this function is suitable
- * for passing as an argument to {@link #applyPreferences(IExportedPreferences)}.
- * <p>
- * It is assumed the contents of the input stream have been written by
- * {@link #exportPreferences(IEclipsePreferences, OutputStream, String[])}.
- * </p>
- * @param input the input stream to read from
- * @return the node hierarchy representing the stream contents
- * @throws IllegalArgumentException if the given stream is null
- * @throws CoreException if there are problems reading the preferences
- * @see #exportPreferences(IEclipsePreferences, OutputStream, String[])
- * @see #applyPreferences(IExportedPreferences)
- */
- public IExportedPreferences readPreferences(InputStream input) throws CoreException;
-
- /**
- * Return an array with the default lookup order for the preference keyed by the given
- * qualifier and simple name. Return <code>null</code> if no default has been set.
- * <p>
- * The lookup order returned is based on an exact match to the specified qualifier
- * and simple name. For instance, if the given key is non-<code>null</code> and
- * no default lookup order is found, the default lookup order for the qualifier (and a
- * <code>null</code> key) is <em>NOT</em> returned. Clients should call
- * {@link #getLookupOrder(String, String)} if they desire this behavior.
- * </p>
- * @param qualifier the namespace qualifier for the preference
- * @param key the preference name or <code>null</code>
- * @return the scope order or <code>null</code>
- * @see #setDefaultLookupOrder(String, String, String[])
- * @see #getLookupOrder(String, String)
- */
- public String[] getDefaultLookupOrder(String qualifier, String key);
-
- /**
- * Return an array with the lookup order for the preference keyed by the given
- * qualifier and simple name.
- * <p>
- * First do an exact match lookup with the given qualifier and simple name. If a match
- * is found then return it. Otherwise if the key is non-<code>null</code> then
- * do a lookup based on only the qualifier and return the set value.
- * Return the default-default order as defined by the platform if no order has been set.
- * </p>
- * @param qualifier the namespace qualifier for the preference
- * @param key the preference name or <code>null</code>
- * @return the scope order
- * @throws IllegalArgumentException if the qualifier is <code>null</code>
- * @see #getDefaultLookupOrder(String, String)
- * @see #setDefaultLookupOrder(String, String, String[])
- */
- public String[] getLookupOrder(String qualifier, String key);
-
- /**
- * Set the default scope lookup order for the preference keyed by the given
- * qualifier and simple name. If the given order is <code>null</code> then the set
- * ordering (if it exists) is removed.
- * <p>
- * If the given simple name is <code>null</code> then set the given lookup
- * order to be used for all keys with the given qualifier.
- * </p><p>
- * Note that the default lookup order is not persisted across platform invocations.
- * </p>
- * @param qualifier the namespace qualifier for the preference
- * @param key the preference name or <code>null</code>
- * @param order the lookup order or <code>null</code>
- * @throws IllegalArgumentException
- * <ul>
- * <li>if the qualifier is <code>null</code></li>
- * <li>if an entry in the order array is <code>null</code> (the array itself is
- * allowed to be <code>null</code></li>
- * </ul>
- * @see #getDefaultLookupOrder(String, String)
- */
- public void setDefaultLookupOrder(String qualifier, String key, String[] order);
-
- /**
- * Export the preference tree rooted at the given node, to the specified output
- * stream. Apply the given list of preference filters, only exporting
- * preference node and keys which are applicable to at least one filter in the list.
- * <p>
- * The given node and output stream must not be <code>null</code>.
- * If the list of filters is <code>null</code> or empty then do nothing.
- * </p>
- * <p>
- * It is the responsibility of the client to close the given output stream.
- * </p>
- *
- * @param node the tree to export
- * @param filters the list of filters to export
- * @param output the stream to export to
- * @throws CoreException
- * @see #exportPreferences(IEclipsePreferences, OutputStream, String[])
- * @see #readPreferences(InputStream)
- * @see #applyPreferences(IEclipsePreferences, IPreferenceFilter[])
- * @see #applyPreferences(IExportedPreferences)
- * @see IPreferenceFilter
- * @since 3.1
- */
- public void exportPreferences(IEclipsePreferences node, IPreferenceFilter[] filters, OutputStream output) throws CoreException;
-
- /**
- * Return a list of filters which match the given tree and is a subset of the given
- * filter list. If the specified list of filters is <code>null</code>, empty, or there
- * are no matches, then return an empty list.
- *
- * @param node the tree to match against
- * @param filters the list of filters to match against
- * @return the array of matching transfers
- * @throws CoreException
- * @see IPreferenceFilter
- * @since 3.1
- */
- public IPreferenceFilter[] matches(IEclipsePreferences node, IPreferenceFilter[] filters) throws CoreException;
-
- /**
- * Apply the preference tree rooted at the given node, to the system's preference tree.
- * The list of preference filters will act as a filter and only preferences in the tree which
- * apply to at least one filter in the list, will be applied.
- * <p>
- * If the list of filters is <code>null</code> or empty then do nothing.
- * </p>
- * <p>
- * Before the tree is applied to the global preference tree,
- * the registered <code>PreferenceModifyListener</code> objects
- * are called and given the opportunity to modify the tree.
- * </p>
- *
- * @param node the tree to consider applying
- * @param filters the filters to use
- * @throws CoreException
- * @see #applyPreferences(IExportedPreferences)
- * @see #readPreferences(InputStream)
- * @see IPreferenceFilter
- * @see PreferenceModifyListener
- * @since 3.1
- */
- public void applyPreferences(IEclipsePreferences node, IPreferenceFilter[] filters) throws CoreException;
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IScope.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IScope.java
deleted file mode 100644
index 29d3c19..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IScope.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.preferences;
-
-/**
- * Clients contributing a scope to the Eclipse preference system must
- * implement this interface to aid Eclipse in creating a new node for the
- * hierarchy.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @since 3.0
- */
-public interface IScope {
-
- /**
- * Create and return a new preference node with the given parent and name.
- * Must not return <code>null</code>. Clients are able to create a new node
- * in memory or load the node's contents from the backing store. Neither the
- * parent or name arguments should be <code>null</code>.
- * <p>
- * Implementors should note that the node might not have been added to the
- * child list of the parent yet, and therefore might not be able to be referenced
- * through navigation from the root node.
- * </p>
- * @param parent the node's parent
- * @param name the name of the node
- * @return the new node
- */
- public IEclipsePreferences create(IEclipsePreferences parent, String name);
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IScopeContext.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IScopeContext.java
deleted file mode 100644
index f1fd760..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/IScopeContext.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.runtime.preferences;
-
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Clients implement this interface to provide context to a
- * particular scope. Instances of implementations of this interface are
- * passed to the {@link IPreferencesService} for use in
- * preference searching.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see IPreferencesService
- * @since 3.0
- */
-public interface IScopeContext {
-
- /**
- * Return the name of the scope that this context is associated with.
- * Must not be <code>null</code>.
- *
- * @return the name of the scope
- */
- public String getName();
-
- /**
- * Return the preferences node that contains the preferences for the
- * given qualifier or <code>null</code> if the node cannot be determined.
- * The given qualifier must not be <code>null</code> but may be a path
- * to a sub-node within the scope.
- * <p>
- * An example of a qualifier in Eclipse 2.1 would be the plug-in identifier that
- * the preference is associated with (e.g. the "org.eclipse.core.resources"
- * plug-in defines the "description.autobuild" preference).
- * </p><p>
- * This method can be used to determine the appropriate preferences node
- * to aid in setting key/value pairs. For instance:
- * <code>new InstanceScope().getNode("org.eclipse.core.resources");</code>
- * returns the preference node in the instance scope where the preferences
- * for "org.eclipse.core.resources" are stored.
- * </p>
- * @param qualifier a qualifier for the preference name
- * @return the node containing the plug-in preferences or <code>null</code>
- * @see IPreferencesService
- */
- public IEclipsePreferences getNode(String qualifier);
-
- /**
- * Return a path to a location in the file-system where clients are able
- * to write files that will have the same sharing/scope properties as
- * preferences defined in this scope.
- * <p>
- * Implementors may return <code>null</code> if the location is not known,
- * is unavailable, or is not applicable to this scope.
- * </p>
- * @return a writable location in the file system or <code>null</code>
- */
- public IPath getLocation();
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/InstanceScope.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/InstanceScope.java
deleted file mode 100644
index 75612ec..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/InstanceScope.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.preferences;
-
-import org.eclipse.core.internal.preferences.AbstractScope;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Object representing the instance scope in the Eclipse preferences
- * hierarchy. Can be used as a context for searching for preference
- * values (in the IPreferencesService APIs) or for determining the
- * correct preference node to set values in the store.
- * <p>
- * Instance preferences are stored on a per instance basis in the
- * platform's instance area as specified by {@link org.eclipse.core.runtime.Platform#getInstanceLocation}.
- * </p><p>
- * The path for preferences defined in the instance scope hierarchy
- * is as follows: <code>/instance/<qualifier></code>
- * </p>
- * <p>
- * This class is not intended to be subclassed. This class may be instantiated.
- * </p>
- * @see org.eclipse.core.runtime.Platform#getInstanceLocation()
- * @since 3.0
- */
-public final class InstanceScope extends AbstractScope {
-
- /**
- * String constant (value of <code>"instance"</code>) used for the
- * scope name for the instance preference scope.
- */
- public static final String SCOPE = "instance"; //$NON-NLS-1$
-
- /**
- * Create and return a new instance scope instance.
- */
- public InstanceScope() {
- super();
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IScopeContext#getLocation()
- */
- public IPath getLocation() {
- // Return null. The instance location usually corresponds to the state
- // location of the bundle and we don't know what bundle we are dealing with.
- return null;
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IScopeContext#getName()
- */
- public String getName() {
- return SCOPE;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/PreferenceFilterEntry.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/PreferenceFilterEntry.java
deleted file mode 100644
index dc6470f..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/PreferenceFilterEntry.java
+++ /dev/null
@@ -1,47 +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.preferences;
-
-/**
- * Class which represents and preference filter entry to be used during preference
- * import/export (for example).
- *
- * @since 3.1
- * @see org.eclipse.core.runtime.preferences.IPreferenceFilter
- */
-public final class PreferenceFilterEntry {
-
- private String key;
-
- /**
- * Constructor for the class. Create a new preference filter entry with the given
- * key. The key must <em>not</em> be <code>null</code> or empty.
- *
- * @param key the name of the preference key
- */
- public PreferenceFilterEntry(String key) {
- super();
- if (key == null || key.length() == 0)
- throw new IllegalArgumentException();
- this.key = key;
- }
-
- /**
- * Return the name of the preference key for this filter entry.
- * It will <em>not</em> return <code>null</code> or the
- * empty string.
- *
- * @return the name of the preference key
- */
- public String getKey() {
- return key;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/PreferenceModifyListener.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/PreferenceModifyListener.java
deleted file mode 100644
index 7149a3a..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/PreferenceModifyListener.java
+++ /dev/null
@@ -1,49 +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.preferences;
-
-/**
- * This class provides a hook into the preference service before particular operations
- * on the global preference tree. Preference modify listeners are registered with
- * the preference service via XML and the <code>org.eclipse.core.runtime.preferences</code>
- * extension point.
- * <p>
- * Clients may subclass this type.
- * </p>
- *
- * @since 3.1
- */
-public abstract class PreferenceModifyListener {
-
- /**
- * Clients are given the opportunity to modify the given tree before it is applied
- * to the global preference tree. Clients should return the tree which should be
- * applied globally. The tree passed in will not be <code>null</code> and clients
- * <em>must not</em> return a <code>null</code> tree.
- * <p>
- * This method is called by the preference service from within calls to
- * {@link IPreferencesService#applyPreferences(IExportedPreferences)} or
- * {@link IPreferencesService#applyPreferences(IEclipsePreferences, IPreferenceFilter[])}.
- * </p>
- * <p>
- * A typical action for clients to perform would be to intercept the incoming preference tree,
- * migrate old preference values to new ones, and then return the new tree.
- * </p>
- *
- * @param node the tree to modify
- * @return the tree to apply to the global preferences
- */
- public IEclipsePreferences preApply(IEclipsePreferences node) {
- // default implementation makes no modifications
- return node;
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/package.html b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/package.html
deleted file mode 100644
index 7c88d88..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/preferences/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 core support for Eclipse preferences.
-<h2>
-Package Specification</h2>
-<p>
-This package specifies API for defining and accessing preferences in the runtime.
-<p>
-@since 3.0
-<p>
-</body>
-</html>
diff --git a/bundles/org.eclipse.core.runtime/src/org/osgi/service/prefs/BackingStoreException.java b/bundles/org.eclipse.core.runtime/src/org/osgi/service/prefs/BackingStoreException.java
deleted file mode 100644
index b07f69e..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/osgi/service/prefs/BackingStoreException.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * $Header: /cvshome/build/org.osgi.service.prefs/src/org/osgi/service/prefs/BackingStoreException.java,v 1.9 2005/08/11 03:07:45 hargrave Exp $
- *
- * Copyright (c) OSGi Alliance (2001, 2005). All Rights Reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this
- * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html.
- */
-package org.osgi.service.prefs;
-
-/**
- * Thrown to indicate that a preferences operation could not complete because of
- * a failure in the backing store, or a failure to contact the backing store.
- *
- * @version $Revision: 1.9 $
- */
-public class BackingStoreException extends Exception {
- static final long serialVersionUID = -1415637364122829574L;
- /**
- * Nested exception.
- */
- private Throwable cause;
-
- /**
- * Constructs a <code>BackingStoreException</code> with the specified detail
- * message.
- *
- * @param s The detail message.
- */
- public BackingStoreException(String s) {
- super(s);
- }
-
- /**
- * Constructs a <code>BackingStoreException</code> with the specified detail
- * message.
- *
- * @param s The detail message.
- * @param cause The cause of the exception. May be <code>null</code>.
- * @since 1.1
- */
- public BackingStoreException(String s, Throwable cause) {
- super(s);
- this.cause = cause;
- }
-
- /**
- * Returns the cause of this exception or <code>null</code> if no cause was
- * specified when this exception was created.
- *
- * @return The cause of this exception or <code>null</code> if no cause was
- * specified.
- * @since 1.1
- */
- public Throwable getCause() {
- return cause;
- }
-
- /**
- * The cause of this exception can only be set when constructed.
- *
- * @param cause Cause of the exception.
- * @return This object.
- * @throws java.lang.IllegalStateException This method will always throw an
- * <code>IllegalStateException</code> since the cause of this
- * exception can only be set when constructed.
- * @since 1.1
- */
- public Throwable initCause(Throwable cause) {
- throw new IllegalStateException();
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime/src/org/osgi/service/prefs/Preferences.java b/bundles/org.eclipse.core.runtime/src/org/osgi/service/prefs/Preferences.java
deleted file mode 100644
index 6cc5c4c..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/osgi/service/prefs/Preferences.java
+++ /dev/null
@@ -1,694 +0,0 @@
-/*
- * $Header: /cvshome/build/org.osgi.service.prefs/src/org/osgi/service/prefs/Preferences.java,v 1.8 2005/08/10 01:07:52 hargrave Exp $
- *
- * Copyright (c) OSGi Alliance (2001, 2005). All Rights Reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this
- * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html.
- */
-package org.osgi.service.prefs;
-
-/**
- * A node in a hierarchical collection of preference data.
- *
- * <p>
- * This interface allows applications to store and retrieve user and system
- * preference data. This data is stored persistently in an
- * implementation-dependent backing store. Typical implementations include flat
- * files, OS-specific registries, directory servers and SQL databases.
- *
- * <p>
- * For each bundle, there is a separate tree of nodes for each user, and one for
- * system preferences. The precise description of "user" and "system" will vary
- * from one bundle to another. Typical information stored in the user preference
- * tree might include font choice, and color choice for a bundle which interacts
- * with the user via a servlet. Typical information stored in the system
- * preference tree might include installation data, or things like high score
- * information for a game program.
- *
- * <p>
- * Nodes in a preference tree are named in a similar fashion to directories in a
- * hierarchical file system. Every node in a preference tree has a <i>node name
- * </i> (which is not necessarily unique), a unique <i>absolute path name </i>,
- * and a path name <i>relative </i> to each ancestor including itself.
- *
- * <p>
- * The root node has a node name of the empty <code>String</code> object ("").
- * Every other node has an arbitrary node name, specified at the time it is
- * created. The only restrictions on this name are that it cannot be the empty
- * string, and it cannot contain the slash character ('/').
- *
- * <p>
- * The root node has an absolute path name of <code>"/"</code>. Children of the
- * root node have absolute path names of <code>"/" + </code> <i><node name>
- * </i>. All other nodes have absolute path names of <i><parent's absolute
- * path name> </i> <code> + "/" + </code> <i><node name> </i>. Note that
- * all absolute path names begin with the slash character.
- *
- * <p>
- * A node <i>n </i>'s path name relative to its ancestor <i>a </i> is simply the
- * string that must be appended to <i>a </i>'s absolute path name in order to
- * form <i>n </i>'s absolute path name, with the initial slash character (if
- * present) removed. Note that:
- * <ul>
- * <li>No relative path names begin with the slash character.
- * <li>Every node's path name relative to itself is the empty string.
- * <li>Every node's path name relative to its parent is its node name (except
- * for the root node, which does not have a parent).
- * <li>Every node's path name relative to the root is its absolute path name
- * with the initial slash character removed.
- * </ul>
- *
- * <p>
- * Note finally that:
- * <ul>
- * <li>No path name contains multiple consecutive slash characters.
- * <li>No path name with the exception of the root's absolute path name end in
- * the slash character.
- * <li>Any string that conforms to these two rules is a valid path name.
- * </ul>
- *
- * <p>
- * Each <code>Preference</code> node has zero or more properties associated with
- * it, where a property consists of a name and a value. The bundle writer is
- * free to choose any appropriate names for properties. Their values can be of
- * type <code>String</code>,<code>long</code>,<code>int</code>,<code>boolean</code>,
- * <code>byte[]</code>,<code>float</code>, or <code>double</code> but they can
- * always be accessed as if they were <code>String</code> objects.
- *
- * <p>
- * All node name and property name comparisons are case-sensitive.
- *
- * <p>
- * All of the methods that modify preference data are permitted to operate
- * asynchronously; they may return immediately, and changes will eventually
- * propagate to the persistent backing store, with an implementation-dependent
- * delay. The <code>flush</code> method may be used to synchronously force updates
- * to the backing store.
- *
- * <p>
- * Implementations must automatically attempt to flush to the backing store any
- * pending updates for a bundle's preferences when the bundle is stopped or
- * otherwise ungets the Preferences Service.
- *
- * <p>
- * The methods in this class may be invoked concurrently by multiple threads in
- * a single Java Virtual Machine (JVM) without the need for external
- * synchronization, and the results will be equivalent to some serial execution.
- * If this class is used concurrently <i>by multiple JVMs </i> that store their
- * preference data in the same backing store, the data store will not be
- * corrupted, but no other guarantees are made concerning the consistency of the
- * preference data.
- *
- *
- * @version $Revision: 1.8 $
- */
-public interface Preferences {
- /**
- * Associates the specified value with the specified key in this node.
- *
- * @param key key with which the specified value is to be associated.
- * @param value value to be associated with the specified key.
- * @throws NullPointerException if <code>key</code> or <code>value</code> is
- * <code>null</code>.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- */
- public void put(String key, String value);
-
- /**
- * Returns the value associated with the specified <code>key</code> in this
- * node. Returns the specified default if there is no value associated with
- * the <code>key</code>, or the backing store is inaccessible.
- *
- * @param key key whose associated value is to be returned.
- * @param def the value to be returned in the event that this node has no
- * value associated with <code>key</code> or the backing store is
- * inaccessible.
- * @return the value associated with <code>key</code>, or <code>def</code> if
- * no value is associated with <code>key</code>.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @throws NullPointerException if <code>key</code> is <code>null</code>. (A
- * <code>null</code> default <i>is </i> permitted.)
- */
- public String get(String key, String def);
-
- /**
- * Removes the value associated with the specified <code>key</code> in this
- * node, if any.
- *
- * @param key key whose mapping is to be removed from this node.
- * @see #get(String,String)
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- */
- public void remove(String key);
-
- /**
- * Removes all of the properties (key-value associations) in this node. This
- * call has no effect on any descendants of this node.
- *
- * @throws BackingStoreException if this operation cannot be completed due
- * to a failure in the backing store, or inability to communicate
- * with it.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #remove(String)
- */
- public void clear() throws BackingStoreException;
-
- /**
- * Associates a <code>String</code> object representing the specified
- * <code>int</code> value with the specified <code>key</code> in this node. The
- * associated string is the one that would be returned if the <code>int</code>
- * value were passed to <code>Integer.toString(int)</code>. This method is
- * intended for use in conjunction with {@link #getInt}method.
- *
- * <p>
- * Implementor's note: it is <i>not </i> necessary that the property value
- * be represented by a <code>String</code> object in the backing store. If the
- * backing store supports integer values, it is not unreasonable to use
- * them. This implementation detail is not visible through the
- * <code>Preferences</code> API, which allows the value to be read as an
- * <code>int</code> (with <code>getInt</code> or a <code>String</code> (with
- * <code>get</code>) type.
- *
- * @param key key with which the string form of value is to be associated.
- * @param value <code>value</code> whose string form is to be associated with
- * <code>key</code>.
- * @throws NullPointerException if <code>key</code> is <code>null</code>.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #getInt(String,int)
- */
- public void putInt(String key, int value);
-
- /**
- * Returns the <code>int</code> value represented by the <code>String</code>
- * object associated with the specified <code>key</code> in this node. The
- * <code>String</code> object is converted to an <code>int</code> as by
- * <code>Integer.parseInt(String)</code>. Returns the specified default if
- * there is no value associated with the <code>key</code>, the backing store
- * is inaccessible, or if <code>Integer.parseInt(String)</code> would throw a
- * <code>NumberFormatException</code> if the associated <code>value</code> were
- * passed. This method is intended for use in conjunction with the
- * {@link #putInt}method.
- *
- * @param key key whose associated value is to be returned as an
- * <code>int</code>.
- * @param def the value to be returned in the event that this node has no
- * value associated with <code>key</code> or the associated value
- * cannot be interpreted as an <code>int</code> or the backing store is
- * inaccessible.
- * @return the <code>int</code> value represented by the <code>String</code>
- * object associated with <code>key</code> in this node, or
- * <code>def</code> if the associated value does not exist or cannot
- * be interpreted as an <code>int</code> type.
- * @throws NullPointerException if <code>key</code> is <code>null</code>.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #putInt(String,int)
- * @see #get(String,String)
- */
- public int getInt(String key, int def);
-
- /**
- * Associates a <code>String</code> object representing the specified
- * <code>long</code> value with the specified <code>key</code> in this node. The
- * associated <code>String</code> object is the one that would be returned if
- * the <code>long</code> value were passed to <code>Long.toString(long)</code>.
- * This method is intended for use in conjunction with the {@link #getLong}
- * method.
- *
- * <p>
- * Implementor's note: it is <i>not </i> necessary that the <code>value</code>
- * be represented by a <code>String</code> type in the backing store. If the
- * backing store supports <code>long</code> values, it is not unreasonable to
- * use them. This implementation detail is not visible through the <code>
- * Preferences</code> API, which allows the value to be read as a
- * <code>long</code> (with <code>getLong</code> or a <code>String</code> (with
- * <code>get</code>) type.
- *
- * @param key <code>key</code> with which the string form of <code>value</code>
- * is to be associated.
- * @param value <code>value</code> whose string form is to be associated with
- * <code>key</code>.
- * @throws NullPointerException if <code>key</code> is <code>null</code>.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #getLong(String,long)
- */
- public void putLong(String key, long value);
-
- /**
- * Returns the <code>long</code> value represented by the <code>String</code>
- * object associated with the specified <code>key</code> in this node. The
- * <code>String</code> object is converted to a <code>long</code> as by
- * <code>Long.parseLong(String)</code>. Returns the specified default if
- * there is no value associated with the <code>key</code>, the backing store
- * is inaccessible, or if <code>Long.parseLong(String)</code> would throw a
- * <code>NumberFormatException</code> if the associated <code>value</code> were
- * passed. This method is intended for use in conjunction with the
- * {@link #putLong}method.
- *
- * @param key <code>key</code> whose associated value is to be returned as a
- * <code>long</code> value.
- * @param def the value to be returned in the event that this node has no
- * value associated with <code>key</code> or the associated value
- * cannot be interpreted as a <code>long</code> type or the backing
- * store is inaccessible.
- * @return the <code>long</code> value represented by the <code>String</code>
- * object associated with <code>key</code> in this node, or
- * <code>def</code> if the associated value does not exist or cannot
- * be interpreted as a <code>long</code> type.
- * @throws NullPointerException if <code>key</code> is <code>null</code>.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #putLong(String,long)
- * @see #get(String,String)
- */
- public long getLong(String key, long def);
-
- /**
- * Associates a <code>String</code> object representing the specified
- * <code>boolean</code> value with the specified key in this node. The
- * associated string is "true" if the value is <code>true</code>, and "false"
- * if it is <code>false</code>. This method is intended for use in
- * conjunction with the {@link #getBoolean}method.
- *
- * <p>
- * Implementor's note: it is <i>not </i> necessary that the value be
- * represented by a string in the backing store. If the backing store
- * supports <code>boolean</code> values, it is not unreasonable to use them.
- * This implementation detail is not visible through the <code>Preferences
- * </code> API, which allows the value to be read as a <code>boolean</code>
- * (with <code>getBoolean</code>) or a <code>String</code> (with <code>get</code>)
- * type.
- *
- * @param key <code>key</code> with which the string form of value is to be
- * associated.
- * @param value value whose string form is to be associated with
- * <code>key</code>.
- * @throws NullPointerException if <code>key</code> is <code>null</code>.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #getBoolean(String,boolean)
- * @see #get(String,String)
- */
- public void putBoolean(String key, boolean value);
-
- /**
- * Returns the <code>boolean</code> value represented by the <code>String</code>
- * object associated with the specified <code>key</code> in this node. Valid
- * strings are "true", which represents <code>true</code>, and "false", which
- * represents <code>false</code>. Case is ignored, so, for example, "TRUE"
- * and "False" are also valid. This method is intended for use in
- * conjunction with the {@link #putBoolean}method.
- *
- * <p>
- * Returns the specified default if there is no value associated with the
- * <code>key</code>, the backing store is inaccessible, or if the associated
- * value is something other than "true" or "false", ignoring case.
- *
- * @param key <code>key</code> whose associated value is to be returned as a
- * <code>boolean</code>.
- * @param def the value to be returned in the event that this node has no
- * value associated with <code>key</code> or the associated value
- * cannot be interpreted as a <code>boolean</code> or the backing store
- * is inaccessible.
- * @return the <code>boolean</code> value represented by the <code>String</code>
- * object associated with <code>key</code> in this node, or
- * <code>null</code> if the associated value does not exist or cannot
- * be interpreted as a <code>boolean</code>.
- * @throws NullPointerException if <code>key</code> is <code>null</code>.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #get(String,String)
- * @see #putBoolean(String,boolean)
- */
- public boolean getBoolean(String key, boolean def);
-
- /**
- * Associates a <code>String</code> object representing the specified
- * <code>float</code> value with the specified <code>key</code> in this node.
- * The associated <code>String</code> object is the one that would be returned
- * if the <code>float</code> value were passed to
- * <code>Float.toString(float)</code>. This method is intended for use in
- * conjunction with the {@link #getFloat}method.
- *
- * <p>
- * Implementor's note: it is <i>not </i> necessary that the value be
- * represented by a string in the backing store. If the backing store
- * supports <code>float</code> values, it is not unreasonable to use them.
- * This implementation detail is not visible through the <code>Preferences
- * </code> API, which allows the value to be read as a <code>float</code> (with
- * <code>getFloat</code>) or a <code>String</code> (with <code>get</code>) type.
- *
- * @param key <code>key</code> with which the string form of value is to be
- * associated.
- * @param value value whose string form is to be associated with
- * <code>key</code>.
- * @throws NullPointerException if <code>key</code> is <code>null</code>.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #getFloat(String,float)
- */
- public void putFloat(String key, float value);
-
- /**
- * Returns the float <code>value</code> represented by the <code>String</code>
- * object associated with the specified <code>key</code> in this node. The
- * <code>String</code> object is converted to a <code>float</code> value as by
- * <code>Float.parseFloat(String)</code>. Returns the specified default if
- * there is no value associated with the <code>key</code>, the backing store
- * is inaccessible, or if <code>Float.parseFloat(String)</code> would throw a
- * <code>NumberFormatException</code> if the associated value were passed.
- * This method is intended for use in conjunction with the {@link #putFloat}
- * method.
- *
- * @param key <code>key</code> whose associated value is to be returned as a
- * <code>float</code> value.
- * @param def the value to be returned in the event that this node has no
- * value associated with <code>key</code> or the associated value
- * cannot be interpreted as a <code>float</code> type or the backing
- * store is inaccessible.
- * @return the <code>float</code> value represented by the string associated
- * with <code>key</code> in this node, or <code>def</code> if the
- * associated value does not exist or cannot be interpreted as a
- * <code>float</code> type.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @throws NullPointerException if <code>key</code> is <code>null</code>.
- * @see #putFloat(String,float)
- * @see #get(String,String)
- */
- public float getFloat(String key, float def);
-
- /**
- * Associates a <code>String</code> object representing the specified
- * <code>double</code> value with the specified <code>key</code> in this node.
- * The associated <code>String</code> object is the one that would be returned
- * if the <code>double</code> value were passed to
- * <code>Double.toString(double)</code>. This method is intended for use in
- * conjunction with the {@link #getDouble}method
- *
- * <p>
- * Implementor's note: it is <i>not </i> necessary that the value be
- * represented by a string in the backing store. If the backing store
- * supports <code>double</code> values, it is not unreasonable to use them.
- * This implementation detail is not visible through the <code>Preferences
- * </code> API, which allows the value to be read as a <code>double</code> (with
- * <code>getDouble</code>) or a <code>String</code> (with <code>get</code>)
- * type.
- *
- * @param key <code>key</code> with which the string form of value is to be
- * associated.
- * @param value value whose string form is to be associated with
- * <code>key</code>.
- * @throws NullPointerException if <code>key</code> is <code>null</code>.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #getDouble(String,double)
- */
- public void putDouble(String key, double value);
-
- /**
- * Returns the <code>double</code> value represented by the <code>String</code>
- * object associated with the specified <code>key</code> in this node. The
- * <code>String</code> object is converted to a <code>double</code> value as by
- * <code>Double.parseDouble(String)</code>. Returns the specified default if
- * there is no value associated with the <code>key</code>, the backing store
- * is inaccessible, or if <code>Double.parseDouble(String)</code> would throw
- * a <code>NumberFormatException</code> if the associated value were passed.
- * This method is intended for use in conjunction with the
- * {@link #putDouble}method.
- *
- * @param key <code>key</code> whose associated value is to be returned as a
- * <code>double</code> value.
- * @param def the value to be returned in the event that this node has no
- * value associated with <code>key</code> or the associated value
- * cannot be interpreted as a <code>double</code> type or the backing
- * store is inaccessible.
- * @return the <code>double</code> value represented by the <code>String</code>
- * object associated with <code>key</code> in this node, or
- * <code>def</code> if the associated value does not exist or cannot
- * be interpreted as a <code>double</code> type.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the the {@link #removeNode()}method.
- * @throws NullPointerException if <code>key</code> is <code>null</code>.
- * @see #putDouble(String,double)
- * @see #get(String,String)
- */
- public double getDouble(String key, double def);
-
- /**
- * Associates a <code>String</code> object representing the specified
- * <code>byte[]</code> with the specified <code>key</code> in this node. The
- * associated <code>String</code> object the <i>Base64 </i> encoding of the
- * <code>byte[]</code>, as defined in <a
- * href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 </a>, Section 6.8,
- * with one minor change: the string will consist solely of characters from
- * the <i>Base64 Alphabet </i>; it will not contain any newline characters.
- * This method is intended for use in conjunction with the
- * {@link #getByteArray}method.
- *
- * <p>
- * Implementor's note: it is <i>not </i> necessary that the value be
- * represented by a <code>String</code> type in the backing store. If the
- * backing store supports <code>byte[]</code> values, it is not unreasonable
- * to use them. This implementation detail is not visible through the <code>
- * Preferences</code> API, which allows the value to be read as an a
- * <code>byte[]</code> object (with <code>getByteArray</code>) or a
- * <code>String</code> object (with <code>get</code>).
- *
- * @param key <code>key</code> with which the string form of <code>value</code>
- * is to be associated.
- * @param value <code>value</code> whose string form is to be associated with
- * <code>key</code>.
- * @throws NullPointerException if <code>key</code> or <code>value</code> is
- * <code>null</code>.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #getByteArray(String,byte[])
- * @see #get(String,String)
- */
- public void putByteArray(String key, byte[] value);
-
- /**
- * Returns the <code>byte[]</code> value represented by the <code>String</code>
- * object associated with the specified <code>key</code> in this node. Valid
- * <code>String</code> objects are <i>Base64 </i> encoded binary data, as
- * defined in <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 </a>,
- * Section 6.8, with one minor change: the string must consist solely of
- * characters from the <i>Base64 Alphabet </i>; no newline characters or
- * extraneous characters are permitted. This method is intended for use in
- * conjunction with the {@link #putByteArray}method.
- *
- * <p>
- * Returns the specified default if there is no value associated with the
- * <code>key</code>, the backing store is inaccessible, or if the associated
- * value is not a valid Base64 encoded byte array (as defined above).
- *
- * @param key <code>key</code> whose associated value is to be returned as a
- * <code>byte[]</code> object.
- * @param def the value to be returned in the event that this node has no
- * value associated with <code>key</code> or the associated value
- * cannot be interpreted as a <code>byte[]</code> type, or the backing
- * store is inaccessible.
- * @return the <code>byte[]</code> value represented by the <code>String</code>
- * object associated with <code>key</code> in this node, or
- * <code>def</code> if the associated value does not exist or cannot
- * be interpreted as a <code>byte[]</code>.
- * @throws NullPointerException if <code>key</code> is <code>null</code>. (A
- * <code>null</code> value for <code>def</code> <i>is </i> permitted.)
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #get(String,String)
- * @see #putByteArray(String,byte[])
- */
- public byte[] getByteArray(String key, byte[] def);
-
- /**
- * Returns all of the keys that have an associated value in this node. (The
- * returned array will be of size zero if this node has no preferences and
- * not <code>null</code>!)
- *
- * @return an array of the keys that have an associated value in this node.
- * @throws BackingStoreException if this operation cannot be completed due
- * to a failure in the backing store, or inability to communicate
- * with it.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- */
- public String[] keys() throws BackingStoreException;
-
- /**
- * Returns the names of the children of this node. (The returned array will
- * be of size zero if this node has no children and not <code>null</code>!)
- *
- * @return the names of the children of this node.
- * @throws BackingStoreException if this operation cannot be completed due
- * to a failure in the backing store, or inability to communicate
- * with it.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- */
- public String[] childrenNames() throws BackingStoreException;
-
- /**
- * Returns the parent of this node, or <code>null</code> if this is the root.
- *
- * @return the parent of this node.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- */
- public Preferences parent();
-
- /**
- * Returns a named <code>Preferences</code> object (node), creating it and any
- * of its ancestors if they do not already exist. Accepts a relative or
- * absolute pathname. Absolute pathnames (which begin with <code>'/'</code>)
- * are interpreted relative to the root of this node. Relative pathnames
- * (which begin with any character other than <code>'/'</code>) are
- * interpreted relative to this node itself. The empty string (<code>""</code>)
- * is a valid relative pathname, referring to this node itself.
- *
- * <p>
- * If the returned node did not exist prior to this call, this node and any
- * ancestors that were created by this call are not guaranteed to become
- * persistent until the <code>flush</code> method is called on the returned
- * node (or one of its descendants).
- *
- * @param pathName the path name of the <code>Preferences</code> object to
- * return.
- * @return the specified <code>Preferences</code> object.
- * @throws IllegalArgumentException if the path name is invalid.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @throws NullPointerException if path name is <code>null</code>.
- * @see #flush()
- */
- public Preferences node(String pathName);
-
- /**
- * Returns true if the named node exists. Accepts a relative or absolute
- * pathname. Absolute pathnames (which begin with <code>'/'</code>) are
- * interpreted relative to the root of this node. Relative pathnames (which
- * begin with any character other than <code>'/'</code>) are interpreted
- * relative to this node itself. The pathname <code>""</code> is valid, and
- * refers to this node itself.
- *
- * <p>
- * If this node (or an ancestor) has already been removed with the
- * {@link #removeNode()}method, it <i>is </i> legal to invoke this method,
- * but only with the pathname <code>""</code>; the invocation will return
- * <code>false</code>. Thus, the idiom <code>p.nodeExists("")</code> may be
- * used to test whether <code>p</code> has been removed.
- *
- * @param pathName the path name of the node whose existence is to be
- * checked.
- * @return true if the specified node exists.
- * @throws BackingStoreException if this operation cannot be completed due
- * to a failure in the backing store, or inability to communicate
- * with it.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method and
- * <code>pathname</code> is not the empty string (<code>""</code>).
- * @throws IllegalArgumentException if the path name is invalid (i.e., it
- * contains multiple consecutive slash characters, or ends with a
- * slash character and is more than one character long).
- */
- public boolean nodeExists(String pathName)
- throws BackingStoreException;
-
- /**
- * Removes this node and all of its descendants, invalidating any properties
- * contained in the removed nodes. Once a node has been removed, attempting
- * any method other than <code>name()</code>,<code>absolutePath()</code> or
- * <code>nodeExists("")</code> on the corresponding <code>Preferences</code>
- * instance will fail with an <code>IllegalStateException</code>. (The
- * methods defined on <code>Object</code> can still be invoked on a node after
- * it has been removed; they will not throw <code>IllegalStateException</code>.)
- *
- * <p>
- * The removal is not guaranteed to be persistent until the <code>flush</code>
- * method is called on the parent of this node.
- *
- * @throws IllegalStateException if this node (or an ancestor) has already
- * been removed with the {@link #removeNode()}method.
- * @throws BackingStoreException if this operation cannot be completed due
- * to a failure in the backing store, or inability to communicate
- * with it.
- * @see #flush()
- */
- public void removeNode() throws BackingStoreException;
-
- /**
- * Returns this node's name, relative to its parent.
- *
- * @return this node's name, relative to its parent.
- */
- public String name();
-
- /**
- * Returns this node's absolute path name. Note that:
- * <ul>
- * <li>Root node - The path name of the root node is <code>"/"</code>.
- * <li>Slash at end - Path names other than that of the root node may not
- * end in slash (<code>'/'</code>).
- * <li>Unusual names -<code>"."</code> and <code>".."</code> have <i>no </i>
- * special significance in path names.
- * <li>Illegal names - The only illegal path names are those that contain
- * multiple consecutive slashes, or that end in slash and are not the root.
- * </ul>
- *
- * @return this node's absolute path name.
- */
- public String absolutePath();
-
- /**
- * Forces any changes in the contents of this node and its descendants to
- * the persistent store.
- *
- * <p>
- * Once this method returns successfully, it is safe to assume that all
- * changes made in the subtree rooted at this node prior to the method
- * invocation have become permanent.
- *
- * <p>
- * Implementations are free to flush changes into the persistent store at
- * any time. They do not need to wait for this method to be called.
- *
- * <p>
- * When a flush occurs on a newly created node, it is made persistent, as
- * are any ancestors (and descendants) that have yet to be made persistent.
- * Note however that any properties value changes in ancestors are <i>not
- * </i> guaranteed to be made persistent.
- *
- * @throws BackingStoreException if this operation cannot be completed due
- * to a failure in the backing store, or inability to communicate
- * with it.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #sync()
- */
- public void flush() throws BackingStoreException;
-
- /**
- * Ensures that future reads from this node and its descendants reflect any
- * changes that were committed to the persistent store (from any VM) prior
- * to the <code>sync</code> invocation. As a side-effect, forces any changes
- * in the contents of this node and its descendants to the persistent store,
- * as if the <code>flush</code> method had been invoked on this node.
- *
- * @throws BackingStoreException if this operation cannot be completed due
- * to a failure in the backing store, or inability to communicate
- * with it.
- * @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #flush()
- */
- public void sync() throws BackingStoreException;
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime/src/org/osgi/service/prefs/PreferencesService.java b/bundles/org.eclipse.core.runtime/src/org/osgi/service/prefs/PreferencesService.java
deleted file mode 100644
index d6c3325..0000000
--- a/bundles/org.eclipse.core.runtime/src/org/osgi/service/prefs/PreferencesService.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * $Header: /cvshome/build/org.osgi.service.prefs/src/org/osgi/service/prefs/PreferencesService.java,v 1.8 2005/08/11 03:07:45 hargrave Exp $
- *
- * Copyright (c) OSGi Alliance (2001, 2005). All Rights Reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this
- * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html.
- */
-package org.osgi.service.prefs;
-
-/**
- * The Preferences Service.
- *
- * <p>
- * Each bundle using this service has its own set of preference trees: one for
- * system preferences, and one for each user.
- *
- * <p>
- * A <code>PreferencesService</code> object is specific to the bundle which
- * obtained it from the service registry. If a bundle wishes to allow another
- * bundle to access its preferences, it should pass its
- * <code>PreferencesService</code> object to that bundle.
- *
- */
-public interface PreferencesService {
- /**
- * Returns the root system node for the calling bundle.
- *
- * @return The root system node for the calling bundle.
- */
- public Preferences getSystemPreferences();
-
- /**
- * Returns the root node for the specified user and the calling bundle.
- *
- * @param name The user for which to return the preference root node.
- * @return The root node for the specified user and the calling bundle.
- */
- public Preferences getUserPreferences(String name);
-
- /**
- * Returns the names of users for which node trees exist.
- *
- * @return The names of users for which node trees exist.
- */
- public String[] getUsers();
-}
diff --git a/bundles/org.eclipse.core.tools/.classpath b/bundles/org.eclipse.core.tools/.classpath
deleted file mode 100644
index 065ac06..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.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <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 4d63ad9..0000000
--- a/bundles/org.eclipse.core.tools/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.tools</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.resources.spysupport</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.core.runtime.compatibility</project>
- <project>org.eclipse.ui</project>
- </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/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.tools/META-INF/MANIFEST.MF
deleted file mode 100644
index 313bb5e..0000000
--- a/bundles/org.eclipse.core.tools/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,22 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: Core Tools
-Bundle-SymbolicName: org.eclipse.core.tools; singleton=true
-Bundle-Version: 1.3.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;optional=true,
- org.eclipse.core.runtime,
- org.eclipse.jface.text,
- org.eclipse.ui,
- org.eclipse.ui.workbench.texteditor,
- org.eclipse.ui.views,
- org.eclipse.jdt.core,
- org.eclipse.jdt.ui,
- org.eclipse.ltk.core.refactoring,
- org.eclipse.core.filebuffers,
- org.eclipse.ui.ide
-Eclipse-AutoStart: true
diff --git a/bundles/org.eclipse.core.tools/about.html b/bundles/org.eclipse.core.tools/about.html
deleted file mode 100644
index 6f6b96c..0000000
--- a/bundles/org.eclipse.core.tools/about.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>February 24, 2005</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.</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 e521604..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 720ca87..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 ae969be..0000000
--- a/bundles/org.eclipse.core.tools/about.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-###############################################################################
-# Copyright (c) 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-# 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, 2004. 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 e84bf48..0000000
--- a/bundles/org.eclipse.core.tools/build.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-###############################################################################
-# Copyright (c) 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.. = src/
-src.includes=*.html
-bin.includes=plugin.xml,icons/,doc/,*.html,.options, META-INF/,.
-qualifier=context
\ No newline at end of file
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 0cc47e7..0000000
--- a/bundles/org.eclipse.core.tools/plugin.xml
+++ /dev/null
@@ -1,176 +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>
- </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 b0686a0..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/AbstractCopySelectionAction.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 cfc005d..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/AbstractTreeContentProvider.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 d151dd6..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/BaseTextView.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 a8987b8..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ByteUtil.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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();
- }
-
- /**
- * Calls <code>byteArrayToString()</code> with no limit for array lenght.
- *
- * @see #byteArrayToString(byte[], int)
- * @param byteArray the array to be converted to string
- * @return a string representation for the array
- */
- public static String byteArrayToString(byte[] byteArray) {
- return byteArrayToString(byteArray, 0);
- }
-}
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 1d4af80..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ClearTextAction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 9ec3b24..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CollapseAllAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 ccd394a..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CopyStructuredSelectionAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 6e813a1..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CopyTextSelectionAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 26725ba..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CoreToolsPlugin.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 PLUGIN_ID = "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, PLUGIN_ID, 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 8c8dbfa..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 72b3116..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ErrorUtil.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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.PLUGIN_ID;
- 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 f3e66e8..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/GlobalAction.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 b3c812b..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/IFlattable.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 9541980..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ISorter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 148f2ea..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ITreeNodeVisitor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 17e819b..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/Messages.java
+++ /dev/null
@@ -1,78 +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_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/Policy.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/Policy.java
deleted file mode 100644
index 08fe8f3..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/Policy.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools;
-
-import org.eclipse.core.runtime.*;
-
-public class Policy {
-
- 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);
- }
-}
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 27a0dfa..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/SelectAllAction.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 41694cb..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/SpyView.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 d53624c..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TableWithTotalView.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 96801e5..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TreeContentProviderNode.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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;
- }
-
- /**
- * Removes all child nodes (if any) from this node. This operation affects
- * only this node. No changes are made to the child nodes.
- */
- public void removeAllChildren() {
- if (children == null)
- return;
-
- children.clear();
- }
-
- /**
- * 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;
- }
-
- /**
- * Returns this node's name.
- */
- public String getName() {
- return name;
- }
-
- 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 113e231..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TreeSelectionProviderDecorator.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 ebb876b..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TreeTextOperationTarget.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 3c822a7..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/messages.properties
+++ /dev/null
@@ -1,71 +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_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 ffd879c..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/AbstractDumper.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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) {
- DataInputStream dataInput = null;
- 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);
- } finally {
- if (dataInput != null)
- try {
- dataInput.close();
- } catch (IOException ioe) {
- if (!dump.isFailed())
- dump.setFailureReason(ioe);
- }
- }
- 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 cbaf37d..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/Dump.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 this dump object failed flag.
- *
- * @param failed The value of the failed flag for this dump object
- */
- public void setFailed(boolean failed) {
- this.failed = failed;
- }
-
- /**
- * 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 0b423ce..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpContentsView.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 f253158..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpException.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 <coed>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 6fc7f01..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpSummaryView.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 cd2c1b8..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpTool.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.File;
-import org.eclipse.core.runtime.IPlatformRunnable;
-
-/**
- * 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 IPlatformRunnable {
-
- /**
- * Dumps a given file using the associated dumper, sending its contents to the
- * standard output.
- *
- * @param args the command-line arguments
- * @see DumperFactory#getDumper(String)
- */
- public Object run(Object args) 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.isFile()) {
- System.err.println("File \"" + toDump.getAbsolutePath() + "\" does not exist or is not a file"); //$NON-NLS-1$ //$NON-NLS-2$
- return new Integer(1);
- }
-
- IDumper dumper = null;
- try {
- dumper = DumperFactory.getInstance().getDumper(fileName);
- } catch (DumpException de) {
- System.err.println("Error: \n" + de); //$NON-NLS-1$
- return new Integer(1);
- }
- IDump dump = dumper.dump(new File(fileName));
- 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());
- } 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());
- return new Integer(0);
- }
-}
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 9a4f457..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumperFactory.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.tools.metadata;
-
-import java.io.File;
-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.PLUGIN_ID, 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].getAttributeAsIs(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
- */
- public IDumper getDumper(String fileName) throws DumpException {
- fileName = fileName.substring(fileName.lastIndexOf(File.separator) + 1);
-
- Object dumper = configuration.get(fileName);
-
- if (dumper == null)
- throw new DumpException("There is no dumper class for <" + fileName + "> files"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // 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 for <" + fileName + "> file", e); //$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$
- }
- }
-}
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 cd17695..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/IDump.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 eabd369..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/IDumper.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 8faf31f..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/IStringDumpingStrategy.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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/MetadataPerspective.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataPerspective.java
deleted file mode 100644
index 8e69af7..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataPerspective.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 22d566d..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataTreeContentProvider.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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.internal.runtime.Policy;
-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, Policy.subMonitorFor(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 TreeContentroviderNode 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 accepted files (the ones who are registered in the DumperFactory).
- *
- * @see MetadataTreeContentProvider#MetadataTreeContentProvider(String[])
- * @see java.io.FileFilter
- */
- private class MetadataFileFilter implements FileFilter {
- private String[] fileNames;
-
- private 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;
- }
- }
-
- /**
- * 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 c930109..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MetadataTreeView.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 2776d38..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MeteredInputStream.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 89c4705..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MultiStrategyDumper.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 fa33e77..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/PartialDumpException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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;
- }
-
- public PartialDumpException(String msg, Throwable cause, Object partialContents) {
- super(msg, cause);
- 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 a1b3d3d..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/StateDumper.java
+++ /dev/null
@@ -1,80 +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.*;
-import java.io.IOException;
-import java.io.PushbackInputStream;
-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));
- 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');
- }
-
- public String getFormatDescription() {
- return "Framework state"; //$NON-NLS-1$
- }
-}
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 1ffcbab..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/MessageBundleRefactoring.java
+++ /dev/null
@@ -1,181 +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.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, NLSPlugin.PI_NLS, 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/NLSPlugin.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/NLSPlugin.java
deleted file mode 100644
index 5502911..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/NLSPlugin.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.core.tools.nls;
-
-import org.eclipse.ui.plugin.*;
-import org.osgi.framework.BundleContext;
-import java.util.*;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class NLSPlugin extends AbstractUIPlugin {
- //The shared instance.
- private static NLSPlugin plugin;
- //Resource bundle.
- private ResourceBundle resourceBundle;
-
- public static final String PI_NLS = "com.example.nls"; //$NON-NLS-1$
-
- /**
- * The constructor.
- */
- public NLSPlugin() {
- super();
- plugin = this;
- }
-
- /**
- * This method is called upon plug-in activation
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- plugin = null;
- resourceBundle = null;
- }
-
- /**
- * Returns the shared instance.
- */
- public static NLSPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the string from the plugin's resource bundle,
- * or 'key' if not found.
- */
- public static String getResourceString(String key) {
- ResourceBundle bundle = NLSPlugin.getDefault().getResourceBundle();
- try {
- return (bundle != null) ? bundle.getString(key) : key;
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- try {
- if (resourceBundle == null)
- resourceBundle = ResourceBundle.getBundle("com.example.nls.NlsPluginResources");
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
- return resourceBundle;
- }
-}
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 ab3abe9..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.filebuffers.ITextFileBuffer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.*;
-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, NLSPlugin.PI_NLS, 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 0cae472..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsView.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 76512c6..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsViewContentProvider.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 1e0fc38..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsViewLabelProvider.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 0b1f48c..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ActivePluginsViewSorter.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 5e75988..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ContentTypeView.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-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 ce178e7..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/EclipsePreferencesView.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 510129d..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 c3928a9..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 9bd84f3..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesView.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 ab12e26..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesViewContentProvider.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 3625c64..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesViewLabelProvider.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 8d87d3c..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/LoadedClassesViewSorter.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 0dcc924..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDataSheetView.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 324ff54..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyGraphNode.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 ba8e2d6..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyPerspective.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 97f46cc..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 881f959..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginListView.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 0cd0ce0..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PreferenceStatsView.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 cd62026..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/RuntimeSpyPerspective.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 e3b2bd0..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/StackTraceView.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 25cdf8c..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/VMClassInfo.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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 98ef0ff..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/VMClassloaderInfo.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - 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/FindUnusedMembers.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedMembers.java
deleted file mode 100644
index 9380fc7..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedMembers.java
+++ /dev/null
@@ -1,137 +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.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.jface.operation.IRunnableWithProgress;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-
-/*
- * Class that removes field declarations which aren't referenced.
- */
-public class FindUnusedMembers implements IRunnableWithProgress {
- private boolean headerWritten = false;
- private final Writer output;
-
- ICompilationUnit unit;
- protected int unusedMemberCount = 0;
-
- public FindUnusedMembers(ICompilationUnit unit, Writer output) {
- super();
- this.unit = unit;
- this.output = output;
- }
-
- private void doSearchCU(ICompilationUnit cu, IProgressMonitor monitor) throws JavaModelException, IOException {
- IType[] allTypes = cu.getAllTypes();
- for (int i = 0; i < allTypes.length; i++)
- doSearchType(allTypes[i], monitor);
- }
-
- public void doSearchType(IType type, IProgressMonitor monitor) throws JavaModelException, IOException {
- headerWritten = false;
-
- IMethod[] methods = type.getMethods();
- IField[] fields = type.getFields();
- 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();
- if (hasReferences(methods[i], monitor))
- continue;
- writeResult(methods[i]);
- unusedMemberCount++;
- }
- for (int i = 0; i < fields.length; i++) {
- if (monitor.isCanceled())
- throw new OperationCanceledException();
- if (hasReferences(fields[i], monitor))
- continue;
- writeResult(fields[i]);
- unusedMemberCount++;
- }
-
- if (monitor.isCanceled())
- throw new OperationCanceledException();
- } finally {
- monitor.done();
- }
- }
-
- public int getUnusedMethodCount() {
- return unusedMemberCount;
- }
-
- private boolean hasReferences(IMember member, IProgressMonitor monitor) throws JavaModelException {
- ICompilationUnit[] affectedUnits = RefactoringSearchEngine.findAffectedCompilationUnits(SearchPattern.createPattern(member, IJavaSearchConstants.REFERENCES), RefactoringScopeFactory.create(member.getDeclaringType()), new SubProgressMonitor(monitor, 1), new RefactoringStatus());
- return affectedUnits.length > 0;
- }
-
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- if (monitor == null)
- monitor = new NullProgressMonitor();
- try {
- doSearchCU(unit, monitor);
- } catch (OperationCanceledException e) {
- throw new InterruptedException();
- } catch (JavaModelException e) {
- throw new InvocationTargetException(e);
- } catch (IOException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- private void writeHeader(IType type) throws IOException {
- if (!headerWritten) {
- headerWritten = true;
- output.write("\n\n" + type.getFullyQualifiedName()); //$NON-NLS-1$
- }
- }
-
- private void writeResult(IField field) throws IOException, IllegalArgumentException, JavaModelException {
- writeHeader(field.getDeclaringType());
- output.write("\n\t"); //$NON-NLS-1$
- output.write(Signature.toString(field.getTypeSignature()));
- output.write(" "); //$NON-NLS-1$
- output.write(field.getElementName());
- }
-
- /**
- * @param method
- * @throws IOException
- * @throws JavaModelException
- * @throws IllegalArgumentException
- */
- private void writeResult(IMethod method) throws IOException, IllegalArgumentException, JavaModelException {
- writeHeader(method.getDeclaringType());
- 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$
- }
-}
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 21c93b0..0000000
--- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/FindUnusedMembersAction.java
+++ /dev/null
@@ -1,95 +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.*;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Iterator;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.ui.*;
-
-public class FindUnusedMembersAction implements IObjectActionDelegate {
-
- private IStructuredSelection selection;
- private int unusedCount;
- private IWorkbenchPart part;
-
- public void setActivePart(IAction action, IWorkbenchPart part) {
- this.part = part;
- //not needed
- }
-
- public void run(IAction action) {
- unusedCount = 0;
- 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 {
- try {
- writer = new FileWriter(outputFile);
- for (Iterator it = selection.iterator(); it.hasNext();) {
- Object element = it.next();
- if (element instanceof IJavaElement)
- traverse((IJavaElement)element, writer);
- }
- } finally {
- String summary = "\n\nSearch complete. Found " + unusedCount + " unreferenced methods."; //$NON-NLS-1$ //$NON-NLS-2$
- if (writer != null) {
- writer.write(summary);
- writer.close();
- }
- MessageDialog.openInformation(part.getSite().getShell(), "Search Complete", summary); //$NON-NLS-1$
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void traverse(IJavaElement current, Writer output) throws JavaModelException, InvocationTargetException, InterruptedException {
- if (current instanceof IJavaProject || current instanceof IPackageFragmentRoot) {
- IJavaElement[] children = ((IParent) current).getChildren();
- for (int i = 0; i < children.length; i++) {
- traverse(children[i], output);
- }
- } else if (current instanceof IPackageFragment) {
- //don't 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++) {
- traverse(children[i], output);
- }
- }
- } else if (current instanceof ICompilationUnit)
- traverseCU((ICompilationUnit)current, output);
- }
-
- protected void traverseCU(ICompilationUnit unit, Writer output) throws InvocationTargetException, InterruptedException {
- FindUnusedMembers search = new FindUnusedMembers(unit, output);
- PlatformUI.getWorkbench().getProgressService().run(true, true, search);
- unusedCount += search.getUnusedMethodCount();
- }
-
- public void selectionChanged(IAction action, ISelection aSelection) {
- if (aSelection instanceof IStructuredSelection)
- this.selection = (IStructuredSelection) aSelection;
- }
-}
\ No newline at end of file
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 b347cab..0000000
--- a/features/org.eclipse.core.tools-feature/feature.properties
+++ /dev/null
@@ -1,123 +0,0 @@
-###############################################################################
-# Copyright (c) 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-# 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=Eclipse.org 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 f30b0d0..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.3.0.qualifier"
- provider-name="%providerName"
- image="eclipse_update_120.jpg">
-
- <description>
- %description
- </description>
-
- <license url="%licenseURL">
- %license
- </license>
-
- <url>
- <update label="%updateSiteName" url="http://update.eclipse.org/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 065ac06..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.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <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 1a03ea5..0000000
--- a/tests/org.eclipse.core.expressions.tests/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,66 +0,0 @@
-#Wed May 25 10:22:57 CEST 2005
-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=100
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-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.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.unsafeTypeOperation=warning
-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 cfb1bbf..0000000
--- a/tests/org.eclipse.core.expressions.tests/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,5 +0,0 @@
-#Tue Dec 21 11:19:34 CET 2004
-eclipse.preferences.version=1
-org.eclipse.jdt.ui.ondemandthreshold=99
-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;
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/about.html b/tests/org.eclipse.core.expressions.tests/about.html
deleted file mode 100644
index 6f6b96c..0000000
--- a/tests/org.eclipse.core.expressions.tests/about.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>February 24, 2005</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.</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 2bbc77d..0000000
--- a/tests/org.eclipse.core.expressions.tests/build.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = plugin.xml,\
- test.xml,\
- about.html,\
- plugin.properties,\
- *.jar
-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 42c9f22..0000000
--- a/tests/org.eclipse.core.expressions.tests/plugin.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-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 0e8c6f1..0000000
--- a/tests/org.eclipse.core.expressions.tests/plugin.xml
+++ /dev/null
@@ -1,170 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.core.expressions.tests"
- name="%pluginName"
- version="3.1.0"
- provider-name="%providerName"
- class="org.eclipse.core.internal.expressions.tests.ExpressionTestPlugin">
-
- <runtime>
- <library name="expressionstests.jar">
- <export name="*"/>
- </library>
- </runtime>
-
- <requires>
- <import plugin="org.junit"/>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.core.expressions"/>
- </requires>
-
- <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>
- </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"/>
- <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>
-</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 fa503b1..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 4dd7260..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.internal.expressions.Assert;
-
-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 b170dd2..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender2.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.internal.expressions.Assert;
-
-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 ad56ffa..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender3.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.internal.expressions.Assert;
-
-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 b93091a..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 aafc357..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 bfc20b4..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/AllTests.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 d25c19d..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 e33334b..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/B_TypeExtender.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.internal.expressions.Assert;
-
-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/ExpressionInfoTests.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionInfoTests.java
deleted file mode 100644
index b2231c5..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionInfoTests.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 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() {
- assertDefaultAccessOnly((new TestExpression("namespace", "property", null, new Object())).computeExpressionInfo());
- }
-
- // ---- 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());
- }
-
- 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());
- }
-
- 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());
- }
-
- 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());
- }
-
- 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());
- }
-
- 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);
- 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]));
- }
- }
-}
\ No newline at end of file
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 2b17c28..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 f967f24..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTests.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import java.util.ArrayList;
-import java.util.List;
-
-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.CountExpression;
-import org.eclipse.core.internal.expressions.EqualsExpression;
-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.SystemTestExpression;
-
-
-public class ExpressionTests extends TestCase {
-
- 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 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 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 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 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);
- }
-
- 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) {
-
- }
-}
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 76dacf4..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 2ab494f..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/I_TypeExtender.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.expressions.tests;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.internal.expressions.Assert;
-
-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 6eca6b3..0000000
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/PropertyTesterTests.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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.Platform;
-
-import org.eclipse.core.internal.expressions.Property;
-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$
-
- 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 (true)
- 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();
- p= fgManager.getProperty(receiver, "org.eclipse.core.expressions.tests.dynamic", "testing"); //$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 150fd2b..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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>