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 128215 Details for
Bug 267844
[JFace] Changeable icon sets by user.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch on JFace - Without formatting changes
IImageLocationTransformer.txt (text/plain), 3.98 KB, created by
Adam Wehner
on 2009-03-10 11:43:35 EDT
(
hide
)
Description:
Patch on JFace - Without formatting changes
Filename:
MIME Type:
Creator:
Adam Wehner
Created:
2009-03-10 11:43:35 EDT
Size:
3.98 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jface >Index: src/org/eclipse/jface/resource/ImageDescriptor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java,v >retrieving revision 1.14 >diff -u -r1.14 ImageDescriptor.java >--- src/org/eclipse/jface/resource/ImageDescriptor.java 16 Mar 2007 18:01:02 -0000 1.14 >+++ src/org/eclipse/jface/resource/ImageDescriptor.java 10 Mar 2009 15:41:42 -0000 >@@ -12,6 +12,7 @@ > > import java.net.URL; > >+import org.eclipse.jface.internal.JFaceActivator; > import org.eclipse.swt.SWTException; > import org.eclipse.swt.graphics.Device; > import org.eclipse.swt.graphics.Image; >@@ -19,6 +20,9 @@ > import org.eclipse.swt.graphics.PaletteData; > import org.eclipse.swt.graphics.RGB; > import org.eclipse.swt.widgets.Display; >+import org.osgi.framework.Bundle; >+import org.osgi.framework.BundleContext; >+import org.osgi.framework.ServiceReference; > > /** > * An image descriptor is an object that knows how to create >@@ -155,7 +159,7 @@ > if (url == null) { > return getMissingImageDescriptor(); > } >- return new URLImageDescriptor(url); >+ return new URLImageDescriptor(transformImageLocation(url)); > } > > /* (non-Javadoc) >@@ -326,4 +330,36 @@ > public static ImageDescriptor getMissingImageDescriptor() { > return MissingImageDescriptor.getInstance(); > } >+ >+ /** >+ * Transforms the {@link URL} by using an available implementation of >+ * {@link IImageLocationTransformer}. >+ * >+ * @param url >+ * Given image {@link URL}. >+ * @return Transformed {@link URL}. >+ */ >+ private static URL transformImageLocation(URL url) { >+ URL result = url; >+ >+ Bundle bundle = JFaceActivator.getBundle(); >+ if (bundle != null) { >+ BundleContext bundleContext = JFaceActivator.getBundle() >+ .getBundleContext(); >+ if (bundleContext != null) { >+ ServiceReference serviceReference = bundleContext >+ .getServiceReference(IImageLocationTransformer.class >+ .getName()); >+ if (serviceReference != null) { >+ Object service = bundleContext.getService(serviceReference); >+ if (service != null) { >+ IImageLocationTransformer transformer = (IImageLocationTransformer) service; >+ result = transformer.transform(url); >+ } >+ } >+ } >+ } >+ >+ return result; >+ } > } >Index: src/org/eclipse/jface/resource/IImageLocationTransformer.java >=================================================================== >RCS file: src/org/eclipse/jface/resource/IImageLocationTransformer.java >diff -N src/org/eclipse/jface/resource/IImageLocationTransformer.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jface/resource/IImageLocationTransformer.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,33 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.jface.resource; >+ >+import java.net.URL; >+ >+/** >+ * An image location {@link URL} transformer. The implementation of this service >+ * influence the loaded image within {@link ImageDescriptor#createFromURL(URL)}. >+ * >+ * @since 3.4 >+ */ >+public interface IImageLocationTransformer { >+ >+ /** >+ * Transforms the given image location {@link URL} and returns the result. >+ * >+ * @param url >+ * Image's location {@link URL}. >+ * @return Transformed image location {@link URL}. >+ */ >+ public URL transform(URL url); >+ >+}
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 267844
:
128193
| 128215