Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » GMF: annoying popup window when creating connections(How to avoid it?)
GMF: annoying popup window when creating connections [message #654353] Tue, 15 February 2011 11:17 Go to next message
Giovanni De Sossi is currently offline Giovanni De SossiFriend
Messages: 161
Registered: October 2009
Location: Rome, Italy
Senior Member

Hi all,

in a GMF graphical editor, when I drag a connector, the framework displays a popup window showing text "Create [myConnection] to Existing Element/Create [myConnection] to New Element"; this is very annoying, and I have to eliminate it or, at least, customize its behaviour to show custom types. I googled a lot, but I'm unable to find the related implementation classes to subclass or modify them.

Is there somebody who knows about?

Thanks,
Giovanni
Re: GMF: annoying popup window when creating connections [message #655103 is a reply to message #654353] Fri, 18 February 2011 10:46 Go to previous messageGo to next message
Romain Bioteau is currently offline Romain BioteauFriend
Messages: 65
Registered: August 2009
Location: Grenoble
Member
Hello,
I think this behavior is triggered by the POPUP_ROLE edit policy.

You can remove this edit policy on your edit part in the createDefaultEditPolicy methods with something like :

editPart.removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE);


You can either sublass your EditParts or use a Custom EditPolicyProvider
(see extension point org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders )

HTH


R&D Engineer at BonitaSoft
Re: GMF: annoying popup window when creating connections [message #655118 is a reply to message #655103] Fri, 18 February 2011 12:02 Go to previous messageGo to next message
Giovanni De Sossi is currently offline Giovanni De SossiFriend
Messages: 161
Registered: October 2009
Location: Rome, Italy
Senior Member

Hello Romain,

thank you for your help, but the POPUPBAR_ROLE is not what I need; as you can see by javadoc:

/**
* The key used to install a <i>popup bar</i> EditPolicy. The popup bar
* will be activated during mouse hover for the editpart.
*/
public static final String POPUPBAR_ROLE = "PopupBarEditPolicy";


this role is responsible for showing a list of possible object to create when you move the mouse hover the editPart; moreover, I uninstalled this role yet.

My problem come in when I use the Palette button to create a connection: I select the source (a Node) and then I drag the mouse on a blank side of diagram; at that time the popup appears.

This behaviour is built-in in classes org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCrea tionTool and UnspecifiedTypeConnectionTool, as the javadoc says:

/**
* This specialized creation tool adds support for a multi-type creation tool.
* That is, the tool is given a list of element types and when the user completes
* the gesture, a popup appears asking the user to pick one of the element types
* to be created.
*
* @author cmahoney
*/


I came up here........
Re: GMF: annoying popup window when creating connections [message #655129 is a reply to message #655118] Fri, 18 February 2011 12:57 Go to previous messageGo to next message
Romain Bioteau is currently offline Romain BioteauFriend
Messages: 65
Registered: August 2009
Location: Grenoble
Member
Ok.

What about removing the EditPolicyRoles.CONNECTION_HANDLES_ROLE editPolicy ?

You can also try this :
Add a Link constraints in the .gmfmap (in Java by example)
with someting like :
if(target == null){
 return false ;
}


It will generate a LinkConstraint static class containing a canExistsYourLink containing the constraint.

HTH
Romain


R&D Engineer at BonitaSoft
Re: GMF: annoying popup window when creating connections [message #655483 is a reply to message #655129] Mon, 21 February 2011 10:50 Go to previous messageGo to next message
Giovanni De Sossi is currently offline Giovanni De SossiFriend
Messages: 161
Registered: October 2009
Location: Rome, Italy
Senior Member

Hi Romain,

unfortunately I removed the EditPolicyRoles.CONNECTION_HANDLES_ROLE editPolicy yet, it doesn't do the work. Your suggestion about Link Constraints it's interesting, but I cannot relaunch the GMF tooling now, the code was freezed a few months ago, I can just extend it.

Maybe you know a way to obtain same result without regenerate the code?

Thanks,

Giovanni
Re: GMF: annoying popup window when creating connections [message #655495 is a reply to message #655483] Mon, 21 February 2011 13:11 Go to previous messageGo to next message
Romain Bioteau is currently offline Romain BioteauFriend
Messages: 65
Registered: August 2009
Location: Grenoble
Member
Yes,
You can directly edit the diagram code in YourDomainBaseItemSemanticEditPolicy you have a static class LinkConstraints. Search for a method canCreateTheNameofYourLink and add the "target == null then return false" here.

HTH
Romain


R&D Engineer at BonitaSoft

[Updated on: Mon, 21 February 2011 13:12]

Report message to a moderator

Re: GMF: annoying popup window when creating connections [message #655501 is a reply to message #655495] Mon, 21 February 2011 13:27 Go to previous message
Giovanni De Sossi is currently offline Giovanni De SossiFriend
Messages: 161
Registered: October 2009
Location: Rome, Italy
Senior Member

Thank you, this answer really helps me.

Bye,
Giovanni
Previous Topic:Custom Editpart IFigure children fall apart
Next Topic:Feature Label on parent from Semantic Child
Goto Forum:
  


Current Time: Thu Mar 28 12:08:43 GMT 2024

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

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

Back to the top