[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.modeling.gmt.amw] Re: extending defaultWeavingPanel

Hello,

see the answers below.

I´m extending DefaultWeavingPanel. I trigger a validation when i add a right
link (I modified "createWLinkEndActions" method). If validation method return
false i want to delete right link, but this is difficult.

In the weaver we use the "Editing Domain" notion of EMF editor to modify the models in a easier way. Take a look at the "org.eclipse.weaver.plugin.util.WeaverUtil" class, "setPropertyValue" method.
We use these commands only to add or modify the elements. You can try to do the same to delete elements.


Then i had thought
in
other option:

I want to trigger the validation in the moment i click over a element on right
Panel. If validation method return false i want to disabled drop action.. is it
possible? how?


I had seen some similar in weaver plugin, i attached a screenshot.

Sincerely thanks for your help,

Kelly.


The drag and drop actions are implemented in the "org.eclipse.weaver.extension.panel.WeavingPanelDndManager". You have to modify two methods, "helper", that is responsible for enabling or disabling the drop action (here you call your validation method), and "drop", that is the action that is executed in the moment you drop an element.


- helper method:

After you execute you validation method, there are two main attributes that must be set.

1) event.detail: used to enable/disable the drop action. This is internally used by the component.

event.detail = DND.DROP_NONE means the drop is disabled. This is the default action.

event.detail = DND.DROP_LINK means the drop is enabled. You can set this attribute depending on the result of you validation. In the weaver extension, it depends on the type of the element.

There are other types of DNDs, but we used only these two types.

2) selectionType: this attribute defines the type of the selection, and it is used by the "drop" method.

You can create the selection types you want, since it is an Integer attribute. We have selection types based on the type of the current element.

- drop method:

This method is called if you set the event.detail to a different value than DND.DROP_NONE (DROP_LINK in our case).

Then you can check the value of the selectionType attribute, and execute the appropriate action.


Regards,

Marcos.