Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to prevent user to drag a contained element
How to prevent user to drag a contained element [message #147910] Mon, 27 August 2007 13:44 Go to next message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 431
Registered: July 2009
Senior Member
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


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Re: How to prevent user to drag a contained element [message #147918 is a reply to message #147910] Mon, 27 August 2007 14:00 Go to previous messageGo to next message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 431
Registered: July 2009
Senior Member
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


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Re: How to prevent user to drag a contained element [message #147945 is a reply to message #147918] Mon, 27 August 2007 15:03 Go to previous messageGo to next message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 431
Registered: July 2009
Senior Member
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


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Re: How to prevent user to drag a contained element [message #147952 is a reply to message #147945] Mon, 27 August 2007 15:08 Go to previous messageGo to next message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 431
Registered: July 2009
Senior Member
I'll answer myself another time :)

removing all the code in createDefaultEditPolicies of B and only A will
answer the requests !

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


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Re: How to prevent user to drag a contained element [message #147959 is a reply to message #147945] Mon, 27 August 2007 15:12 Go to previous message
Boris Blajer is currently offline Boris BlajerFriend
Messages: 217
Registered: July 2009
Senior Member
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
>
Previous Topic:figures with draw2D
Next Topic:Feature Seq Initializer doesn't work good for me
Goto Forum:
  


Current Time: Sun Jul 07 06:19:58 GMT 2024

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

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

Back to the top