I'm 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.

I've 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
JavaScriptSourceViewConfiguration.  However, I get a
JavaNoTypeCompletionProposalComputer error when trying it out...I'm
assuming due to not having an IEditorPart passed into the
JavaCompletionProcessor constructor.

public IContentAssistant getContentAssistant(ISourceViewer sourceViewer)
{
ContentAssistant assistant= new ContentAssistant();
 
assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sour
ceViewer));

 
assistant.setRestoreCompletionProposalSize(getSettings("completion_propo
sal_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);

 
assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEX
T_INFO_ABOVE);
 
assistant.setInformationControlCreator(getInformationControlCreator(sour
ceViewer));
                
      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 I'm using an older version of Eclipse and WTP, but I'm 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.

_______________________________________________
wtp-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/wtp-dev

Reply via email to