Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Access parent object in ProposalProvider even if parent is broken reference(Reading attributes of a parent object in the ProposalProvider to show parent specific content assist)
Access parent object in ProposalProvider even if parent is broken reference [message #1801515] Mon, 21 January 2019 14:40 Go to next message
Martin Moser is currently offline Martin MoserFriend
Messages: 18
Registered: January 2019
Junior Member
Hi all,

I would like to implement a ProposalProvider to show object specific content assist.

My DSL objects looks like this:

StepCall :
'call' stepname=[Step]
steps+=(Params | Membercalls)*

'step' name=ValidID

In the editor I wanted to build something like
step myStep {
//get Content assist - specific members

Therefore I want to implement a DSLProposalProvider and there the method

override completeStepcall_Steps(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {

As the name of myStep points to Excel files I wanted to read specific content from those Excel files and show it.
So the content assistant should show different content for "step myStep" and "step secondStep".

I need to get the value of "step", e.g. "myStep", in the method "completeStepcall_Steps" to show the specifics steps for the "step" object.

But, if I use [] to build the reference in my xtext file, I don't get the text in the ProposalProvider.
If I don't use [Step] , so just Step, then I get the name in the method of the ProposalProvider, but then my DiagnosticLinkProvider to check the existence of the links to the Excel file isn't called.

So, how to get the value of that node in the content assist without taking care about a broken link?
I know there is an alternative approach using a ResourceServiceProvider, but I didn't get how to implement this, so I would like to keep that simple approach.

Thanks in advance!
Re: Access parent object in ProposalProvider even if parent is broken reference [message #1801516 is a reply to message #1801515] Mon, 21 January 2019 14:59 Go to previous message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 714
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Since you don't want to have resource descriptions for your external Excel document, you can't use cross references. So you need to identify the valid names to insert on your own in the proposal provider, create ICompletionProposal instances (likely use ConfigurableCompletionProposal as implementation class) for them and pass them to acceptor.
Previous Topic:Formatter2 xtend classes not converted to java on Linux
Next Topic:Inverse operation of ModelJvmModelInferrer
Goto Forum:

Current Time: Sat Dec 07 12:10:38 GMT 2019

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

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

Back to the top