Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » elegant way of solving performance problem with big diagrams
elegant way of solving performance problem with big diagrams [message #203585] Thu, 28 August 2008 09:25 Go to next message
Seweryn Niemiec is currently offline Seweryn NiemiecFriend
Messages: 80
Registered: July 2009
Member
Hi

My diagrams can be very big in sense of number of nodes. This implies
two kinds of problems: a screen refresh time and a diagram loading time.
For now, much more important problem for me is the screen refresh time.
Nodes form a recursive hierarchy with many levels (>5) of containment.
More or less it looks like a UML class diagram, where "Package" can have
"Package" and "Class" objects as it's children. "Class" object has its
own children (in my case 2 levels, sometimes hundreds of small children).

The good thing is that I don't want to display all nodes in the same
time (that would be useless), so the solution to this problem boils down
to developing a method of not showing some of the nodes - in my case:
children of the Class node, which are most CPU consuming.

It would be perfectly, to have something like this:
1. enable diagram partitioning on Package-subPackage relationship
2. a Package which is shown on the diagram as a TopNode shows only one
level of its children in a compartment: Packages and Classes without
theirs children
3. a Package which is shown as a diagram Canvas, shows its children with
all sub-children (with comply of point 2)

I have such diagram editor and it works fine until you want to move a
Class from Package to Package. Since Copy&Paste doesn't work (at least
in GMF 2.1) and Drag&Drop doesn't work too (see bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=245287 + you can't DnD
between editors) this makes whole thing quite useless. Currently the
only way to move Classes between Packages this to: close diagram editor,
open EMF editor, move Class, open diagram editor which using canonical
edit policy will update notation model (but original nodes layout will
be lost)

Do you create editors for very big diagrams? If so, how do you solve
screen refresh time problem?

Or maybe someone has another idea how to not display all levels of
containment?

Greetings,
Seweryn
PS. sorry for my English
Re: elegant way of solving performance problem with big diagrams [message #203609 is a reply to message #203585] Thu, 28 August 2008 10:00 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Seweryn,

I think if the problem is in incorrect D&D then all you need is to patch
D&D (fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=245287). Hope it is
possible by patching generated code/templates.
Later existing solution can be generalized and included into the GMF as your
contribution.

-----------------
Alex Shatalin
Re: elegant way of solving performance problem with big diagrams [message #203624 is a reply to message #203609] Thu, 28 August 2008 10:28 Go to previous messageGo to next message
Seweryn Niemiec is currently offline Seweryn NiemiecFriend
Messages: 80
Registered: July 2009
Member
Alex Shatalin wrote:
> I think if the problem is in incorrect D&D then all you need is to patch
> D&D (fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=245287). Hope it

Yeah, this is probably the best way for me. The more I think about this,
the more I'm convinced that it is theoretically feasible without any
data loss (I mean notation elements' attributes). There is a very long
way before me. I have to get know GMF far better than now :)

Greetings,
Seweryn
Re: elegant way of solving performance problem with big diagrams [message #203632 is a reply to message #203624] Thu, 28 August 2008 10:53 Go to previous messageGo to next message
Seweryn Niemiec is currently offline Seweryn NiemiecFriend
Messages: 80
Registered: July 2009
Member
Seweryn Niemiec wrote:
> Yeah, this is probably the best way for me. The more I think about this,
> the more I'm convinced that it is theoretically feasible without any
> data loss (I mean notation elements' attributes). There is a very long

For DnD of Class object from canvas into top-node Package I would have to:
- find canvas representing same semantic Package object as semantic
object of target top-node Package
- move original Class's notation node and all its children into that canvas
- create new notation node for Class inside top-node Package

This involves a lot of Requests and Commands. The worst thing is that
AFAIK where is no documentation for them and I have to analyze source
code to find them. Does anyone know which Requests/Commands would be
useful for me?

Greetings,
Seweryn
Re: elegant way of solving performance problem with big diagrams [message #203658 is a reply to message #203632] Thu, 28 August 2008 11:40 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Seweryn,

Just for first time you can try moving domain model elements only. This means
- remove original "class" from it's container (associated wtih canvas) and
put it into a subpackage. The rest should be done by GMF (notation model
update). And for the diagram of sub-package it will be done on saving original
diagram

-----------------
Alex Shatalin
Re: elegant way of solving performance problem with big diagrams [message #203913 is a reply to message #203658] Fri, 29 August 2008 15:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: thugcee.gmail.com

Alex Shatalin pisze:
> Hello Seweryn,
>
> Just for first time you can try moving domain model elements only. This

My first implementation of your idea used IEditorAction to do the job.
It was simple and it worked, so I've decided to jump into deep water and
try with DnD and Views persistence. After about 2h of debugging and
tracing the creation of CompoundCommands composed of tens of subcommands
(before .reduce()), I've found the place where I could hook my crappy
code. At the beginning it looked like messing with genes in DNA, where
small change in one place explodes with great number of unexpected
results all over the organism.

In my custom EP, lets call it PackageCompartmentEditPart, I have
installed CreationEditPolicy with overridden getReparentViewCommand
method. Originally this method creates a command which sets eContainer
of the dropped view to the view associated with EditPolicy's host.

I've just added in the middle a special treatment for the case when
Class is dropped into Package. Currently it is very specialized solution
and solves only problem with my model.

(My "Location" is our "Package" and a "Device" as a "Class")

@Override
protected ICommand getReparentViewCommand(
IGraphicalEditPart gep) {
View dropTarget = (View)getHost().getModel();
View view = (View)gep.getModel();
# check if we need special treatment
if (dropTarget.getElement() instanceof Location &&
view.getElement() instanceof Device) {

#we are looking for the Diagram which points to this sem. element
EObject dropTargetElement = dropTarget.getElement();

#probably this is not best method of greping diagrams
EList<Resource> resources = gep.getEditingDomain()
.getResourceSet().getResources();
boolean found = false;
for (Resource res: resources) {
for (EObject element: res.getContents()) {
if (element instanceof Diagram &&
((Diagram)element).getElement() ==
dropTargetElement) {
#we found our diagram, lets put it as a target for AddCommand
dropTarget = (Diagram)element;
found = true;
break;
}
}
if (found) break;
}
}
return new AddCommand(gep.getEditingDomain(),
new EObjectAdapter(dropTarget),
new EObjectAdapter(view));
}

The solution for the opposite direction should be simple too. I hope
someone will find it useful.

--
Greetings,
Seweryn
Re: elegant way of solving performance problem with big diagrams [message #203996 is a reply to message #203913] Mon, 01 September 2008 10:25 Go to previous message
Seweryn Niemiec is currently offline Seweryn NiemiecFriend
Messages: 80
Registered: July 2009
Member
Seweryn Niemiec wrote:
> My first implementation of your idea used IEditorAction to do the job.

I have attached _much_ better version to bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=245287

--
Greetings,
Seweryn
Previous Topic:Defective copy and paste features
Next Topic:FeedBack connection between ConnectionEditPart and LabelEditPart
Goto Forum:
  


Current Time: Fri Apr 26 05:37:14 GMT 2024

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

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

Back to the top