|
|
|
|
|
|
|
Re: Add an ID (hidden) in the metamodel associated with the xtext grammar [message #1831620 is a reply to message #1831618] |
Tue, 25 August 2020 11:32 |
Georgiana Ecobici Messages: 23 Registered: July 2019 |
Junior Member |
|
|
Hello Christian,
Thank you for your suggestion. I have try to override apply and use addAditionalData link below, the Participant object is set with the id inside apply but after the document is updated, the Participant object it loses the id already set.
var textApplier = new IReplacementTextApplier () {
override apply(IDocument document, ConfigurableCompletionProposal proposal) throws BadLocationException {
var participant = proposal.getAdditionalData("participant") as Participant
participant.id = proposal.getAdditionalData("id") as String
document.replace(proposal.getReplacementOffset(), proposal.getReplacementLength(), proposal.getReplacementString());
}
}
var proposal = createCompletionProposal("\"" + getName(el) + "\"",
getLabel(el), null, context) as ConfigurableCompletionProposal
proposal.setTextApplier(textApplier)
proposal.setAdditionalData("id", getId(el))
proposal.setAdditionalData("participant", context.currentModel)
acceptor.accept(proposal);
[Updated on: Tue, 25 August 2020 11:32] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|