Bug 142957 - compartment items not shown in outline view (tree)
Summary: compartment items not shown in outline view (tree)
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal
Target Milestone: 1.0.1   Edit
Assignee: Alex Boyko CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2006-05-22 06:21 EDT by Michael Haeberlen CLA
Modified: 2010-07-19 12:30 EDT (History)
3 users (show)

See Also:


Attachments
screenshot of outline in mindmap example (58.80 KB, image/png)
2006-05-22 06:26 EDT, Michael Haeberlen CLA
no flags Details
Fix for bug 142957 (5.38 KB, patch)
2006-08-01 14:02 EDT, Alex Boyko CLA
no flags Details | Diff
Attempt2 to fix 142957 (10.30 KB, patch)
2006-08-09 16:51 EDT, Alex Boyko CLA
no flags Details | Diff
Updated patch (11.39 KB, patch)
2006-08-16 10:23 EDT, Alex Boyko CLA
no flags Details | Diff
final patch (11.39 KB, patch)
2006-08-16 11:07 EDT, Alex Boyko CLA
no flags Details | Diff
Resynchronized patch (10.97 KB, patch)
2006-09-05 16:19 EDT, Alex Boyko CLA
no flags Details | Diff
latest patch (10.08 KB, patch)
2006-09-12 17:09 EDT, Alex Boyko CLA
no flags Details | Diff
patch (3.32 KB, patch)
2006-09-13 13:10 EDT, Alex Boyko CLA
no flags Details | Diff
patch (2.06 KB, patch)
2006-09-13 13:15 EDT, Alex Boyko CLA
no flags Details | Diff
patch with moved Tree Edit Parts - for testing (36.50 KB, patch)
2006-09-13 13:22 EDT, Alex Boyko CLA
no flags Details | Diff
final fix (30.92 KB, patch)
2006-09-13 18:09 EDT, Alex Boyko CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Haeberlen CLA 2006-05-22 06:21:30 EDT
this is a follow on of Bugzilla Bug 136305.
maybe also a duplicate of #112983 (but definitely not specific to logic diagram)

the problem is in the tree view of outline.
Comment 1 Michael Haeberlen CLA 2006-05-22 06:26:14 EDT
Created attachment 42136 [details]
screenshot of outline in mindmap example
Comment 2 Alex Boyko CLA 2006-08-01 14:02:46 EDT
Created attachment 47166 [details]
Fix for bug 142957

Compartments - the children of nodes - are now visible in the tree view. Also note, that only visible nodes will appear on the tree view. Hence, making nodes visible/invisible will be adding/removing them from the tree view. Children of compartments are visible too. (Connection nodes are not visible still - don't know if we need them to appear on the tree view... There is still a lot to be done for the tree view I think)
Comment 3 Steven R. Shaw CLA 2006-08-03 10:33:34 EDT
There's some strange behavior in client code where it appears there the children are duplicates of the parent.  Perhaps we only want to visualize children of the node that are Shape Nodes?  Patch needs to be revisited...

Also, when clicking on the children nodes, the properties view doesn't update to reflect the selection.  Only works on the root element.
Comment 4 Alex Boyko CLA 2006-08-09 16:51:10 EDT
Created attachment 47649 [details]
Attempt2 to fix 142957

The duplicates observed on the tree view are not really duplicates. Those are the tree nodes for compartments contained within the node. Since the compartments and their parent node have a reference to the same model object they have the same name and icon. There were no way to get around that, hence after talking to Mohammed it's been decided to skip the compartments, but get to the children of the compartments. If compartments are invisible or collapsed tree view won't show the nodes for compartment children. "Delete" operation is supported from the tree view (on nodes only).
The properties view reflects selection made from the tree viewer.
Attaching the patch.
Comment 5 Steven R. Shaw CLA 2006-08-15 17:44:35 EDT
+1

Patch looks good to me...
Comment 6 Alex Boyko CLA 2006-08-16 10:23:17 EDT
Created attachment 48014 [details]
Updated patch

Updated the patch. Put necessary comments in the files, tried to do performance testing, some very minor changes. Code has been reviewed - ready to be commited.
Comment 7 Alex Boyko CLA 2006-08-16 11:07:49 EDT
Created attachment 48019 [details]
final patch

Corrected the file header comment.
Comment 8 Alex Boyko CLA 2006-09-05 16:19:40 EDT
Created attachment 49433 [details]
Resynchronized patch

Resynchronized patch
Comment 9 Alex Boyko CLA 2006-09-06 16:10:02 EDT
Drops the performance of visualizing the model by 27% needs to be revisited. Since, it's not an important issue, moving this to 2.0
Comment 10 Alex Boyko CLA 2006-09-12 17:09:27 EDT
Created attachment 49995 [details]
latest patch

Code changes: added code to prevent potential memory leaks.
Tested performance against the same use case and it appears that performance drop doesn't occur any more.
If this needs to be commited for 1.0.1 now is the time to speak up.

Note: the fix for the propery view for the selection from the tree view has moved to a separate bug created for this issue.
Comment 11 Li Ding CLA 2006-09-12 17:19:08 EDT
I definitely want this fix in 1.0.1. 

One important function in my editor is to represent the parent-children in figures. Some early user feedbacks of my editor already indicated that failing to show children in outline view is a high priority defect.

My editor will be shipped with the product I am working on, so please put this fix in if there is no big performance hit. 
Comment 12 Alex Boyko CLA 2006-09-12 19:10:31 EDT
Please be aware that the only compartment children that show up in the tree view with the current fix are those that have Node view. So, if I'll be able to commit it, before I do commit, it would be nice to get your opinion on the fix. Would you be able to check if the patch does fix the problem for you before 10am tomorrow?
Comment 13 Li Ding CLA 2006-09-12 20:35:08 EDT
I can give it a quick try. How to get the patch ? Is it in cvs already ?
Comment 14 Li Ding CLA 2006-09-12 21:54:14 EDT
Never mind. Got patch.
Unfortuantely, it does not work for me. The children failed on checking of isCompartment() in TreeNodeEditPart:

if (isCompartment(child))
				{
					children.addAll(getNodeChildren(child));
				}
				else if (isCompartment(node) && 
							!((DrawerStyle) node.getStyle(NotationPackage.eINSTANCE.getDrawerStyle())).isCollapsed()
						)
				{
					children.add(child);
				}

As result, the children are not added. 

The child editpart in my editor is extended from CompartmentEditPart. the view of child only has shapeStyle installed. Maybe I should install a draw style ?

Comment 15 Li Ding CLA 2006-09-12 22:38:38 EDT
I don't have compartment figure in parent. The child figure is added directly to parent.

Did some hack on code. It works for me if the TreeNodeEditPart.getNodeChildren(Node) can handle one more case, ie, direct non-compartment child:

if (element instanceof Node)
{
 Node child = (Node) element;
 if (isCompartment(child))
 {
   children.addAll(getNodeChildren(child));
 }
 else if (isCompartment(node) && !((DrawerStyle) node.getStyle(NotationPackage.eINSTANCE.getDrawerStyle())).isCollapsed()
						)
 {
   children.add(child);
 } else if (!isCompartment(node))   // handle direct non-compartment child
    children.add(child);
			}
Comment 16 Alex Boyko CLA 2006-09-13 13:10:14 EDT
Created attachment 50065 [details]
patch

With this patch istead of making the inner outline view class protected, I provide a hook up for a client application to provide appropriate edit part factory. Override #getOutlineViewEditPartFactory() and create your own tree edit parts.

Note: tree edit parts classes belong to the internal package, so I get warnings when try to use them in a client application, but nevertheless everything works. In your own edit part factory take everything that we have currently and add an if block for Node model and create a TreeNodeEditPart for it with your change. I'll see if we can move tree edit part classes in a client accessible package
Comment 17 Alex Boyko CLA 2006-09-13 13:15:02 EDT
Created attachment 50066 [details]
patch

Sorry, I had my tree edit parts moved to another package. This patch is with tree edit parts in the internal package.
Comment 18 Alex Boyko CLA 2006-09-13 13:22:02 EDT
Created attachment 50067 [details]
patch with moved Tree Edit Parts - for testing

The test patch with Tree Edit Parts in the client accessible package (including TreeNodeEditPart). Let me know if this patch is sufficient for you
Comment 19 Alex Boyko CLA 2006-09-13 18:09:01 EDT
Created attachment 50099 [details]
final fix

The final patch.
Comment 20 Alex Boyko CLA 2006-09-14 15:56:01 EDT
Client was satisfied with the provided hook up for setting up customized edit part factory for the tree viewer. Tree edit parts have been moved to a client application accessible package, so that clients can use them.
Patch has been commited for 1.0.1
Marking the bug as fixed
Comment 21 Richard Gronback CLA 2006-09-28 16:13:16 EDT
Added contributed keyword for IP log automation.  Also, this commit in CVS log made by mmostafa indicates it was bug 153305
Comment 22 Eclipse Webmaster CLA 2010-07-19 12:30:33 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime Diagram was the original product and component for this bug