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 129825 Details for
Bug 269959
Duplicated code in CompareUIPlugin
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]
Dirty patch
clipboard.txt (text/plain), 4.69 KB, created by
Tomasz Zarna
on 2009-03-25 07:13:03 EDT
(
hide
)
Description:
Dirty patch
Filename:
MIME Type:
Creator:
Tomasz Zarna
Created:
2009-03-25 07:13:03 EDT
Size:
4.69 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/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java,v >retrieving revision 1.76 >diff -u -r1.76 CompareUIPlugin.java >--- compare/org/eclipse/compare/internal/CompareUIPlugin.java 25 Mar 2009 11:07:06 -0000 1.76 >+++ compare/org/eclipse/compare/internal/CompareUIPlugin.java 25 Mar 2009 11:12:40 -0000 >@@ -859,6 +859,20 @@ > > ICompareInput input= (ICompareInput) in; > >+ Object[] r = searchByContentType(input, cc); >+ if (r != null) >+ result.addAll((List)r[1]); >+ >+ >+ r = searchByType(input, cc); >+ if (r != null) { >+ result.addAll((List)r[1]); >+ return (ViewerDescriptor[]) result.toArray(new ViewerDescriptor[0]); >+ } >+ return null; >+ } >+ >+ private Object[] searchByContentType(ICompareInput input, CompareConfiguration cc) { > IContentType ctype= getCommonType(input); > if (isCompareAsText(input, cc)) { > ctype = Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT); >@@ -866,10 +880,12 @@ > if (ctype != null) { > initializeRegistries(); > List list = fContentMergeViewers.searchAll(ctype); >- if (list != null) >- result.addAll(list); >+ return new Object[] {ctype.getName(), list}; > } >- >+ return null; >+ } >+ >+ private Object[] searchByType(ICompareInput input, CompareConfiguration cc) { > String[] types= getTypes(input); > String type= null; > if (isHomogenous(types)) >@@ -894,7 +910,7 @@ > initializeRegistries(); > List list = fContentMergeViewers.searchAll(type); > if (list != null) >- result.addAll(list); >+ return new Object[] {type, list}; > } > > // fallback >@@ -912,12 +928,11 @@ > initializeRegistries(); > List list = fContentMergeViewers.searchAll(type); > if (list != null) >- result.addAll(list); >- return (ViewerDescriptor[]) result.toArray(new ViewerDescriptor[0]); >+ return new Object[] {type, list}; > } > return null; >- } >- >+ >+ } > /** > * Returns a content compare viewer based on an old viewer and an input object. > * If the old viewer is suitable for showing the input the old viewer >@@ -1296,66 +1311,20 @@ > public static void log(IStatus status) { > getDefault().getLog().log(status); > } >+ >+ String findContentTypeNameOrType(ICompareInput input, >+ ViewerDescriptor vd, CompareConfiguration cc) { > >- String findContentTypeNameOrType(ICompareInput input, ViewerDescriptor vd, CompareConfiguration cc) { >- IContentType ctype= getCommonType(input); >- if (isCompareAsText(input, cc)) { >- ctype = Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT); >- } >- if (ctype != null) { >- initializeRegistries(); >- List list = fContentMergeViewers.searchAll(ctype); >- if (list != null) >- if (list.contains(vd)) >- return ctype.getName(); >- } >- >- String[] types= getTypes(input); >- String type= null; >- if (isHomogenous(types)) >- type= types[0]; >- >- if (ITypedElement.FOLDER_TYPE.equals(type)) >- return null; >- >- if (type == null) { >- int n= 0; >- for (int i= 0; i < types.length; i++) >- if (!ITypedElement.UNKNOWN_TYPE.equals(types[i])) { >- n++; >- if (type == null) >- type= types[i]; // remember the first known type >- } >- if (n > 1) // don't use the type if there were more than one >- type= null; >- } >- >- if (type != null) { >- initializeRegistries(); >- List list = fContentMergeViewers.searchAll(type); >- if (list != null) >- if (list.contains(vd)) >- return type; >- } >+ Object[] result = searchByContentType(input, cc); >+ if (result != null) >+ if (((List) result[1]).contains(vd)) >+ return (String) result[0]; >+ >+ result = searchByType(input, cc); >+ if (result != null) >+ if (((List) result[1]).contains(vd)) >+ return (String) result[0]; > >- // fallback >- String leftType= guessType(input.getLeft()); >- String rightType= guessType(input.getRight()); >- >- if (leftType != null || rightType != null) { >- boolean right_text= rightType != null && ITypedElement.TEXT_TYPE.equals(rightType); >- boolean left_text= leftType != null && ITypedElement.TEXT_TYPE.equals(leftType); >- if ((leftType == null && right_text) || (left_text && rightType == null) || (left_text && right_text)) >- type= ITypedElement.TEXT_TYPE; >- else >- type= BINARY_TYPE; >- >- initializeRegistries(); >- List list = fContentMergeViewers.searchAll(type); >- if (list != null) >- if (list.contains(vd)) >- return type; >- } > return null; > } > }
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 269959
: 129825 |
129826