Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Implementing Connections in Gef without having a Palette(Implementing Connections in Gef without having a Palette)
Implementing Connections in Gef without having a Palette [message #638694] Fri, 12 November 2010 09:02 Go to next message
Girish is currently offline GirishFriend
Messages: 4
Registered: June 2010
Junior Member
Hi Freiends

I've read many tutorials for implementing connections but every ttorial i read have connection entry in the palette on select of that the connection is created

I'm thinking of implementing the connections on drag and drop

its something like selecting a source node and dropping on the target node then the connection should appear,
I think this can be implemented but need some guidance
can you please help me in achieving this or else if any document that talks bout this

and i like to have my own connection figure (which should have some other Figure as Child )

Thanks in advance
Re: Implementing Connections in Gef without having a Palette [message #638723 is a reply to message #638694] Fri, 12 November 2010 11:00 Go to previous message
Devi Vara Prasad Bandaru is currently offline Devi Vara Prasad BandaruFriend
Messages: 98
Registered: March 2010
Location: Hyderabad
Member

Regarding creating connections using drag and drop you can try this.
install the below edit policy on the node.


		installEditPolicy(EditPolicy.LAYOUT_ROLE, new XYLayoutEditPolicy() {
			
			@Override
			protected Command getCreateCommand(CreateRequest request) {
				return null;
			}
			
			@Override
			protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
				return null;
			}
			
			@Override
			protected Command getAddCommand(Request request) {
				List<?> editParts = ((ChangeBoundsRequest) request).getEditParts();
				if (editParts.size() == 1) {
                  Object source = editParts.get(0);
                  Object target = getHost();
                  // Return a connection creation command using source and target edit parts
				}
				return null;
			}
		});

 




Previous Topic:Figures not visible
Next Topic:How can I have a Draw2d button event start a request ?
Goto Forum:
  


Current Time: Mon Dec 22 07:52:50 GMT 2014

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

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