Skip to main content



      Home
Home » Eclipse Projects » GEF » Start connection-creation without palette ??
Start connection-creation without palette ?? [message #164677] Wed, 19 January 2005 14:51 Go to next message
Eclipse UserFriend
Is it possible to create a connection without using the palette ?
I want to connect two "ports" (OutPortEditPart with InPortEditPart) by
clicking on the "out-port" and dragging the connection to the "in-port"
(or vice versa).
All worked fine as long as I used a flyout-palette with the
ConnectionTool ... but now I removed the palette, and simply want to
start connecting by clicking on the corresponding EditPart.

Can someone please provide a snippet on how to achive this behaviour? I
simply don't get it :-(

thanks in advance
Florian
Re: Start connection-creation without palette ?? [message #164708 is a reply to message #164677] Thu, 20 January 2005 09:04 Go to previous messageGo to next message
Eclipse UserFriend
Florian,

Set the defaul tool for your edit domain to ConnectionCreationTool.
You could do this by calling EditDomain#setActiveTool to do this, probably
in your editors constructor.

Best,
Brian.
Florian Georg wrote:

> Is it possible to create a connection without using the palette ?
> I want to connect two "ports" (OutPortEditPart with InPortEditPart) by
> clicking on the "out-port" and dragging the connection to the "in-port"
> (or vice versa).
> All worked fine as long as I used a flyout-palette with the
> ConnectionTool ... but now I removed the palette, and simply want to
> start connecting by clicking on the corresponding EditPart.

> Can someone please provide a snippet on how to achive this behaviour? I
> simply don't get it :-(

> thanks in advance
> Florian
Re:Re: Start connection-creation without palette ?? [message #164747 is a reply to message #164708] Thu, 20 January 2005 12:37 Go to previous messageGo to next message
Eclipse UserFriend
Sorry, that didn't work :-(
If I click on one of my "PortEditPart", it doesn't seem to activate the
connection tool.
Perhaps I'll have to activate the tool manually in a "onClick" handler ?
How can I do this ?

thanks,
Florian

Brian Fernandes schrieb:
> Florian,
>
> Set the defaul tool for your edit domain to ConnectionCreationTool.
> You could do this by calling EditDomain#setActiveTool to do this,
> probably in your editors constructor.
>
> Best,
> Brian.
> Florian Georg wrote:
>
>> Is it possible to create a connection without using the palette ?
>> I want to connect two "ports" (OutPortEditPart with InPortEditPart) by
>> clicking on the "out-port" and dragging the connection to the
>> "in-port" (or vice versa).
>> All worked fine as long as I used a flyout-palette with the
>> ConnectionTool ... but now I removed the palette, and simply want to
>> start connecting by clicking on the corresponding EditPart.
>
>
>> Can someone please provide a snippet on how to achive this behaviour?
>> I simply don't get it :-(
>
>
>> thanks in advance
>> Florian
>
>
>
Re: Start connection-creation without palette ?? [message #164795 is a reply to message #164747] Thu, 20 January 2005 13:42 Go to previous messageGo to next message
Eclipse UserFriend
hmm,
It works for me. What exactly are you doing?
I used
DefaultEditDomain defaultEditDomain = new DefaultEditDomain(this);
defaultEditDomain.setActiveTool(new ConnectionCreationTool());
in the editor constructor.

Anyhow, I just realized that the connection tool is active *all* the time,
so other stuff like selecting EditParts and moving / resizing them will
not be possible straight off without further work. Is this what you want?

Best,
Brian.

Florian Georg wrote:

> Sorry, that didn't work :-(
> If I click on one of my "PortEditPart", it doesn't seem to activate the
> connection tool.
> Perhaps I'll have to activate the tool manually in a "onClick" handler ?
> How can I do this ?

> thanks,
> Florian

> Brian Fernandes schrieb:
>> Florian,
>>
>> Set the defaul tool for your edit domain to ConnectionCreationTool.
>> You could do this by calling EditDomain#setActiveTool to do this,
>> probably in your editors constructor.
>>
>> Best,
>> Brian.
>> Florian Georg wrote:
>>
Re: Start connection-creation without palette ?? [message #164850 is a reply to message #164795] Thu, 20 January 2005 14:19 Go to previous messageGo to next message
Eclipse UserFriend
strange... I actually did exactly the same...

I partially solved the problem now by adding a MouseListener on the
source-ports' figure.
In the "mousePressed" handler I make something like
" getViewer().getEditDomain.setActiveTool(CONNECTION_CREATING_ TOOL) ".

But I'm not sure if this is the right spot... I now get some strange
update problems with the connection visuals :
If the tool was set as active once, only the last added connection is
painted correctly if moving the source-ports' edit part around
(source-ports may have more than one outgoing connection).

refreshSourceConnections() / refreshTargetConnections() doesn't work.
What actually *does* work is moving around the target-port or open/close
the whole editor. In these cases all connections are updated correctly -
just until I activate the tool again for the first time....

hmmm...

thanks
Florian

Brian Fernandes schrieb:
> hmm,
> It works for me. What exactly are you doing?
> I used DefaultEditDomain defaultEditDomain = new
> DefaultEditDomain(this);
> defaultEditDomain.setActiveTool(new ConnectionCreationTool());
> in the editor constructor.
> Anyhow, I just realized that the connection tool is active *all* the
> time, so other stuff like selecting EditParts and moving / resizing them
> will not be possible straight off without further work. Is this what you
> want?
>
> Best,
> Brian.
>
> Florian Georg wrote:
>
>> Sorry, that didn't work :-(
>> If I click on one of my "PortEditPart", it doesn't seem to activate
>> the connection tool.
>> Perhaps I'll have to activate the tool manually in a "onClick" handler
>> ? How can I do this ?
>
>
>> thanks,
>> Florian
>
>
>> Brian Fernandes schrieb:
>>
>>> Florian,
>>>
>>> Set the defaul tool for your edit domain to ConnectionCreationTool.
>>> You could do this by calling EditDomain#setActiveTool to do this,
>>> probably in your editors constructor.
>>>
>>> Best,
>>> Brian.
>>> Florian Georg wrote:
>>>
>
>
Re: Start connection-creation without palette ?? [message #165034 is a reply to message #164850] Fri, 21 January 2005 11:59 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

This isn't the right way. You should return the Connection
CreationDragTracker as the tracker when the mouse is over the appropriate
locations. Also, those locations should probably show the connection cursor
on mouse over or some hint on hover.

"Florian Georg" <FGeorg@gmx.de> wrote in message
news:csp07l$9ui$1@www.eclipse.org...
> strange... I actually did exactly the same...
>
> I partially solved the problem now by adding a MouseListener on the
> source-ports' figure.
> In the "mousePressed" handler I make something like
> " getViewer().getEditDomain.setActiveTool(CONNECTION_CREATING_ TOOL) ".
>
> But I'm not sure if this is the right spot... I now get some strange
> update problems with the connection visuals :
> If the tool was set as active once, only the last added connection is
> painted correctly if moving the source-ports' edit part around
> (source-ports may have more than one outgoing connection).
>
> refreshSourceConnections() / refreshTargetConnections() doesn't work.
> What actually *does* work is moving around the target-port or open/close
> the whole editor. In these cases all connections are updated correctly -
> just until I activate the tool again for the first time....
>
> hmmm...
>
> thanks
> Florian
>
> Brian Fernandes schrieb:
>> hmm,
>> It works for me. What exactly are you doing?
>> I used DefaultEditDomain defaultEditDomain = new
>> DefaultEditDomain(this);
>> defaultEditDomain.setActiveTool(new ConnectionCreationTool());
>> in the editor constructor.
>> Anyhow, I just realized that the connection tool is active *all* the
>> time, so other stuff like selecting EditParts and moving / resizing them
>> will not be possible straight off without further work. Is this what you
>> want?
>>
>> Best,
>> Brian.
>>
>> Florian Georg wrote:
>>
>>> Sorry, that didn't work :-(
>>> If I click on one of my "PortEditPart", it doesn't seem to activate the
>>> connection tool.
>>> Perhaps I'll have to activate the tool manually in a "onClick" handler ?
>>> How can I do this ?
>>
>>
>>> thanks,
>>> Florian
>>
>>
>>> Brian Fernandes schrieb:
>>>
>>>> Florian,
>>>>
>>>> Set the defaul tool for your edit domain to ConnectionCreationTool.
>>>> You could do this by calling EditDomain#setActiveTool to do this,
>>>> probably in your editors constructor.
>>>>
>>>> Best,
>>>> Brian.
>>>> Florian Georg wrote:
>>>>
>>
Previous Topic:Mouse Handling in GEF
Next Topic:DirectedGraphLayout types
Goto Forum:
  


Current Time: Thu Jun 19 03:25:14 EDT 2025

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

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

Back to the top