Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EEF] Trouble getting custom properties view to update model
[EEF] Trouble getting custom properties view to update model [message #1790981] Wed, 20 June 2018 22:48 Go to next message
Louis Detweiler is currently offline Louis DetweilerFriend
Messages: 57
Registered: August 2017
Member
Hello, I am using NatTable and would like to use EEF to implement a custom properties view for my NatTable editor. So far there has been no problem doing so aside from getting the widgets to edit the backing model.

For example, in my model I have objects with an EString value called "name". I would like to have a text widget that updates the name EString when the value of the text widget is changed.

I have done everything required to create the properties view and link it with the current selection so that the text widget appears when the objects are selected in the table. However, I have been unable to make the text widget update the name EString of the model.

I believe the issue has to do with the EEFTextDescription's edit expression. I do not know what to set the edit expression to. I have tried simply name.setEditExpression("aql:self.name"); as well as name.setEditExpression("aql:input.emfEditServices(self).setValue(self.name, newValue)"); and neither of these work.

I also tried to look at what the edit expression was for a text widget that was generated using the properties panel specification in a sirius odesign file. The resulting edit expression was:

aql:input.executeOperation(self, 'platform:/plugin/path.to.odesign.plugin#//@extensions.0/@categories.0/@groups.1/@controls.0/@initialOperation')

However, I do not know how to translate this into my situation as there is no documentation on the input.executeOperation aql expression that I can find. Also, I have no odesign file for my NatTable and it seems that this executeOperation expression is referencing something from an odesign file.

What am I missing? Is the issue with the EEFTextDescription's edit expression? If so, what does this edit expression need to be in order to get the text widget to update the model?

Thanks.

[Updated on: Wed, 20 June 2018 22:52]

Report message to a moderator

Re: [EEF] Trouble getting custom properties view to update model [message #1791076 is a reply to message #1790981] Fri, 22 June 2018 11:54 Go to previous message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 451
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

The edit expression of the EEFTextWidget is executed once the user has interacted with the text widget and pressed enter or clicked out of the text widget. This expression is a regular expression which can be based on a language like AQL. It will have access to the variable "newValue" which will contain the new value of the text widget. You can tell EEF to use the AQL interpreter and then register any Java service you like in the AQL interpreter. By default AQL does not provide any operation to modify the model, only operations to navigate inside of the model. You could add an operation to modify the model and then call it from your AQL expression.
For example with a service like this one:
public class CustomServices {
    public void update(EObject eObject, String newValue) {
        // Do stuff
    }
}


You could set the editExpression to "aql:self.update(newValue)". You would just need to register the Java class in AQL to make it available when the expression will be evaluated with something like this:

IQueryEnvironment environment = Query.newEnvironmentWithDefaultServices(null);
environment.registerEPackage(EcorePackage.eINSTANCE);
ServiceUtils.registerServices(environment, ServiceUtils.getServices(environment, CustomServices.class));
environment.registerCustomClassMapping(EcorePackage.eINSTANCE.getEStringToStringMapEntry(), EStringToStringMapEntryImpl.class);
AQLInterpreter interpreter = new AQLInterpreter(environment);


And then you can give this AQL interpreter instance, with your custom services available to EEF thanks to:
org.eclipse.eef.core.api.EEFViewFactory.createEEFView(EEFViewDescription, IVariableManager, IInterpreter, EditingContextAdapter, IEEFDomainClassTester, InputDescriptor)

The expression generated for Sirius is quite complex since it involves the support for Sirius model operation DSL. You do not need that if you just need to use EEF by itself.

Regards,

St├ęphane B├ęgaudeau



Previous Topic:[Edapt] Feature not found when migrating
Next Topic:[Edapt] XML parsing issue when migrating older model
Goto Forum:
  


Current Time: Fri Sep 21 08:19:17 GMT 2018

Powered by FUDForum. Page generated in 0.01616 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top