Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF and TreeViewer/IDeferredWorkbenchAdapter
EMF and TreeViewer/IDeferredWorkbenchAdapter [message #647647] Fri, 07 January 2011 14:58 Go to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Hello,

i use EMF to generate MyObject.
There is a class Node which has a 1:n assoziation to itself.

i create a TreeViewer

			final TreeViewer viewer = new TreeViewer(client, SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL);
	        AdapterFactory factory = new ProvidermodelItemProviderAdapterFactory();
	        viewer.setLabelProvider(new AdapterFactoryLabelProvider(factory));
	        viewer.setContentProvider(new AdapterFactoryContentProvider(factory));
ProvidermodelFactory.eINSTANCE.createNode();
				for(int j = 0; j<5;j++){
					Node node = ProvidermodelFactory.eINSTANCE.createNode();
					root.getChildren().add(node);
					for(int i = 0 ;i < 100000; i++){
						Node node1 = ProvidermodelFactory.eINSTANCE.createNode();
						node.getChildren().add(node1);
					}
					
					
				}

	        
	        viewer.setInput(root);


If i click + the ui thread is blocked.
How can i use the IDeferredWorkbenchAdapter with EMF? So when i click at + there is a label "Pending".

Thanks
Re: EMF and TreeViewer/IDeferredWorkbenchAdapter [message #647673 is a reply to message #647647] Fri, 07 January 2011 16:40 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Comments below.

SirWayne wrote:
> Hello,
>
> i use EMF to generate MyObject.
> There is a class Node which has a 1:n assoziation to itself.
>
> i create a TreeViewer
>
>
> final TreeViewer viewer = new TreeViewer(client,
> SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL);
> AdapterFactory factory = new
> ProvidermodelItemProviderAdapterFactory();
> viewer.setLabelProvider(new
> AdapterFactoryLabelProvider(factory));
> viewer.setContentProvider(new
> AdapterFactoryContentProvider(factory));
> ProvidermodelFactory.eINSTANCE.createNode();
> for(int j = 0; j<5;j++){
> Node node =
> ProvidermodelFactory.eINSTANCE.createNode();
> root.getChildren().add(node);
> for(int i = 0 ;i < 100000; i++){
That's a lot of children. The user won't have much fun scrolling
through 100,000 items.
> Node node1 =
> ProvidermodelFactory.eINSTANCE.createNode();
> node.getChildren().add(node1);
> }
>
>
> }
>
> viewer.setInput(root);
>
>
> If i click + the ui thread is blocked.
> How can i use the IDeferredWorkbenchAdapter with EMF?
I don't know. I've never used that.
> So when i click at + there is a label "Pending".
Will it really be useful for the user to have to deal with 100,000
items? It seems unlikely...
>
> Thanks


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF and TreeViewer/IDeferredWorkbenchAdapter [message #647684 is a reply to message #647647] Fri, 07 January 2011 18:18 Go to previous message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 51
Registered: August 2009
Member
We have to deal with relatively large EMF models all the time. The best way to view these that I know of (without creating custom editors) is the MoDisco Model Browser. It is a mature generic EMF browser/editor with many features; a great piece of EMF ecosystem that deserves more attention than it gets.

The one feature relevant to this discussion is the way it deals with presenting large collections in the tree: it breaks them into ranges e.g. [1..100], [101..200] etc. (and probably uses some heuristics to come up with ranges dynamically based on the size of the collection) which keeps the number of tree nodes that need to be expanded at the same time small. (It also supports selecting any collection/reference and showing objects in a table which also works fine on relatively large models.)

I would guess this is a common way to deal with the issue of visualizing large trees, and one could implement this in a custom tree editor - but there would have to be a very good reason to not use a generic (and highly customizable) viewer/editor available.

[Updated on: Fri, 07 January 2011 18:20]

Report message to a moderator

Previous Topic:Problem with different instances of the same EClass
Next Topic:[CDO] SSL/TLS Net4j support: where should I start in order to hack it?
Goto Forum:
  


Current Time: Thu Mar 28 11:33:49 GMT 2024

Powered by FUDForum. Page generated in 0.04458 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top