Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Context dependent auto activation of content assist
Context dependent auto activation of content assist [message #999492] Sat, 12 January 2013 08:35 Go to next message
Alex G is currently offline Alex G
Messages: 96
Registered: January 2012
Member
Hi!

I want to do the following:

If the user calls content assist (e.g. CTRL+SPACE) and chooses a String to be entered, then I want that dependent of the EObject (model object) behind this string, the content assist is automatically reactivated in order to propose further strings.

Example: You have qualified names "a.b", but in the content assist you only show first "a", then "." and afterwards "b" if the user repeatedly calls CA manually.

Sure one could solve this by calling CA manually on "a", then press "." and the do the default auto activation dependent on the string "." entered (there are some posts and blogs about it on the web, how to do it). But how can I solve it without even pressing "." manually?

So far, I found out, that I can call
sourceViewer.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS)

in order to activate CA manually (where sourceViewer is of type XtextSourceViewer).
I tried this call by configuring an IAutoEditStrategy for an AutoEditStrategyProvider. But the AutoEditStrategyProvider is only invoked, when I edit the document. So: Where do I have to hook in, when I just navigate in the document, or even better: after a chosen string is inserted by the CA automatically?

Re: Context dependent auto activation of content assist [message #1000186 is a reply to message #999492] Mon, 14 January 2013 07:59 Go to previous message
Sebastian Zarnekow is currently offline Sebastian Zarnekow
Messages: 2829
Registered: July 2009
Senior Member
Hi Alex,

please search this newsgroup for COMPLETION_AUTO_ACTIVATION_CHARS.
They are used to automatically trigger content assist for certain input
events.

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 12.01.13 09:35, schrieb Alex G:
> Hi!
>
> I want to do the following:
>
> If the user calls content assist (e.g. CTRL+SPACE) and chooses a String
> to be entered, then I want that dependent of the EObject (model object)
> behind this string, the content assist is automatically reactivated in
> order to propose further strings.
>
> Example: You have qualified names "a.b", but in the content assist you
> only show first "a", then "." and afterwards "b" if the user repeatedly
> calls CA manually.
>
> Sure one could solve this by calling CA manually on "a", then press "."
> and the do the default auto activation dependent on the string "."
> entered (there are some posts and blogs about it on the web, how to do
> it). But how can I solve it without even pressing "." manually?
>
> So far, I found out, that I can call
> sourceViewer.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS)
>
> in order to activate CA manually (where sourceViewer is of type
> XtextSourceViewer).
> I tried this call by configuring an IAutoEditStrategy for an
> AutoEditStrategyProvider. But the AutoEditStrategyProvider is only
> invoked, when I edit the document. So: Where do I have to hook in, when
> I just navigate in the document, or even better: after a chosen string
> is inserted by the CA automatically?
>
>
Previous Topic:Using images from other plugins in LabelProvider
Next Topic:Parser optymization
Goto Forum:
  


Current Time: Wed Sep 17 21:54:24 GMT 2014

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

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