diff options
author | spingel | 2009-04-11 17:46:07 +0000 |
---|---|---|
committer | spingel | 2009-04-11 17:46:07 +0000 |
commit | eeda8c6df79b47e56841f8e623a59fc01a2866b1 (patch) | |
tree | bbdc3d04cc2e15e5f44eeae7ddac0b97434e7a29 /org.eclipse.mylyn.tasks.core | |
parent | 5608ec3e18d62eed73d4cff6987f78f587623f89 (diff) | |
download | org.eclipse.mylyn.tasks-eeda8c6df79b47e56841f8e623a59fc01a2866b1.tar.gz org.eclipse.mylyn.tasks-eeda8c6df79b47e56841f8e623a59fc01a2866b1.tar.xz org.eclipse.mylyn.tasks-eeda8c6df79b47e56841f8e623a59fc01a2866b1.zip |
RESOLVED - bug 267960: guess the mime type of attachments from the filename using plug-in registered meta-data
https://bugs.eclipse.org/bugs/show_bug.cgi?id=267960
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r-- | org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/FileTaskAttachmentSource.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/FileTaskAttachmentSource.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/FileTaskAttachmentSource.java index f2eacb250..6c0a59f33 100644 --- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/FileTaskAttachmentSource.java +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/FileTaskAttachmentSource.java @@ -75,14 +75,17 @@ public class FileTaskAttachmentSource extends AbstractTaskAttachmentSource { } // bug 267960 attempt to detect the mime type from the content type IContentTypeManager contentTypeManager = Platform.getContentTypeManager(); - IContentType contentType = contentTypeManager.findContentTypeFor(fileName); - while (contentType != null) { - if (IContentTypeManager.CT_TEXT.equals(contentType.getId())) { - return TEXT_PLAIN; - } else if ("org.eclipse.core.runtime.xml".equals(contentType.getId())) { //$NON-NLS-1$ - return APPLICATION_XML; + // platform may not be available when running standalone + if (contentTypeManager != null) { + IContentType contentType = contentTypeManager.findContentTypeFor(fileName); + while (contentType != null) { + if (IContentTypeManager.CT_TEXT.equals(contentType.getId())) { + return TEXT_PLAIN; + } else if ("org.eclipse.core.runtime.xml".equals(contentType.getId())) { //$NON-NLS-1$ + return APPLICATION_XML; + } + contentType = contentType.getBaseType(); } - contentType = contentType.getBaseType(); } } |