Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342777 - ImageProvider needs to support a listener mechanism
Summary: ImageProvider needs to support a listener mechanism
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sapphire (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Konstantin Komissarchik CLA
QA Contact:
URL:
Whiteboard:
Keywords: plan
Depends on:
Blocks:
 
Reported: 2011-04-13 18:24 EDT by Greg Amerson CLA
Modified: 2021-11-19 09:22 EST (History)
2 users (show)

See Also:


Attachments
Patch to fix action extension images after build #290 (2.12 KB, patch)
2011-04-23 07:42 EDT, Greg Amerson CLA
no flags Details | Diff
Fix for regression in SapphireActionSystemPart (2.23 KB, patch)
2011-04-23 07:55 EDT, Greg Amerson CLA
konstantin: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Amerson CLA 2011-04-13 18:24:53 EDT
If an imageProvider class bases the image of an element based on a particular property value, it would be useful if the imageProvider could "listen" to changes to that property and also refresh or update the image value based on the change.
Comment 1 Konstantin Komissarchik CLA 2011-04-22 18:32:46 EDT
Enhancement implemented. Details in the migration guide and the what's new document.
Comment 2 Greg Amerson CLA 2011-04-23 07:41:26 EDT
Thanks Konstantin, for putting in this change, a very nice feature.  However, when I updated to the latest build it seems that none of the images in actions that were declared in sapphire-extension.xml in the UI plugin where showing up.  Images declared on modelElements via @Image(path="...") are working fine, it seemed to just be global action images defined in extension file.  I'll try to fix it locally and attach a patch
Comment 3 Greg Amerson CLA 2011-04-23 07:42:38 EDT
Created attachment 193953 [details]
Patch to fix action extension images after build #290

I've attached a patch to the SapphireActionSystemPart.java file that works again HEAD(20110423) and it seems to fix the problem.
Comment 4 Greg Amerson CLA 2011-04-23 07:54:29 EDT
Comment on attachment 193953 [details]
Patch to fix action extension images after build #290

>### Eclipse Workspace Patch 1.0
>#P org.eclipse.sapphire.ui
>Index: src/org/eclipse/sapphire/ui/SapphireActionSystemPart.java
>===================================================================
>RCS file: /cvsroot/technology/org.eclipse.sapphire/plugins/org.eclipse.sapphire.ui/src/org/eclipse/sapphire/ui/SapphireActionSystemPart.java,v
>retrieving revision 1.5
>diff -u -r1.5 SapphireActionSystemPart.java
>--- src/org/eclipse/sapphire/ui/SapphireActionSystemPart.java	20 Apr 2011 05:40:24 -0000	1.5
>+++ src/org/eclipse/sapphire/ui/SapphireActionSystemPart.java	23 Apr 2011 11:33:23 -0000
>@@ -16,6 +16,7 @@
> import java.util.concurrent.CopyOnWriteArrayList;
> 
> import org.eclipse.jface.resource.ImageDescriptor;
>+import org.eclipse.sapphire.modeling.ImageData;
> import org.eclipse.sapphire.modeling.el.FailSafeFunction;
> import org.eclipse.sapphire.modeling.el.Function;
> import org.eclipse.sapphire.modeling.el.FunctionContext;
>@@ -80,13 +81,17 @@
>             
>             for( ISapphireActionImage image : def.getImages() )
>             {
>-                final Function imageFunction = FailSafeFunction.create( image.getImage().getContent(), Literal.create( ImageDescriptor.class ) );
>+                final Function imageFunction = FailSafeFunction.create( image.getImage().getContent(), Literal.create( ImageData.class ) );
>                 final FunctionResult imageFunctionResult = imageFunction.evaluate( this.functionContext ); 
>-                final ImageDescriptor img = (ImageDescriptor) imageFunctionResult.value();
>+                final ImageData data = (ImageData) imageFunctionResult.value();
>                 
>-                if( img != null )
>+                if( data != null )
>                 {
>-                    this.images.add( img );
>+                    final ImageDescriptor img = ImageDescriptor.createFromImageData(new org.eclipse.swt.graphics.ImageData(data.contents()));
>+                    if (img != null)
>+                    {
>+                        this.images.add( img );	
>+                    }                	
>                 }
>                 
>                 imageFunctionResult.dispose();
Comment 5 Greg Amerson CLA 2011-04-23 07:55:26 EDT
Created attachment 193954 [details]
Fix for regression in SapphireActionSystemPart

Silly bugzilla, i meant to upload an updated patch.
Comment 6 Greg Amerson CLA 2011-04-23 09:10:11 EDT
Since for me the fix for this bug knocked out images loading properly from sapphire-extension.xml, I'm going to re-open this bug.  I hope that is OK.
Comment 7 Konstantin Komissarchik CLA 2011-04-23 11:52:34 EDT
Not sure how I managed to miss that problem. Thanks for fixing. I have released your patch with a small tweak to re-use an existing ImageData to ImageDescriptor conversion function and addition of the required contribution header.
Comment 8 Ling Hao CLA 2011-06-09 14:46:16 EDT
Verify with calendar sample.