How to remove line above node compartment [message #550151] |
Thu, 29 July 2010 06:15  |
Eclipse User |
|
|
|
Originally posted by: jan.vandenbergh.uhasselt.be
Hi,
I am developing a GMF editor for a DSL. This DSL contains several nodes
that contain one compartment. Above this compartment there is a
horizontal line. Can I remove this horizontal line or change its
visualization? I would prefer a solution that only modifies the
..gmfgraph model, if possible.
Many thanks!
Kind regards,
Jan
|
|
|
|
|
Re: How to remove line above node compartment [message #553181 is a reply to message #550774] |
Mon, 16 August 2010 11:30   |
Eclipse User |
|
|
|
Originally posted by: jan.vandenbergh.uhasselt.be
On 4/08/2010 11:57, Marius Gröger wrote:
> Am 29.07.2010 12:15, wrote Jan Van den Bergh:
>> Hi,
>>
>> I am developing a GMF editor for a DSL. This DSL contains several nodes
>> that contain one compartment. Above this compartment there is a
>> horizontal line. Can I remove this horizontal line or change its
>> visualization? I would prefer a solution that only modifies the
>> .gmfgraph model, if possible.
>
> Late reply, for some reason I couldn't reach the news server for a
> couple of days.
>
> You can either modify the compartment's figure in the generated edit
> part code, or use the following generic solution which uses a seperate
> plugin:
>
> plugin.xml:
> <extension
> point="org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders ">
> <editpolicyProvider class="XXX.policies.EditPolicyProvider">
> <Priority
> name="Medium">
> </Priority>
> </editpolicyProvider>
> </extension>
>
> XXX.policies.EditPolicyProvider:
>
> private EditPartListener compartmentSilencer = new
> EditPartListener.Stub() {
> @Override
> public void childAdded(EditPart child, int index) {
> if (child instanceof CompartmentEditPart) {
> // remove top border
> ((CompartmentEditPart)child).getFigure().setBorder(null);
> }
> }
> }
>
> public class EditPolicyProvider implements IEditPolicyProvider {
> ...
> public void createEditPolicies(EditPart editPart) {
> if (editPart instanceof ShapeNodeEditPart) {
> editPart.addEditPartListener(compartmentSilencer);
> }
> }
> }
> public boolean provides(IOperation operation) {
> boolean result = false;
> if (operation instanceof CreateEditPoliciesOperation) {
> EditPart editPart = ((CreateEditPoliciesOperation)operation).getEditPart();
> result = editPart instanceof XXXEditPart;
> }
> return result;
> }
>
> I admit this is kind of complicated given the problem to solve, but for
> me it's worth it. I prefer not modifying generated code because I want
> to keep being able to complete wipe and regenerate it. Also, this method
> allows other dynamic "fixes" or additions to be done to the EditParts.
> In fact I called the listener "silencer" because in my code it also
> registers an editpolicy to inhibit the selection handles and the "delete
> from model" context menu entry.
Thank you very much!
This was exactly what I was looking for.
Kind regards,
Jan
>
> HTH
> Marius
|
|
|
|
|
|
|
Re: How to remove line above node compartment [message #677110 is a reply to message #677095] |
Tue, 07 June 2011 11:37  |
Eclipse User |
|
|
|
@Ralph, Could you please tell me what you mean by "generated plugin"? I have only find some Edit->Parts in XX.diagram. In fact, I have four dossier.
abc
abc.diagram
abc.edit
abc.editor
abc.tests
But I have no idea where the plugin->EditPart-createFigure() is ?
Thank you very much for your help.
Vincent
|
|
|
Powered by
FUDForum. Page generated in 0.09874 seconds