Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Java Content Assist in a View(How to include the Java Content Assist for editors in a view.)
Java Content Assist in a View [message #1003614] Mon, 21 January 2013 11:08 Go to next message
Agustin Muñoz
Messages: 2
Registered: January 2013
Junior Member
Hi,

I don't know if it is the correct project to post about this. Sorry if not.

I'm implementing a plugin consisting on a view, that requires Java content assist. The view includes a small window where java code is typed and evaluated. Same as the Display view in Debug mode.
I've searched a lot in the web, but couldn't find any help on this.

Is there any way this can be accomplished?

Thanks

Agustin
Re: Java Content Assist in a View [message #1003994 is a reply to message #1003614] Tue, 22 January 2013 06:38 Go to previous messageGo to next message
Dani Megert is currently offline Dani Megert
Messages: 3801
Registered: July 2009
Senior Member
On 21.01.2013 19:20, Agustin Muñoz wrote:
> Hi,
>
> I don't know if it is the correct project to post about this. Sorry if
> not.
>
> I'm implementing a plugin consisting on a view, that requires Java
> content assist. The view includes a small window where java code is
> typed and evaluated. Same as the Display view in Debug mode.
> I've searched a lot in the web, but couldn't find any help on this.
>
> Is there any way this can be accomplished?
For example the New Java Class wizard offers this to enter a superclass.
I suggest you take a look at
org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createSuperClassControls(Composite,
int)
<http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/plain/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java>
as an entry point.

Dani
>
> Thanks
>
> Agustin
Re: Java Content Assist in a View [message #1003998 is a reply to message #1003614] Tue, 22 January 2013 06:45 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5257
Registered: July 2009
Senior Member
Hi,

You need to create am ICompilationUnit from your source-file and then
invoke ICompilationUnit.codeComplete()

I've used it in an experiment I did with orion's editor, see
https://github.com/tomsontom/fx-ide/blob/master/at.bestsolution.javafx.ide.jdt/src/at/bestsolution/javafx/ide/jdt/internal/JavaEditor.java

I'm not an expert in the JDT so I might use things completely wrong but
maybe it helps.

Tom

Am 21.01.13 19:20, schrieb Agustin Muñoz:
> Hi,
>
> I don't know if it is the correct project to post about this. Sorry if not.
>
> I'm implementing a plugin consisting on a view, that requires Java
> content assist. The view includes a small window where java code is
> typed and evaluated. Same as the Display view in Debug mode.
> I've searched a lot in the web, but couldn't find any help on this.
>
> Is there any way this can be accomplished?
>
> Thanks
>
> Agustin
Re: Java Content Assist in a View [message #1004051 is a reply to message #1003998] Tue, 22 January 2013 08:56 Go to previous message
Agustin Muñoz
Messages: 2
Registered: January 2013
Junior Member
Thanks for the answers, I'll take a look. My main problem is that my input is an String(containing the code) and not a file and I'm not using editors, but SourceViewer (AFAIK an editor works internally with a SourceViewer) so I guess I will need to do some plumbing here.

Just to you to get a better idea what I'm trying to accomplish, I'm writing a plugin for running JPA queries (JPQL and Criteria). Basically, there is a tab where you can write some Java code using the JPA Criteria API and evaluate it. I want to add content assist for that, so it facilitates the coding.
I'll try to play around ICompilationUnit.

Agustin
Previous Topic:org.eclipse.core.internal.dtree.ObjectNotFoundException ????
Next Topic:Bookmarks Menu and IDE Ctrl-Click Suggestion
Goto Forum:
  


Current Time: Thu Jul 31 01:38:19 EDT 2014

Powered by FUDForum. Page generated in 0.26809 seconds