Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 363362 - [PolylineConnectionEx] Do not handle well external invisible label
Summary: [PolylineConnectionEx] Do not handle well external invisible label
Status: NEW
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 major
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 366675 366676 401542
  Show dependency tree
 
Reported: 2011-11-09 12:42 EST by Arthur Daussy CLA
Modified: 2017-09-05 02:33 EDT (History)
3 users (show)

See Also:


Attachments
Model to reproduce (2.33 KB, application/zip)
2011-11-09 12:42 EST, Arthur Daussy CLA
no flags Details
Modified File (54.00 KB, application/octet-stream)
2011-11-09 12:43 EST, Arthur Daussy CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arthur Daussy CLA 2011-11-09 12:42:25 EST
Created attachment 206720 [details]
Model to reproduce

Hello,
 I'm currently working on MDT Papyrus modeller and more activity on the Activity Diagram.
 I have encounter a problem with the following figure:
  org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx

 On this figure, if the method containsPoint(int x, int y) is called with x and y which are contained in an external child which is invisible, this methods return true. I think it might not be the wanted implementation because of the following code:

In org.eclipse.draw2d.Figure.findMouseEventTargetAt(int, int)
#########################################################################
/**
	 * @see IFigure#findFigureAt(int, int, TreeSearch)
	 */
	public IFigure findFigureAt(int x, int y, TreeSearch search) {
		if (!containsPoint(x, y))
			return null;
		if (search.prune(this))
			return null;
		IFigure child = findDescendantAtExcluding(x, y, search);
		if (child != null)
			return child;
		if (search.accept(this))
			return this;
		return null;
	}
#########################################################################

  On this code, the first test is to verify that the coordinates are contained in the figure. However in the case of PolylineConnectionEx it also verify if it is contained by one of this child (but it do not verify if this child is visible or not). In the findDescendantAtExcluding(x, y, search) method it will look in which child the coordinates are contained, but this time it will verify that the child is visible. It's kind of not understandable for me because we first verify that it contained in one of this child but after we do not return this child because it not visible. So like to know if it is not simpler to not consider invisible child in the containsPoint methods. So I would like to suggest to change the implementation has follow :

#########################################################################
  public boolean containsPoint(int x, int y) {
    
    	       ....
    	List children = getChildren();
    	for (int i = 0; i < children.size(); i++) {
                //Diff here
    		IFigure childFig = ((IFigure)children.get(i));
                //Diff here
    		if (childFig.containsPoint(x, y) && childFig.isVisible())
    			return true;
    	}
    	
              ....
    }
#########################################################################
(see attached file)


  In my functional case I have a Control Flow (UML) which is represented by this figure.
  It have externals labels which are children of this figure. Those children can be made invisible. However when my mouse is over one of this external label (which is invisible) the Control flow is selected and I have polluting EditPolicy which are using this request on the ControlFlow Edit Part.

I will also join a model to reproduce the bug.
To do reproduce use the following procedure:
 1. right click on the control flow
 2. select Filters -> Manage Connector labels
 3. Make all label invisible
 4. Click on the empty space where the labels where and move the mouse with the right button down
 4. The control flow have create a bend point

Hoping you will consider those changes,

Regards 

Arthur Daussy
Comment 1 Arthur Daussy CLA 2011-11-09 12:43:09 EST
Created attachment 206721 [details]
Modified File

Sorry this not a patch but I do not have sources from a repository in my workspace
Comment 2 Arthur Daussy CLA 2011-11-09 12:47:59 EST
*** Bug 354622 has been marked as a duplicate of this bug. ***
Comment 3 Arthur Daussy CLA 2011-12-08 07:31:34 EST
As nobody react on this bug I have decide to try to find another solution:

This solution would be to modify only WrappingLabel class as followed:

                  ....
	@Override
	public boolean containsPoint(int x, int y) {
		if (isVisible()){
			return super.containsPoint(x, y);			
		}
		return false;
	}
                  ......

So this class would consider that a wrappingLabel object do not contain anything if it's not visible.
Comment 4 Antonio Garcia-Dominguez CLA 2012-06-19 05:36:07 EDT
I am affected by this bug as well. It's particularly annoying when dealing with Papyrus activity diagrams, as some control flows have as many as 4 invisible layers.