Skip to main content



      Home
Home » Modeling » Graphiti » Non-selectable connections?
Non-selectable connections? [message #754382] Wed, 02 November 2011 07:50 Go to next message
Eclipse UserFriend
Hi,

How can i achieve that connections are not selectable?

I tried the following, but nothing works:

  • connection.setActive(false) --> nothing changed
  • override getSelection() in ToolBehaviourProvider and return null if connection is selected --> does not work, because method is not called for selecting connections...
  • override getClickArea() in ToolBehaviourProvider and return null for connections --> nothing changed


thanks in advance!



[Updated on: Wed, 02 November 2011 07:50] by Moderator

Re: Non-selectable connections? [message #754466 is a reply to message #754382] Wed, 02 November 2011 11:52 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

the getSelection() in ToolBehaviourProvider is called by org.eclipse.graphiti.ui.internal.parts.ShapeEditPart.getTargetEditPart(Request request), this is the code

	@Override
	public EditPart getTargetEditPart(Request request) {
		IConfigurationProvider configurationProvider = getConfigurationProvider();

		PictogramElement alternativeSelection = configurationProvider.getDiagramTypeProvider().getCurrentToolBehaviorProvider()
				.getSelection(getPictogramElement(), configurationProvider.getDiagramEditor().getSelectedPictogramElements());
		if (alternativeSelection != null && request instanceof SelectionRequest) {
			Object object = configurationProvider.getDiagramEditor().getGraphicalViewer().getEditPartRegistry().get(alternativeSelection);
			if (object instanceof EditPart) {
				return (EditPart) object;
			}
		}

		return super.getTargetEditPart(request);
	}


The purpose of getConnection is to return an alternative selection. If null is passed, then the actual selection is used. So a (dirty) work around would be to pass an object that is not null and no EditPart.

Regards,
Joerg
Re: Non-selectable connections? [message #755409 is a reply to message #754466] Tue, 08 November 2011 06:44 Go to previous messageGo to next message
Eclipse UserFriend
thanks!

Problem is getSelection doesn't work on Connections. I tried overwriting getSelection() in ToolBehaviourProvider as you proposed:
@Override
public PictogramElement getSelection(PictogramElement originalPe,
		PictogramElement[] oldSelection) {
	if(originalPe instanceof Connection)
		return Graphiti.getCreateService().createContainerShape(null, false);
	// TODO Auto-generated method stub
	return super.getSelection(originalPe, oldSelection);
}

originalPE is never a Connection, only Diagram, ContainerShapes etc.

The method getSelectionInfoForConnection(Connection connection) is responsible for Connections.
Any ideas how to get non-selectable Connections with this method?


One further requirement:
Connections should not be directly selectable by the user, but adding an element per drag and drop from the palette to an existing connection has to be possible (and in this context, the connections shall be highlighted in orange and dotted as always.

[Updated on: Tue, 08 November 2011 06:45] by Moderator

Re: Non-selectable connections? [message #782141 is a reply to message #755409] Mon, 23 January 2012 03:53 Go to previous messageGo to next message
Eclipse UserFriend
Still haven't figured out how to make connections non-selectable.

Any ideas?
Re: Non-selectable connections? [message #782297 is a reply to message #782141] Mon, 23 January 2012 08:32 Go to previous message
Eclipse UserFriend
There's a method isConnectionSelectionEnabled in the tool behavior provider
you can override to achive that.

Michael
Previous Topic:Accessibility in Graphiti
Next Topic:resizing elements nested in rectangle
Goto Forum:
  


Current Time: Sat Jul 12 04:39:26 EDT 2025

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

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

Back to the top