Displaying animated Gif in a view [message #1843655] |
Thu, 12 August 2021 10:00 |
Lukas Baron Messages: 17 Registered: June 2012 |
Junior Member |
|
|
Hi,
is it somehow possible to implement the getImage-Method in the ItemProvider of an element to return an animated GIF? Or to achieve an animated Gif in a Tree View using another method?
The Background is that I have a view which is updatable. The view displays contents of an underlying model in a tree view, which, in this case, is not editable by the user.
The update triggers some algorithms which require some time and already use the Eclipse Job-API. However, for the user, I want to display the pending state of some elements in the view by displaying a little spinner instead of the ordinary element icon. Unfortunately, I could not figure out a way, that enables the icon to be animated according to the gif-file that I have provided.
Thanks in advance!
Sample-Code:
@Override
public Object getImage(Object object) {
if (((UpdateableElement)object).isUpdating()) {
return ((URL)getResourceLocator().getImage("full/obj16/spinner"));
}
return overlayImage(object, getResourceLocator().getImage("full/obj16/ModelStorage"));
}
[Updated on: Thu, 12 August 2021 10:01] Report message to a moderator
|
|
|
|
|
Re: Displaying animated Gif in a view [message #1843692 is a reply to message #1843681] |
Sat, 14 August 2021 05:40 |
Ed Merks Messages: 32985 Registered: July 2009 |
Senior Member |
|
|
You can use org.eclipse.jface.viewers.StructuredViewer.update(Object, String[]) directly. It sounds like you've already noticed that org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider.ViewerRefresh does this type of thing based on model notifications. It it possible to create org.eclipse.emf.ecore.impl.ENotificationImpl directly and also to call org.eclipse.emf.common.notify.Notifier.eNotify(Notification) directly, though if you're using transactions other parts of the framework will think you've changed the model and made it dirty... If that doesn't matter, you could just set the feature used for the label to the same value it had before...
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02148 seconds