Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Prevent Content Assist from executing, if only one hit is found
Prevent Content Assist from executing, if only one hit is found [message #250945] Fri, 25 January 2008 12:05 Go to next message
Eclipse UserFriend
Hi,

if content assist only finds one option, it (generally) executes this
option, without displaying it first (e.g. I enter syserr <ctrl+space> and
it directly expands to System.err.println("");). I know that I can disable
this in the preferences.
However, what I would like to have is a possibility to prevent certain
categories of content assists from being executed if there's only one
option. Can I achieve this somehow (aside from returning two hits where
there's only one)?

Thanks,
Philipp
Re: Prevent Content Assist from executing, if only one hit is found [message #250966 is a reply to message #250945] Sun, 27 January 2008 09:38 Go to previous messageGo to next message
Eclipse UserFriend
Philipp Bouillon wrote:

> Hi,
>
> if content assist only finds one option, it (generally) executes this
> option, without displaying it first (e.g. I enter syserr <ctrl+space>
> and it directly expands to System.err.println("");). I know that I can
> disable this in the preferences.
> However, what I would like to have is a possibility to prevent certain
> categories of content assists from being executed

What categories are you talking about? Templates vs. Java?

Dani

> if there's only one option. Can I achieve this somehow (aside from
> returning two hits where there's only one)?
>
> Thanks,
> Philipp
>
Re: Prevent Content Assist from executing, if only one hit is found [message #251055 is a reply to message #250966] Tue, 29 January 2008 03:04 Go to previous messageGo to next message
Eclipse UserFriend
>> if content assist only finds one option, it (generally) executes this
>> option, without displaying it first (e.g. I enter syserr <ctrl+space>
>> and it directly expands to System.err.println("");). I know that I can
>> disable this in the preferences.
>> However, what I would like to have is a possibility to prevent certain
>> categories of content assists from being executed

> What categories are you talking about? Templates vs. Java?

Yeah, in that line. I have defined my own category (call it
"myplugin.category" for example) and it nicely displays after the "java"
and "template" proposals. However, if only _one_ content assist proposal
is found, no matter what category it is in, it is automatically executed
-- unless I deactivate that feature altogether in the preferences.

What I'd like to have is that if only one proposal is found, and it is of
the category "java", it should be executed; if however, only one proposal
is found and it's of the category "myplugin.category", I'd like the user
to conciously decide to execute the proposal.

Is that possible?
Thanks.
Re: Prevent Content Assist from executing, if only one hit is found [message #251058 is a reply to message #251055] Tue, 29 January 2008 03:10 Go to previous messageGo to next message
Eclipse UserFriend
Philipp Bouillon wrote:

>>> if content assist only finds one option, it (generally) executes
>>> this option, without displaying it first (e.g. I enter syserr
>>> <ctrl+space> and it directly expands to System.err.println("");). I
>>> know that I can disable this in the preferences.
>>> However, what I would like to have is a possibility to prevent
>>> certain categories of content assists from being executed
>>
>
>> What categories are you talking about? Templates vs. Java?
>
>
> Yeah, in that line. I have defined my own category (call it
> "myplugin.category" for example) and it nicely displays after the
> "java" and "template" proposals. However, if only _one_ content assist
> proposal is found, no matter what category it is in, it is
> automatically executed -- unless I deactivate that feature altogether
> in the preferences.
>
> What I'd like to have is that if only one proposal is found, and it is
> of the category "java", it should be executed; if however, only one
> proposal is found and it's of the category "myplugin.category", I'd
> like the user to conciously decide to execute the proposal.

>
> Is that possible?

Yes: let your proposal implement
org.eclipse.jface.text.contentassist.ICompletionProposalExte nsion4.isAutoInsertable()
and return 'false'.

Dani

> Thanks.
>
Re: Prevent Content Assist from executing, if only one hit is found [message #251077 is a reply to message #251058] Tue, 29 January 2008 08:17 Go to previous message
Eclipse UserFriend
Excellent! Thanks a lot.
Previous Topic:How to fire a install jre changed event programmatically?
Next Topic:Re: Editor within swt shell
Goto Forum:
  


Current Time: Tue Apr 29 08:24:51 EDT 2025

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

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

Back to the top