bindAttribute did not work in case of copy&pase [message #1726400] |
Sat, 12 March 2016 14:16  |
Eclipse User |
|
|
|
Hi Bob,
there is a strange behavior by my own implementation of a customTask element with a customPropertySection.
The customTask element implements a customPropertySection and binds a new attribute called 'processid'
....
@Override
public void createBindings(EObject be) {
setTitle("Workflow");
// ProcessID
this.bindAttribute(attributesComposite, be, "processid");
....
...
This looks than like in screen1.png

In XML the task/attribute definition in bpmn looks like this:
<bpmn2:task id="Task_2" imixs:processid="6" name="Task 1">
So far, everything works.
When you now do a copy&past of this element the id-editor is not rendered (see screen2.png)

Closing the editor and reopen it - everything works again fine.
This behavior exists since a long time. So I did not think it is related to latest changes in 1.2.3. I can't figure out what is wrong. I guess something in the implementation of the customTask element is wrong in general?
We have this public bpmn2-example code on github:
https://github.com/rsoika/bpmn2-tutorial
This is also the example code I used mainly for the developer tutorial in the wiki
https://wiki.eclipse.org/BPMN2-Modeler/DeveloperTutorials/CustomPropertyTabs
Maybe you can take a look at the example code of 'ProcessWorkflowPropertySection'
https://github.com/rsoika/bpmn2-tutorial/blob/master/bpmn2.tutorial.plugin/src/bpmn2/tutorial/ui/task/ProcessWorkflowPropertySection.java
I would update the tutorial code and also the wiki if you can give me a hint what's going wrong?
===
Ralph
Attachment: screen1.png
(Size: 23.22KB, Downloaded 505 times)
Attachment: screen2.png
(Size: 27.83KB, Downloaded 456 times)
|
|
|
Re: bindAttribute did not work in case of copy&pase [message #1726571 is a reply to message #1726400] |
Mon, 14 March 2016 17:36   |
Eclipse User |
|
|
|
Hi Ralph,
Congratulations, you've found another bug 
This is actually caused by the Paste function in DefaultPasteBPMNElementFeature.copyEObject(T eObject). Normally when a new object is constructed (i.e. during loading, or creation through the tool palette) the object is passed through the ModelExtensionDescriptor which adds metadata to the ExtendedPropertiesAdapter for extension features (the "processId" in your case). This does not happen during the Paste operation because...well, I just forgot to handle it.
I have a patch that fixes this easily and with no obvious side-effects. At the end of copyEObject() just before the return t; add these lines:
ExtendedPropertiesAdapter<T> oldAdapter = ExtendedPropertiesAdapter.adapt(eObject);
ExtendedPropertiesAdapter<T> newAdapter = ExtendedPropertiesAdapter.adapt(result);
for (EStructuralFeature oldFeature : oldAdapter.getExtensionFeatures()) {
FeatureDescriptor fd = newAdapter.getFeatureDescriptor(oldFeature);
fd.setProperty(ExtendedPropertiesAdapter.IS_EXTENSION_FEATURE, Boolean.TRUE);
}
Can you please file a bugzilla so we can track this bug?
Thanks!
Bob
|
|
|
|
Powered by
FUDForum. Page generated in 0.03159 seconds