Binding Ecore model object to ECP form custom control [message #1713131] |
Sun, 01 November 2015 01: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,
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05933 seconds