Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[wtp-dev] JavaScript editing in a SourceViewer within a dialog

Title: _javascript_ editing in a SourceViewer within a dialog

Im dealing with an issue regarding editing of _javascript_ within a dialog.  I have a dialog up and running with an embedded JavaSourceViewer with a _javascript_ configuration setup.

I have syntax highlighting, but cannot get the content assist to work.

Ive looked at the code for EditTemplateDialog and DetailFormatterDialog with no luck.

Do I need access to a JavaProject or CompilationUnit?  If so, how might I do this? 

I do not have an IEditorPart to work with, obviously since in a dialog.  Below is my code for trying to setup content assist for the _javascript_SourceViewConfiguration.  However, I get a JavaNoTypeCompletionProposalComputer error when trying it outIm assuming due to not having an IEditorPart passed into the JavaCompletionProcessor constructor.

public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

ContentAssistant assistant= new ContentAssistant();


      assistant.setRestoreCompletionProposalSize(getSettings("completion_proposal_size")); //$NON-NLS-1$

      IContentAssistProcessor javaProcessor= new JavaCompletionProcessor(getEditor(), assistant, IDocument.DEFAULT_CONTENT_TYPE);

      assistant.setContentAssistProcessor(javaProcessor, IDocument.DEFAULT_CONTENT_TYPE);

      ContentAssistProcessor singleLineProcessor= new JavaCompletionProcessor(getEditor(), assistant, IJavaScriptPartitions.JAVA_SINGLE_LINE_COMMENT);

      assistant.setContentAssistProcessor(singleLineProcessor, IJavaScriptPartitions.JAVA_SINGLE_LINE_COMMENT);

      ContentAssistProcessor stringProcessor= new JavaCompletionProcessor(getEditor(), assistant, IJavaScriptPartitions.JAVA_STRING);

      assistant.setContentAssistProcessor(stringProcessor, IJavaScriptPartitions.JAVA_STRING);


      ContentAssistProcessor multiLineProcessor= new JavaCompletionProcessor(getEditor(), assistant, IJavaScriptPartitions.JAVA_MULTI_LINE_COMMENT);

      assistant.setContentAssistProcessor(multiLineProcessor, IJavaScriptPartitions.JAVA_MULTI_LINE_COMMENT);

      ContentAssistProcessor javadocProcessor= new JavadocCompletionProcessor(getEditor(), assistant);

      assistant.setContentAssistProcessor(javadocProcessor, IJavaScriptPartitions.JAVA_DOC);

      ContentAssistPreference.configure(assistant, fPreferenceStore);




      return assistant;


Is there some other Eclipse code I should be looking at for an example?

Is this the right forum to post such questions?

I’m using Eclipse: 3.4.1 M20080911-1700

I’ve installed WTP 3.0.5

I know Im using an older version of Eclipse and WTP, but Im currently stuck at this level and could use any sort of advice.

Thanks in advance

The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.

Back to the top