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 206473 Details for
Bug 362921
RWT reports incorrect content-type for images
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]
Patch to add file extensions to theme images and generated images in RWT
rap-image-extension.patch (text/plain), 3.58 KB, created by
Cole Markham
on 2011-11-04 12:20:20 EDT
(
hide
)
Description:
Patch to add file extensions to theme images and generated images in RWT
Filename:
MIME Type:
Creator:
Cole Markham
Created:
2011-11-04 12:20:20 EDT
Size:
3.58 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rap.rwt >Index: src/org/eclipse/rwt/internal/theme/QxImage.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/theme/QxImage.java,v >retrieving revision 1.22 >diff -u -r1.22 QxImage.java >--- src/org/eclipse/rwt/internal/theme/QxImage.java 28 Oct 2011 16:38:35 -0000 1.22 >+++ src/org/eclipse/rwt/internal/theme/QxImage.java 3 Nov 2011 14:26:07 -0000 >@@ -150,8 +150,8 @@ > } > return result; > } >- >- public int hashCode() { >+ >+ public long getHash() { > CRC32 result = new CRC32(); > if( none ) { > result.update( 1 ); >@@ -170,7 +170,11 @@ > result.update( 3 ); > result.update( path.getBytes() ); > } >- return ( int )result.getValue(); >+ return result.getValue(); >+ } >+ >+ public int hashCode() { >+ return ( int )getHash(); > } > > public String toString() { >@@ -193,6 +197,17 @@ > result.append( " }" ); > return result.toString(); > } >+ >+ public String getFilename() { >+ String hash = Long.toHexString( getHash() ); >+ if( path != null ) { >+ int index = path.lastIndexOf( '.' ); >+ if( index >= 0 ) { >+ hash = hash + path.substring( index ); >+ } >+ } >+ return hash; >+ } > > public static Image createSwtImage( QxImage image ) throws IOException { > Image result; >Index: src/org/eclipse/rwt/internal/theme/ThemePropertyAdapterRegistry.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/theme/ThemePropertyAdapterRegistry.java,v >retrieving revision 1.2 >diff -u -r1.2 ThemePropertyAdapterRegistry.java >--- src/org/eclipse/rwt/internal/theme/ThemePropertyAdapterRegistry.java 2 Jun 2011 20:48:52 -0000 1.2 >+++ src/org/eclipse/rwt/internal/theme/ThemePropertyAdapterRegistry.java 3 Nov 2011 14:26:07 -0000 >@@ -114,7 +114,8 @@ > public static class ImagePropertyAdapter implements ThemePropertyAdapter { > > public String getKey( QxType value ) { >- return Integer.toHexString( value.hashCode() ); >+ String filename = ((QxImage)value).getFilename(); >+ return filename; > } > > public String getSlot( QxType value ) { >Index: src/org/eclipse/swt/internal/graphics/InternalImageFactory.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/swt/internal/graphics/InternalImageFactory.java,v >retrieving revision 1.18 >diff -u -r1.18 InternalImageFactory.java >--- src/org/eclipse/swt/internal/graphics/InternalImageFactory.java 19 Oct 2011 09:21:41 -0000 1.18 >+++ src/org/eclipse/swt/internal/graphics/InternalImageFactory.java 3 Nov 2011 14:26:07 -0000 >@@ -149,7 +149,31 @@ > } > > private static String createGeneratedImagePath( ImageData data ) { >- String hash = getHash( data ); >+ int outputFormat = getOutputFormat( data ); >+ String extension; >+ switch( outputFormat ) { >+ case SWT.IMAGE_BMP: >+ case SWT.IMAGE_BMP_RLE: >+ extension = ".bmp"; >+ break; >+ case SWT.IMAGE_GIF: >+ extension = ".gif"; >+ break; >+ case SWT.IMAGE_JPEG: >+ extension = ".jpg"; >+ break; >+ case SWT.IMAGE_TIFF: >+ extension = ".tif"; >+ break; >+ case SWT.IMAGE_ICO: >+ extension = ".ico"; >+ break; >+ case SWT.IMAGE_PNG: >+ default: >+ extension = ".png"; >+ break; >+ } >+ String hash = getHash( data ) + extension; > return "generated/" + hash; > } >
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 362921
: 206473