|
|
|
Re: emf.edit question (AdapterFactoryContentProvider) [message #424902 is a reply to message #424901] |
Mon, 10 November 2008 12:25 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Jan,
Comments below.
Jan Kohnert wrote:
> Ed,
>
> this topic developed some complexity over the time. I've tried to fire
> a notification event myself, but since the viewer uses a filter for
> Statistic elements no adapters where found to pass the notification
> event to.
You could use a stateful Task adapter and have it attach adapters to its
Statistic children as it computes information about that child...
> Using the adapters of the Statistics parent Task failed because
> notification.getFeatureID() inside the itemProviders
> notifyChanged(Notification notification) methods can only handel
> attributes of its own class.
>
> At the moment I'm doing it simply this way:
> treeViewer.setContentProvider(new
> AdapterFactoryContentProvider(adapterFactory){
> @Override
> public void notifyChanged(Notification notification) {
> Display.getDefault().asyncExec(new Runnable(){
> @Override
> public void run() {
> if (!treeViewer.getTree().isDisposed()){
> treeViewer.refresh(true);
> } }
> });
> }
> });
>
> But thats just the seconds worst way after using a timer object :)
Brute force. :-P You might as well just call refresh once whenever a
command is executed like we do for the properties view, which doesn't
have fine-grained update capability.
>
> I've thought the simples way to solve my problem is to use the
> contentprovider. It takes care managing adaprers and delegating events
> to the propper UI part. But before I'm getting to involved into this I
> wanted to ask how this problem is normally solved.
Adapters is the only way. With the work in
https://bugs.eclipse.org/bugs/show_bug.cgi?id=247130
in combination with data binding (see Boris' attachment) we could do
some interesting things where all the objects accessed to compute a
value are automatically tracked so that notification of changes to a
computed value automagically just happen...
> Jan
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.04194 seconds