Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313985 - [Composite Structure Diagram] port becomes invisible after moving
Summary: [Composite Structure Diagram] port becomes invisible after moving
Status: RESOLVED FIXED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 0.7.0   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-21 17:45 EDT by Ansgar Radermacher CLA
Modified: 2012-03-28 05:20 EDT (History)
5 users (show)

See Also:


Attachments
Suggested patch for the bug (1.73 KB, patch)
2010-07-07 04:15 EDT, Ansgar Radermacher CLA
no flags Details | Diff
Alternative patch (2.78 KB, patch)
2010-07-07 15:50 EDT, Ansgar Radermacher CLA
rschnekenburger: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ansgar Radermacher CLA 2010-05-21 17:45:20 EDT
Build Identifier: Build id: 20100506-2000

When a port is moved, it becomes invisible after de-selecting the owning class. Changing the position of the owning class, makes it visible again. (Maybe a Linux only problem?)

Reproducible: Always

Steps to Reproduce:
1. Open a composite structure diagram
2. Add a class
3. Add a port
4. Change position of port
Comment 1 Yann Tanguy CLA 2010-06-07 12:15:37 EDT
Could not reproduce in windows (tested against Composite Structure Diagram r1821).
Comment 2 Yann Tanguy CLA 2010-06-10 12:31:26 EDT
I manage to reproduce something quite similar since 3.6RC3 + Papyrus N201006100643
1. Create Composite
2. Create Class + Port
3. Place Port label outside the Class
4. Click on the Diagram background to deselect the Port label 

-> The PortLabel disappear and comes back after moving the Port.

The issue is not reproductible on 3.6M7.
Comment 3 Ansgar Radermacher CLA 2010-06-10 15:15:30 EDT
(In reply to comment #2)
> I manage to reproduce something quite similar since 3.6RC3 + Papyrus
> N201006100643
> 1. Create Composite
> 2. Create Class + Port
> 3. Place Port label outside the Class
> 4. Click on the Diagram background to deselect the Port label 
> 
> -> The PortLabel disappear and comes back after moving the Port.
> 
> The issue is not reproductible on 3.6M7.

I can no longer reproduce the bug on Linux with the build id I20100527-1700, Papyrus N201006090630. I guess, this is a GMF/GEF issue that has been fixed.

I will set Lamine on copy to try on his machine (Linux as well, but different distribution) and propose to set to resolved, if not reproducable for him.
Comment 4 Mohamed-Lamine BOUKHANOUFA CLA 2010-06-11 03:35:12 EDT
I have try and i can't reproduce the bug on Ubuntu 10.04 and  Papyrus N201006090630.
Comment 5 Ansgar Radermacher CLA 2010-06-11 09:10:10 EDT
(In reply to comment #2)
> I manage to reproduce something quite similar since 3.6RC3 + Papyrus
> N201006100643
> 1. Create Composite
> 2. Create Class + Port
> 3. Place Port label outside the Class
> 4. Click on the Diagram background to deselect the Port label 
> 
> -> The PortLabel disappear and comes back after moving the Port.
> 
> The issue is not reproductible on 3.6M7.

Could reproduce this problem with 3.6M7 + N201006090630. So, it does not seem to be related to 3.6RC3 only but to the papyrus version?
Comment 6 Ansgar Radermacher CLA 2010-06-11 10:36:41 EDT
(In reply to comment #5)
> (In reply to comment #2)
> > I manage to reproduce something quite similar since 3.6RC3 + Papyrus
> > N201006100643
> > 1. Create Composite
> > 2. Create Class + Port
> > 3. Place Port label outside the Class
> > 4. Click on the Diagram background to deselect the Port label 
> > 
> > -> The PortLabel disappear and comes back after moving the Port.
> > 
> > The issue is not reproductible on 3.6M7.
> 
> Could reproduce this problem with 3.6M7 + N201006090630. So, it does not seem
> to be related to 3.6RC3 only but to the papyrus version?

Could reproduce label problem with 3.6RC3 + N201006110631 as well. Should we open a new error or treat it in the context of this error, since it might have a similar technical reason?
Comment 7 Yann Tanguy CLA 2010-06-28 05:34:59 EDT
draw2d issue -> need to check if the issue still exist in Helios release
Comment 8 Mohamed-Lamine BOUKHANOUFA CLA 2010-06-29 03:30:44 EDT
I have try and i can't reproduce the bug on Ubuntu 10.04
and  Papyrus 0.7.0.V201006241830.
eclipse Version: Helios Release
Build id: 20100618-0524
Comment 9 Yann Tanguy CLA 2010-07-02 18:16:32 EDT
Related to change of the clipping strategy introduced between Draw2D V20100511 (~M7) and V20100517.
The clipping strategy has to be modify to include not only the figure but also the possible affixed child nodes and external node label.
Comment 10 Ansgar Radermacher CLA 2010-07-06 18:51:37 EDT
The problem is caused by the fact that the DiagramEditPart does not use a suitable clipping strategy. The paintChildren method of the draw2d.Figure class examines the clipping strategy of a figure: if it is set to null (which is the case of the figure created by the DiagramEditPart), it simple takes the "normal" getBounds of its children. if a clipping strategy is set, it applies this function to get a custom bounds value. The bounds rectangle is used to detect whether something needs to be redrawn.

In case of a class owning a port with a label, the diagram (on the Figure level) contains a BorderedNodeFigure which contains two childs: the ClassNodeFigure and a BorderItemContainerFigure which in turn contains the port and the label. If no clipping strategy is used, the BorderedNodeFigure returns its bounds which correspond to the area of the class only. The suggested modification below of the PackageEditPart constructor below adds a suitable constructor which adds a clipping strategy returning the extended bounds. Please test (seems to work on Linux)

(in package org.eclipse.papyrus.diagram.composite.edit.parts)
h
public PackageEditPart(View view) {
	super(view);
	getFigure().setClippingStrategy (new IClippingStrategy () {
		public Rectangle[] getClip(IFigure childFigure) {

			if (childFigure instanceof BorderedNodeFigure) {
				return new Rectangle [] { ((BorderedNodeFigure) childFigure).getExtendedBounds () };
			}
			else {
				return new Rectangle [] { childFigure.getBounds ) };			}
		}
	});
}
Comment 11 Ansgar Radermacher CLA 2010-07-07 04:15:26 EDT
Created attachment 173624 [details]
Suggested patch for the bug
Comment 12 Ansgar Radermacher CLA 2010-07-07 05:12:29 EDT
Unfortunately, the error still occurs (with the patch) in case of a composite class that has a part with a port (and the port label is placed outside the part). The solution is likely to be very similar to the existing patch, the clipping strategy needs to be applied to the composite class.
Comment 13 Ansgar Radermacher CLA 2010-07-07 15:50:05 EDT
Created attachment 173703 [details]
Alternative patch

This is an alternative patch which is inefficient (yet probably without noticeable impact). It handles additional cases, in which ports are nested within composite structures.
Comment 14 Yann Tanguy CLA 2010-07-09 07:07:09 EDT
Integration of https://bugs.eclipse.org/bugs/attachment.cgi?id=173703 for the coming release, we'll try to find a better solution later.
Code generation templates modified (related changes manually applied).

(Done in r2325)
Comment 15 Yann Tanguy CLA 2010-07-09 07:09:03 EDT
Related bug posted on GEF / Draw2D :

https://bugs.eclipse.org/bugs/show_bug.cgi?id=319348
Product/Component: GEF / draw2d
Comment 16 Ansgar Radermacher CLA 2010-07-11 09:00:35 EDT
The bug is caused by GMF bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=319191
The patch above should be removed, once the corrected GMF version (2.3.1) is integrated.
Comment 17 Ansgar Radermacher CLA 2010-09-06 10:13:07 EDT
Patches provide workaround for a GMF bug which is corrected in version 2.3.1. Should remove patch, once 2.3.1 is in use.
Comment 18 Ansgar Radermacher CLA 2010-09-06 11:17:52 EDT
Sorry for closing this bug some minutes ago. We should keep it open, since there is work to do once we switch to GMF 2.3.1: remove work-around and test if the problem is still fixed.
Comment 19 Yann Tanguy CLA 2011-04-28 13:14:02 EDT
In r4544 - Previous patch removed from generation template (fixed in GMF).
In r4545 - Manual change in Composite Structure Diagram.

No need to re-generate diagram especially for this, current implementation should not cause any trouble.