diff options
author | Dani Megert | 2008-07-17 07:14:02 +0000 |
---|---|---|
committer | Dani Megert | 2008-07-17 07:14:02 +0000 |
commit | a54c6376d946edc6212b28c482e3b5bf89d5ea18 (patch) | |
tree | 4d9150c91d547f2135cc30cd220e33fc32cb2f1a /org.eclipse.core.filebuffers | |
parent | 3c89c0687fa3537a50b3e8c8ffdca3582601eb61 (diff) | |
download | eclipse.platform.text-a54c6376d946edc6212b28c482e3b5bf89d5ea18.tar.gz eclipse.platform.text-a54c6376d946edc6212b28c482e3b5bf89d5ea18.tar.xz eclipse.platform.text-a54c6376d946edc6212b28c482e3b5bf89d5ea18.zip |
Fixed compiler warnings.
Diffstat (limited to 'org.eclipse.core.filebuffers')
4 files changed, 77 insertions, 55 deletions
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java index e945fe90530..17d82720362 100644 --- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java +++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java @@ -33,7 +33,6 @@ import org.eclipse.core.runtime.content.IContentType; import org.eclipse.core.runtime.content.IContentTypeManager; import org.eclipse.core.filebuffers.IAnnotationModelFactory; -import org.eclipse.core.filebuffers.IDocumentFactory; import org.eclipse.core.filebuffers.IDocumentSetupParticipant; import org.eclipse.core.filebuffers.LocationKind; @@ -45,8 +44,8 @@ import org.eclipse.core.filebuffers.LocationKind; public class ExtensionsRegistry { /** - * Adapts IContentType with the ability to check - * equality. This allows to use them in a collection. + * Adapts {@link IContentType} with the ability to check equality. This allows to use them in a + * collection. */ private static class ContentTypeAdapter { @@ -269,11 +268,11 @@ public class ExtensionsRegistry { * @return the sharable document factory or <code>null</code> * @deprecated As of 3.5 */ - protected IDocumentFactory getDocumentFactory(String nameOrExtension) { + protected org.eclipse.core.filebuffers.IDocumentFactory getDocumentFactory(String nameOrExtension) { Set set= (Set) fFactoryDescriptors.get(nameOrExtension); if (set != null) { IConfigurationElement entry= selectConfigurationElement(set); - return (IDocumentFactory) getExtension(entry, fFactories, IDocumentFactory.class); + return (org.eclipse.core.filebuffers.IDocumentFactory)getExtension(entry, fFactories, org.eclipse.core.filebuffers.IDocumentFactory.class); } return null; } @@ -285,7 +284,7 @@ public class ExtensionsRegistry { * @return the sharable document factory or <code>null</code> * @deprecated As of 3.5 */ - protected IDocumentFactory doGetDocumentFactory(IContentType[] contentTypes) { + protected org.eclipse.core.filebuffers.IDocumentFactory doGetDocumentFactory(IContentType[] contentTypes) { Set set= null; int i= 0; while (i < contentTypes.length && set == null) { @@ -294,7 +293,7 @@ public class ExtensionsRegistry { if (set != null) { IConfigurationElement entry= selectConfigurationElement(set); - return (IDocumentFactory) getExtension(entry, fFactories, IDocumentFactory.class); + return (org.eclipse.core.filebuffers.IDocumentFactory)getExtension(entry, fFactories, org.eclipse.core.filebuffers.IDocumentFactory.class); } return null; } @@ -307,8 +306,8 @@ public class ExtensionsRegistry { * @return the sharable document factory or <code>null</code> * @deprecated As of 3.5 */ - protected IDocumentFactory getDocumentFactory(IContentType[] contentTypes) { - IDocumentFactory factory= doGetDocumentFactory(contentTypes); + protected org.eclipse.core.filebuffers.IDocumentFactory getDocumentFactory(IContentType[] contentTypes) { + org.eclipse.core.filebuffers.IDocumentFactory factory= doGetDocumentFactory(contentTypes); while (factory == null) { contentTypes= computeBaseContentTypes(contentTypes); if (contentTypes == null) @@ -488,8 +487,8 @@ public class ExtensionsRegistry { * @since 3.3 * @deprecated As of 3.5 */ - public IDocumentFactory getDocumentFactory(IPath location, LocationKind locationKind) { - IDocumentFactory factory= getDocumentFactory(findContentTypes(location, locationKind)); + public org.eclipse.core.filebuffers.IDocumentFactory getDocumentFactory(IPath location, LocationKind locationKind) { + org.eclipse.core.filebuffers.IDocumentFactory factory= getDocumentFactory(findContentTypes(location, locationKind)); if (factory == null) factory= getDocumentFactory(location.lastSegment()); if (factory == null) diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceExtensionRegistry.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceExtensionRegistry.java index 568ea0a2c72..7a1b14054b4 100644 --- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceExtensionRegistry.java +++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceExtensionRegistry.java @@ -23,7 +23,6 @@ import org.eclipse.core.resources.IFile; import org.eclipse.core.filebuffers.FileBuffers; import org.eclipse.core.filebuffers.IAnnotationModelFactory; -import org.eclipse.core.filebuffers.IDocumentFactory; import org.eclipse.core.filebuffers.IDocumentSetupParticipant; import org.eclipse.core.filebuffers.LocationKind; @@ -59,8 +58,8 @@ public class ResourceExtensionRegistry extends ExtensionsRegistry { * @return the sharable document factory * @deprecated As of 3.5 */ - IDocumentFactory getDocumentFactory(IFile file) { - IDocumentFactory factory= getDocumentFactory(findContentTypes(file)); + org.eclipse.core.filebuffers.IDocumentFactory getDocumentFactory(IFile file) { + org.eclipse.core.filebuffers.IDocumentFactory factory= getDocumentFactory(findContentTypes(file)); if (factory == null) { factory= getDocumentFactory(file.getFullPath().lastSegment()); } diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java index bba68dc4a02..0e8bcb4bf68 100644 --- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java +++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java @@ -39,7 +39,6 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.filebuffers.FileBuffers; import org.eclipse.core.filebuffers.IAnnotationModelFactory; -import org.eclipse.core.filebuffers.IDocumentFactory; import org.eclipse.core.filebuffers.IDocumentSetupParticipant; import org.eclipse.core.filebuffers.IDocumentSetupParticipantExtension; import org.eclipse.core.filebuffers.IFileBuffer; @@ -128,26 +127,10 @@ public class ResourceTextFileBufferManager extends TextFileBufferManager { } public IDocument createEmptyDocument(final IFile file) { - final IDocument[] runnableResult= new IDocument[1]; - final IDocumentFactory factory= ((ResourceExtensionRegistry)fRegistry).getDocumentFactory(file); - if (factory != null) { - ISafeRunnable runnable= new ISafeRunnable() { - public void run() throws Exception { - runnableResult[0]= factory.createDocument(); - } - public void handleException(Throwable t) { - IStatus status= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, FileBuffersMessages.TextFileBufferManager_error_documentFactoryFailed, t); - FileBuffersPlugin.getDefault().getLog().log(status); - if (t instanceof VirtualMachineError) - throw (VirtualMachineError)t; - } - }; - SafeRunner.run(runnable); - } - + IDocument documentFromFactory= createEmptyDocumentFromFactory(file); final IDocument document; - if (runnableResult[0] != null) - document= runnableResult[0]; + if (documentFromFactory != null) + document= documentFromFactory; else document= new SynchronizableDocument(); @@ -188,6 +171,34 @@ public class ResourceTextFileBufferManager extends TextFileBufferManager { return document; } + + /** + * Helper to get rid of deprecation warnings. + * + * @param file the file + * @return the created empty document or <code>null</code> if none got created + * @since 3.5 + * @deprecated As of 3.5 + */ + private IDocument createEmptyDocumentFromFactory(final IFile file) { + final IDocument[] runnableResult= new IDocument[1]; + final org.eclipse.core.filebuffers.IDocumentFactory factory= ((ResourceExtensionRegistry)fRegistry).getDocumentFactory(file); + if (factory != null) { + ISafeRunnable runnable= new ISafeRunnable() { + public void run() throws Exception { + runnableResult[0]= factory.createDocument(); + } + public void handleException(Throwable t) { + IStatus status= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, FileBuffersMessages.TextFileBufferManager_error_documentFactoryFailed, t); + FileBuffersPlugin.getDefault().getLog().log(status); + if (t instanceof VirtualMachineError) + throw (VirtualMachineError)t; + } + }; + SafeRunner.run(runnable); + } + return runnableResult[0]; + } private String getLineDelimiterPreference(IFile file) { IScopeContext[] scopeContext; diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java index cfc1c6e56e4..ddc91c2bcbb 100644 --- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java +++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java @@ -39,7 +39,6 @@ import org.eclipse.core.runtime.content.IContentType; import org.eclipse.core.runtime.content.IContentTypeManager; import org.eclipse.core.filebuffers.IAnnotationModelFactory; -import org.eclipse.core.filebuffers.IDocumentFactory; import org.eclipse.core.filebuffers.IDocumentSetupParticipant; import org.eclipse.core.filebuffers.IDocumentSetupParticipantExtension; import org.eclipse.core.filebuffers.IFileBuffer; @@ -470,27 +469,10 @@ public class TextFileBufferManager implements ITextFileBufferManager { * @since 3.3 */ public IDocument createEmptyDocument(final IPath location, final LocationKind locationKind) { - final IDocument[] runnableResult= new IDocument[1]; - if (location != null) { - final IDocumentFactory factory= fRegistry.getDocumentFactory(location, locationKind); - if (factory != null) { - ISafeRunnable runnable= new ISafeRunnable() { - public void run() throws Exception { - runnableResult[0]= factory.createDocument(); - } - public void handleException(Throwable t) { - IStatus status= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, FileBuffersMessages.TextFileBufferManager_error_documentFactoryFailed, t); - FileBuffersPlugin.getDefault().getLog().log(status); - if (t instanceof VirtualMachineError) - throw (VirtualMachineError)t; - } - }; - SafeRunner.run(runnable); - } - } + IDocument documentFromFactory= createDocumentFromFactory(location, locationKind); final IDocument document; - if (runnableResult[0] != null) - document= runnableResult[0]; + if (documentFromFactory != null) + document= documentFromFactory; else document= new SynchronizableDocument(); @@ -536,6 +518,37 @@ public class TextFileBufferManager implements ITextFileBufferManager { } /** + * Helper to get rid of deprecation warnings. + * + * @param location + * @param locationKind + * @return the created empty document or <code>null</code> if none got created + * @since 3.5 + * @deprecated As of 3.5 + */ + private IDocument createDocumentFromFactory(final IPath location, final LocationKind locationKind) { + final IDocument[] runnableResult= new IDocument[1]; + if (location != null) { + final org.eclipse.core.filebuffers.IDocumentFactory factory= fRegistry.getDocumentFactory(location, locationKind); + if (factory != null) { + ISafeRunnable runnable= new ISafeRunnable() { + public void run() throws Exception { + runnableResult[0]= factory.createDocument(); + } + public void handleException(Throwable t) { + IStatus status= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, FileBuffersMessages.TextFileBufferManager_error_documentFactoryFailed, t); + FileBuffersPlugin.getDefault().getLog().log(status); + if (t instanceof VirtualMachineError) + throw (VirtualMachineError)t; + } + }; + SafeRunner.run(runnable); + } + } + return runnableResult[0]; + } + + /** * {@inheritDoc} * * @deprecated As of 3.3, replaced by {@link #createAnnotationModel(IPath, LocationKind)} |