| How to prevent user to drag a contained element [message #147910] | 
Mon, 27 August 2007 09:44   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hi, 
 
I've got an container element (A) and a contained element (B). A contains B 
in a flow layout. As A and B almost have the same size, when I click on A 
the editor selects B. I would like to prevent the selection of B, every 
click should select the container element A. 
 
I guess it has something to do with an Edit Policy but I can't find it, any 
clue ? 
 
Thanks, 
 
Cédric
 |  
 |  
  | 
 | 
 | 
 | 
| Re: How to prevent user to drag a contained element [message #147959 is a reply to message #147945] | 
Mon, 27 August 2007 11:12   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hi Cédric, 
 
Take a look at EditPart#getTargetEditPart(),  
EditPart#understandsRequest(), EditPart#performRequest(). You may also  
need to delegate EditPart#showSourceFeedback(),  
EditPart#showTargetFeedback() and the associated erase<>Feedback()  
methods as well. 
 
Best regards, 
Boris 
 
 
Cédric Brun wrote: 
> Let's re-open the issue, now I would like the B element to be ignored by the 
> tools, I'm being prevented to create connection when I hover the B 
> (contained in A) but the connection is correct from an A element, and as 
> the A element have no label I can't select it. 
>  
> Where do GMF find the edit part starting from the mouse position ? I could 
> override this behavior no ? 
>  
>  
>  
>  
> Cédric Brun wrote: 
>  
>> I found the solution myself : overriding getDragTracker in the B edit 
>> part: 
>> 
>>         @Override 
>>         public DragTracker getDragTracker(Request request) { 
>>                 return getParent().getDragTracker(request); 
>>         } 
>> 
>> 
>> Keep up the good work ! 
>> 
>> Cédric 
>> 
>> Cédric Brun wrote: 
>> 
>>> Hi, 
>>> 
>>> I've got an container element (A) and a contained element (B). A contains 
>>> B in a flow layout. As A and B almost have the same size, when I click on 
>>> A the editor selects B. I would like to prevent the selection of B, every 
>>> click should select the container element A. 
>>> 
>>> I guess it has something to do with an Edit Policy but I can't find it, 
>>> any clue ? 
>>> 
>>> Thanks, 
>>> 
>>> Cédric 
>
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.09839 seconds