Removing all edit policies at once ... [message #1032884] |
Wed, 03 April 2013 15:09 |
Olivier Melois Messages: 14 Registered: March 2012 |
Junior Member |
|
|
Hello everyone,
I am trying to display a diagram in a viewer. The requirements are as follows :
-I should be able to double click on an EditPart to trigger some behavior (which I managed to do by creating a custom edit policy installed thanks to a custom edit policy provider)
-I should be able to select elements so that I can use menus from a right click (which is currently the case)
-When some features of a view change, the matching edit part should be refreshed accordingly (so that I can change colors dynamically, for instance).
-AND THAT'S IT
My problem is that I'd like to get rid of any unwanted behavior. Right now, by using the OffscreenEditPartFactory, the viewer I give me too many possible interactions : I can move stuff around (nodes and edges), I can select labels, when the mouse hovers an item, I get some tooltips ...
It is my understanding that all these behaviors are defined by edit policies. Thing is, apart from the ones I have defined myself, I'd like my diagram to be as
inflexible as it gets. My idea is to have my EditPolicyProvider uninstall all the edit policies from the edit part and then install the ones I truly want (I'd much rather work like this than "blacklisting" all the edit policies I don't want). Problem is : the "policies" attribute of the AbstractEditPart class is private, and sadly enough I don't know any way to retrieve the policies installed on an EditPart (event getting a list of keys would be great).
Does anyone have an idea ? Even if it's something completely different ? I don't want to re-code all the EditParts used in the diagrams I want to display ...
Thank you
|
|
|
|
Re: Removing all edit policies at once ... [message #1033498 is a reply to message #1033097] |
Thu, 04 April 2013 09:33 |
Olivier Melois Messages: 14 Registered: March 2012 |
Junior Member |
|
|
Hi Thomas, thank you for your answer
unfortunately, what I meant is : "I don't want to code my own edit part provider". I can't regenerate the edit parts, as I don't have the code. I just want to uninstall the edit policies, which I don't know how to do(without blacklisting every policy I happen to find).
The problem with the editPolicyIterator is that it won't let me iterate over the keys, which are necessary to uninstall the edit policies. I can access the getEditPolicyIterator method by using reflection but without the keys, having the edit policies is useless for my problem
I'm thinking about creating an encapsulation class and code my own EditPartService (to encapsulate the editParts as they are created), in order to have a "installEditPolicyFix" which I'd use, while the "installEditPolicy" would do nothing. Problem is :using encapsulation would kill any behavior relying on the "instanceOf" mechanisms. I don't know if there is actually any ?
By the way, do the selection events occur thanks to a specific edit policy ? If that is the case, which one would that be ?
tl;dr : how can I generically uninstall all the edit policies from an edit part ?
Thank you for your time ,
Olivier
|
|
|
Powered by
FUDForum. Page generated in 0.03099 seconds