| [EMF Forms] Generic Custom Control [message #1716274] |
Wed, 02 December 2015 10:57  |
Eclipse User |
|
|
|
Hello,
I have 4 ecore models and I want to implement a generic custom control to apply to some of the attributes or references from all 4 models, but without causing a dependency of the project with the models.
I thought about creating a file plugin.properties that would contain some information like the canonical name of the class and the name of the attribute/reference that I want to be rendered.
For example:
com.company.model1.model.AType=ATypeAttribute
com.company.model2.model.BType=BTypeAttribute
com.company.model3.model.CType=CTypeReference
...
And in the renderer service to have something like this:
public class CustomControlSWTRendererService implements EMFFormsDIRendererService<VControl> {
@Override
public double isApplicable(VElement vElement, ViewModelContext viewModelContext) {
...
List<EStructuralFeature> listOfObjectsToBeRendered = getElementsToBeRendered();
for (EStructuralFeature feature : listOfObjectsToBeRendered) {
if (feature.equals(eStructuralFeature))
{
return 10;
}
}
return NOT_APPLICABLE;
}
public List<EStructuralFeature> getElementsToBeRendered(){
// parse plugin.properties
// instead of calling the Model1Package.eINSTANCE.getAType_ATypeAttribute() use EMF reflective API
}
My question is how do I use the EMF reflective API to do this? Or do you have another idea on how can I accomplish this generic control?
Best regards,
S.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03822 seconds