How to remove line above node compartment [message #550151] |
Thu, 29 July 2010 10: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 #550774 is a reply to message #550151] |
Wed, 04 August 2010 09:57 |
Eclipse User |
|
|
|
Originally posted by: marius.groeger.googlemail.com
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.
HTH
Marius
|
|
|
Re: How to remove line above node compartment [message #550775 is a reply to message #550151] |
Wed, 04 August 2010 09:57 |
Eclipse User |
|
|
|
Originally posted by: marius.groeger.googlemail.com
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.
HTH
Marius
|
|
|
Re: How to remove line above node compartment [message #553181 is a reply to message #550774] |
Mon, 16 August 2010 15: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
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03775 seconds