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 90836 Details for
Bug 220457
Take multiple content-types into account
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch implementing multiple content-types support
contentType.patch (text/plain), 2.96 KB, created by
Laurent Goubet
on 2008-02-27 04:44:28 EST
(
hide
)
Description:
Patch implementing multiple content-types support
Filename:
MIME Type:
Creator:
Laurent Goubet
Created:
2008-02-27 04:44:28 EST
Size:
2.96 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.compare >Index: compare/org/eclipse/compare/internal/CompareUIPlugin.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java,v >retrieving revision 1.71 >diff -u -r1.71 CompareUIPlugin.java >--- compare/org/eclipse/compare/internal/CompareUIPlugin.java 22 May 2007 20:19:52 -0000 1.71 >+++ compare/org/eclipse/compare/internal/CompareUIPlugin.java 27 Feb 2008 09:40:31 -0000 >@@ -901,12 +901,16 @@ > } > return (String[]) tmp.toArray(new String[tmp.size()]); > } >- >- private static IContentType getContentType(ITypedElement element) { >+ >+ /* >+ * Returns the first content-type for the given element that defines >+ * a binding on both a ContentMergeViewer and a StructureMergeViewer >+ */ >+ private IContentType getContentType(ITypedElement element) { > if (element == null) > return null; > String name= element.getName(); >- IContentType ct= null; >+ IContentType[] ct= null; > if (element instanceof IStreamContentAccessor) { > IStreamContentAccessor isa= (IStreamContentAccessor) element; > try { >@@ -914,7 +918,7 @@ > if (is != null) { > InputStream bis= new BufferedInputStream(is); > try { >- ct= fgContentTypeManager.findContentTypeFor(is, name); >+ ct= fgContentTypeManager.findContentTypesFor(is, name); > } catch (IOException e) { > // silently ignored > } finally { >@@ -930,8 +934,28 @@ > } > } > if (ct == null) >- ct= fgContentTypeManager.findContentTypeFor(name); >- return ct; >+ ct= fgContentTypeManager.findContentTypesFor(name); >+ // We found more than a single content-type for this file. >+ // Seeks out a content-type on which a viewer is defined. >+ if (ct.length > 0) { >+ initializeRegistries(); >+ IContentType best = ct[0]; >+ for (int i= 0; i < ct.length; i++) { >+ final Object structureViewer = fStructureMergeViewers.search(ct[i]); >+ final Object contentViewer = fContentMergeViewers.search(ct[i]); >+ if (structureViewer != null && contentViewer != null) >+ /* >+ * This loop could be broken now, but what should be do when more >+ * than one content-type defines both a structureViewer and a >+ * contentViewer? The best option would be to put a "priority" >+ * attribute to the org.eclipse.compare.ContentMergeViewers and >+ * org.eclipse.compare.StructureMergeViewers extension points. >+ */ >+ best = ct[i]; >+ } >+ return best; >+ } >+ return ct[0]; > } > > /* >@@ -950,9 +974,10 @@ > } > > /* >- * Returns the most specific content type that is common to the given inputs or null. >+ * Returns the most common content type that defines a binding on both >+ * a ContentMergeViewer and a StructureMergeViewer > */ >- private static IContentType getCommonType(ICompareInput input) { >+ private IContentType getCommonType(ICompareInput input) { > > ITypedElement ancestor= input.getAncestor(); > ITypedElement left= input.getLeft();
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 220457
:
90801
|
90836
|
131114
|
131115
|
132074