Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Non-selectable connections?
Non-selectable connections? [message #754382] Wed, 02 November 2011 11:50 Go to next message
Christian B is currently offline Christian B
Messages: 68
Registered: August 2011
Member
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 11:50]

Report message to a moderator

Re: Non-selectable connections? [message #754466 is a reply to message #754382] Wed, 02 November 2011 15:52 Go to previous messageGo to next message
Joerg Reichert is currently offline Joerg Reichert
Messages: 78
Registered: July 2009
Location: Leipzig
Member
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


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Re: Non-selectable connections? [message #755409 is a reply to message #754466] Tue, 08 November 2011 11:44 Go to previous messageGo to next message
Christian B is currently offline Christian B
Messages: 68
Registered: August 2011
Member
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 11:45]

Report message to a moderator

Re: Non-selectable connections? [message #782141 is a reply to message #755409] Mon, 23 January 2012 08:53 Go to previous messageGo to next message
Christian B is currently offline Christian B
Messages: 68
Registered: August 2011
Member
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 13:32 Go to previous message
Michael Wenz is currently offline Michael Wenz
Messages: 1612
Registered: July 2009
Location: Walldorf, Germany
Senior Member
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: Mon Oct 20 08:25:18 GMT 2014

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

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