Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 78011 Details for
Bug 198544
[content type] Platform.getContentTypeManager().findContentTypeFor( filename) ignores content type priority
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix
198544.txt (text/plain), 2.03 KB, created by
Szymon Brandys
on 2007-09-10 15:09:23 EDT
(
hide
)
Description:
Fix
Filename:
MIME Type:
Creator:
Szymon Brandys
Created:
2007-09-10 15:09:23 EDT
Size:
2.03 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.contenttype >Index: src/org/eclipse/core/internal/content/ContentTypeMatcher.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeMatcher.java,v >retrieving revision 1.1 >diff -u -r1.1 ContentTypeMatcher.java >--- src/org/eclipse/core/internal/content/ContentTypeMatcher.java 21 Nov 2005 23:06:48 -0000 1.1 >+++ src/org/eclipse/core/internal/content/ContentTypeMatcher.java 10 Sep 2007 19:10:40 -0000 >@@ -36,7 +36,22 @@ > 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; >+ return all.length > 0 ? new ContentTypeHandler((ContentType) getContentTypeWithTheHighestPriority(all), currentCatalog.getGeneration()) : null; >+ } >+ >+ /* >+ * Returns a content type with the highest priority from the given list. >+ */ >+ private IContentType getContentTypeWithTheHighestPriority(IContentType[] contentTypes) { >+ IContentType bestMatch = null; >+ for (int i = 0; i < contentTypes.length; i++) { >+ if (bestMatch == null || (((ContentType) bestMatch).getPriority() < ((ContentType) contentTypes[i]).getPriority())) { >+ bestMatch = contentTypes[i]; >+ if (((ContentType) bestMatch).getPriority() == ContentType.PRIORITY_HIGH) >+ break; >+ } >+ } >+ return bestMatch; > } > > /** >@@ -58,7 +73,7 @@ > 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); >+ result[i] = new ContentTypeHandler((ContentType) getContentTypeWithTheHighestPriority(types), generation); > return result; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 198544
:
78011
|
78018
|
78169
|
78195
|
78196