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 21231 Details for
Bug 57137
[content type] investigate content type registry performance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch for org.eclipse.core.runtime
org.eclipse.core.runtime_bug57137.diff (text/plain), 4.56 KB, created by
Rafael Chaves
on 2005-05-16 17:44:23 EDT
(
hide
)
Description:
patch for org.eclipse.core.runtime
Filename:
MIME Type:
Creator:
Rafael Chaves
Created:
2005-05-16 17:44:23 EDT
Size:
4.56 KB
patch
obsolete
>Index: src/org/eclipse/core/internal/content/ContentType.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentType.java,v >retrieving revision 1.63 >diff -u -r1.63 ContentType.java >--- src/org/eclipse/core/internal/content/ContentType.java 12 May 2005 17:56:27 -0000 1.63 >+++ src/org/eclipse/core/internal/content/ContentType.java 16 May 2005 21:38:46 -0000 >@@ -445,7 +445,9 @@ > if (tmpDescriber == null) > return defaultDescription; > ContentDescription description = new ContentDescription(options, this); >- describe(tmpDescriber, buffer, description); >+ 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; >Index: src/org/eclipse/core/internal/content/ContentTypeCatalog.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeCatalog.java,v >retrieving revision 1.14 >diff -u -r1.14 ContentTypeCatalog.java >--- src/org/eclipse/core/internal/content/ContentTypeCatalog.java 12 May 2005 17:56:27 -0000 1.14 >+++ src/org/eclipse/core/internal/content/ContentTypeCatalog.java 16 May 2005 21:38:46 -0000 >@@ -251,7 +251,7 @@ > > IContentType[] findContentTypesFor(ContentTypeMatcher matcher, InputStream contents, String fileName) throws IOException { > final ILazySource buffer = ContentTypeManager.readBuffer(contents); >- IContentType[] selected = internalFindContentTypesFor(matcher, buffer, fileName); >+ IContentType[] selected = internalFindContentTypesFor(matcher, buffer, fileName, true); > // give the policy a chance to change the results > ISelectionPolicy policy = matcher.getPolicy(); > if (policy != null) >@@ -299,7 +299,7 @@ > } > > private IContentDescription getDescriptionFor(ContentTypeMatcher matcher, ILazySource contents, String fileName, QualifiedName[] options) throws IOException { >- IContentType[] selected = internalFindContentTypesFor(matcher, contents, fileName); >+ IContentType[] selected = internalFindContentTypesFor(matcher, contents, fileName, false); > if (selected.length == 0) > return null; > // give the policy a chance to change the results >@@ -352,6 +352,9 @@ > } > > public IContentType[] internalFindContentTypesFor(ILazySource buffer, IContentType[][] subset, Comparator validPolicy, Comparator indeterminatePolicy) throws IOException { >+ if (subset[0].length + subset[1].length == 0) >+ // don't do further work if subset is empty >+ return subset[0]; > final List appropriate = new ArrayList(5); > final int validFullName = collectMatchingByContents(0, subset[0], appropriate, buffer); > final int appropriateFullName = appropriate.size(); >@@ -369,7 +372,7 @@ > return result; > } > >- private IContentType[] internalFindContentTypesFor(ContentTypeMatcher matcher, ILazySource buffer, String fileName) throws IOException { >+ private IContentType[] internalFindContentTypesFor(ContentTypeMatcher matcher, ILazySource buffer, String fileName, boolean forceValidation) throws IOException { > final IContentType[][] subset; > final Comparator validPolicy; > Comparator indeterminatePolicy; >@@ -383,6 +386,12 @@ > indeterminatePolicy = policyGeneralIsBetter; > validPolicy = policySpecificIsBetter; > } >+ int total = subset[0].length + subset[1].length; >+ if (total == 0) >+ return subset[0]; >+ if (!forceValidation && total == 1) >+ // do not do validation if only one was found (caller will validate when describing) >+ return subset[0].length == 1 ? subset[0] : subset[1]; > return internalFindContentTypesFor(buffer, subset, validPolicy, indeterminatePolicy); > } > >@@ -450,9 +459,9 @@ > Set initialSet = (Set) associations.get(FileSpec.getMappingKeyFor(text)); > if (initialSet != null && !initialSet.isEmpty()) { > // copy so we can modify >- result = new HashSet(initialSet); >+ result = new HashSet(initialSet); > // invert the last two bits so it is easier to compare >- typeMask ^= (IContentType.IGNORE_PRE_DEFINED | IContentType.IGNORE_USER_DEFINED); >+ 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))
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 57137
:
17958
| 21231