Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » How to automatically unselect 'connection creation' tool entry in palette ?
How to automatically unselect 'connection creation' tool entry in palette ? [message #1240350] Thu, 06 February 2014 09:25 Go to next message
Laurent Le Moux is currently offline Laurent Le MouxFriend
Messages: 184
Registered: September 2011
Senior Member
Hi all,

I would like to change the palette default behavior regarding connection creation.
Once the connection has been created in my diagram, the 'connection creation' tool entry from the palette remains selected, so that the user can go on creating other connections.

Whereas for object creation, the corresponding selection in the palette is automatically released after the object creation took place in the diagram.

So right now, I have to press the escape key to unselect 'connection creation'.

Is there a way to specify the same behavior as for 'object creation' ?

While reading again the Graphiti tutorial I made some trials but - for example - neither PaletteCompartmentEntry nor ConnectionCreationToolEntry seem to be the right places to achieve this.

Kind regards,

Laurent
Re: How to automatically unselect 'connection creation' tool entry in palette ? [message #1241146 is a reply to message #1240350] Fri, 07 February 2014 14:49 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Laurent,

unfortunatly there's no Graphiti API for doing that.

In order to achieve that you would need to set the property
AbstractTool.PROPERTY_UNLOAD_WHEN_FINISHED to true when creating the tool
entry in the palette. Graphiti does this in GFPaletteRoot.createTool. But as
I said there's currently no API to change that and the behavior is GEF
standard.

Michael
Re: How to automatically unselect 'connection creation' tool entry in palette ? [message #1241352 is a reply to message #1241146] Fri, 07 February 2014 21:16 Go to previous messageGo to next message
Laurent Le Moux is currently offline Laurent Le MouxFriend
Messages: 184
Registered: September 2011
Senior Member
Hi Michael,

Thanks for the explanation. So, I would have to extend DiagramBehavior the following way to automatically unselect the 'connection creation' tool entry :

@Override
protected DefaultPaletteBehavior createPaletteBehaviour() {
  return new DefaultPaletteBehavior(this) {
    @Override
    protected PaletteRoot createPaletteRoot() {
      return new GFPaletteRoot(diagramBehavior.getDiagramTypeProvider()) {
        // Override updatePaletteEntries (including createTool) to return an
        // org.eclipse.gef.palette.ConnectionCreationToolEntry with
        // PROPERTY_UNLOAD_WHEN_FINISHED = true
      };
    }
  };
}


It's indeed a 'significant' amount of code for such a small modification... Smile

Besides, the Graphiti tutorial describes how to create a palette by overriding DefaultToolBehaviorProvider#getPalette that looks to me as the right place to do this.

But, this method involves an org.eclipse.graphiti.palette.impl.ConnectionCreationToolEntry class instead of the previous org.eclipse.gef.palette.ConnectionCreationToolEntry one.

What about a Graphiti evolution so that org.eclipse.graphiti.palette.impl.ConnectionCreationToolEntry would support setting PROPERTY_UNLOAD_WHEN_FINISHED ?

Regards,

Laurent
Re: How to automatically unselect 'connection creation' tool entry in palette ? [message #1244612 is a reply to message #1241352] Wed, 12 February 2014 15:58 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hi Laurent,

yes, that's true. It is quite some coding, also GFPaletteRoot is not part of
the API...

Your proposal to add that as an option to the palette entry sounds good, the
class ConnectionCreationToolEntry seems to be the right place. Would you
please file an enhancement bugzilla for this?

Thanks,
Michael
Re: How to automatically unselect 'connection creation' tool entry in palette ? [message #1245055 is a reply to message #1244612] Thu, 13 February 2014 08:27 Go to previous message
Laurent Le Moux is currently offline Laurent Le MouxFriend
Messages: 184
Registered: September 2011
Senior Member
It's done : https://bugs.eclipse.org/bugs/show_bug.cgi?id=428068

Kind regards,

Laurent
Previous Topic:Connection without Bussiness Object to display a Reference?
Next Topic:Drag and Drop of tool bar element
Goto Forum:
  


Current Time: Thu Apr 25 13:54:40 GMT 2024

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

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

Back to the top