Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 361081

Summary: Add additions Nodeditpart.xpt for installing custom editpolicies
Product: [Modeling] GMF-Tooling Reporter: Ralph Gerbig <ralphgerbig>
Component: CoreAssignee: Project Inbox <gmp.gmf-tooling-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: borlander, mistria
Version: unspecified   
Target Milestone: 3.0M5   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Patch none

Description Ralph Gerbig CLA 2011-10-16 07:50:28 EDT
Build Identifier: 

Add additions Nodeditpart.xpt for installing custom editpolicies

Reproducible: Always
Comment 1 Ralph Gerbig CLA 2011-10-16 07:51:11 EDT
Created attachment 205282 [details]
Patch

This extension should do the job.
Comment 2 Mickael Istria CLA 2011-10-17 04:42:52 EDT
I think this use-case is intended to be resolved by the org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders extension point. Did you try using it?
Comment 3 Michael Golubev CLA 2011-10-17 04:44:52 EDT
Hello, 

editpolicyProviders will not work, I tried it once, don't yet know whether it is intentional or not. 

However, the intended way to add the editploicies via templates is to register them in GenModel as CustomBehavior's. Why don't this work for you? 

Regards, 
Michael
Comment 4 Mickael Istria CLA 2011-10-17 04:53:38 EDT
FYI editPolicyProvider *DO WORK*. They are extensively used in Bonita for instance. Moreover the pattern of contributing extension is IMHO much easier and "agile" than changing the model.
Comment 5 Ralph Gerbig CLA 2011-10-18 04:47:49 EDT
Hi,

how can one specify the role to use the editpolicy for? I would like to remove the popupbar role and place my own instead. However it seems that one cannot specify the role through this extension point. I did the following:

<extension point="xxx.editpolicyProviders">
  <editpolicyProvider class="xxx.XXXPopupBarEditPolicy">
    <Priority name="Lowest"> </Priority>
    <context editparts="XXX_3060, XXX_3069, XXX_3072"></context>
   </editpolicyProvider>
</extension>

I also see the problem that the IDs are not stable. They somehow sometimes change overtime. I think the cleanest way would be to define the editpolicies in the genmodel? One could then automate this via a custom transformation during the genmodel creation process. What do you think about such an option?

Ralph
Comment 6 Mickael Istria CLA 2011-10-18 05:17:23 EDT
Ralph, have you seen this? http://wiki.eclipse.org/GMF_Newsgroup_Q_and_A#How_do_I_install_an_EditPolicyProvider.3F
Comment 7 Michael Golubev CLA 2011-10-18 07:44:34 EDT
Re:  I think the cleanest way would be to define the editpolicies in the genmodel? One could then automate this via a custom transformation during the genmodel creation process. What do you think about such an option?

Yes, its exactly how I see it, and this is one of the reasons we are going to open the map2gen transformation and allow to plug into it. 

This is (plugging into the bridge, not the installing editpolicies through this:) ) is one of the main goals for 3.0 release.
 
Regards, 
Michael
Comment 8 Michael Golubev CLA 2012-01-18 19:34:36 EST
We should reconsider this for 3.0M5.

I still don't like the idea of registering edit-policies from templates in favor to using CustomBehavior's. With new QVTO bridge and user defined post-bridge transformation it should be easy to define the transformation that creates a couple of custom behaviors for choosen editparts and adds them as a custom-behaviors for GenCommnBase's. 

At the other side, the DEFINE additions itself will not hurt anyone.