Binding Ecore model object to ECP form custom control [message #1713131] |
Sun, 01 November 2015 05:11 |
Eclipse User |
|
|
|
I am using Ecore modeled objects with forms that contain ECP custom controls. I open the first object in my ECP form. While it is still active, I open a second object in a second instance of the same ECP form. Viewing the second object, when I click on the custom control, it now has the first object. The call to retrieve the object from the modelRef, getValue(modelRef), seems to return the lastRerencedObject? How do I get the object that the form was opened with? What am I doing wrong?
Here is my custom control Editor class:
public class PrivilegesEditor extends ECPAbstractCustomControlSWT {
private FormToolkit toolkit;
private Composite privilegeArea;
/**
* The constructor.
*/
public PrivilegesEditor() {
}
@Override
protected void disposeCustomControl() {
if (!privilegeArea.isDisposed()) {
privilegeArea.dispose();
}
}
@Override
protected void handleContentValidation() {
// TODO Auto-generated method stub
}
@Override
public SWTGridDescription getGridDescription() {
return GridDescriptionFactory.INSTANCE.createSimpleGrid(1, 1, null);
}
@Override
public Control renderControl(SWTGridCell cell, Composite parent)
throws NoRendererFoundException, NoPropertyDescriptorFoundExeption {
VDomainModelReference modelRef = getResolvedDomainModelReference(SqladminPackage.eINSTANCE
.getSQLObjectWithPrivileges_Privileges());
EObjectContainmentWithInverseEList<Privilege> value = (EObjectContainmentWithInverseEList<Privilege>) getValue(modelRef);
SQLObjectWithPrivileges eobject = (SQLObjectWithPrivileges) value
.getEObject();
toolkit = new FormToolkit(parent.getDisplay());
privilegeArea = toolkit.createComposite(parent);
toolkit.adapt(privilegeArea);
privilegeArea.setLayout(new GridLayout(1, false));
privilegeArea
.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
boolean onlyShowRoles = false;
PrivilegesComposite privComp = new PrivilegesComposite(privilegeArea,
SWT.NONE, eobject, onlyShowRoles);
privComp.setLayoutData(new GridData(GridData.FILL_BOTH));
privilegeArea.layout();
return privilegeArea;
}
}
------------
-thanks,
|
|
|
|
|
|
|
Re: Binding Ecore model object to ECP form custom control [message #1713388 is a reply to message #1713372] |
Tue, 03 November 2015 18:16 |
Eclipse User |
|
|
|
Thank you for the reply.
At start up, we create a Hashmap of the various view models. We have one for "create" and one for "display" for each of our forms. Then when we want to render a form, we get the model for the associated object, either the "create" or the "display" version. We are trying to show two different objects in two separate instances of the same form that use the same "display" view model? How is this done?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03809 seconds