Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » RCP + JavaSriptEditor
RCP + JavaSriptEditor [message #883451] Fri, 08 June 2012 15:06 Go to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Hello,

i use the CompliationEditorUnit in a MultiPageEditorPart, but the content assist for JavaScript doesn't work. The highlighting works fine. The statusline message is "No completions available". What is wrong? What i have to do?
public class MyMulitPage extends MultiPageEditorPart
  
    @Override
    protected void createPages()
        {
        try
            {
            addPage(new CompilationUnitEditor(), getEditorInput());
            }
        catch (PartInitException e)
            {
            // TODO Auto-generated catch block
            e.printStackTrace();
            }

        }


Thanks

[Updated on: Fri, 08 June 2012 15:07]

Report message to a moderator

Re: RCP + JavaSriptEditor [message #884537 is a reply to message #883451] Mon, 11 June 2012 09:39 Go to previous message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
I'm one step further:
If i use a IFile and FileEditorInput all works fine
    private IFile createFile()
        {
        IWorkspace workspace = ResourcesPlugin.getWorkspace();
        IWorkspaceRoot root = workspace.getRoot();
        IProject project = root.getProject("test");
        IFolder folder = project.getFolder("src");
        IFile file = folder.getFile("test.js");
        // at this point, no resources have been created
        try
            {
            if (!project.exists())
                project.create(null);
            if (!project.isOpen())
                project.open(null);
            if (!folder.exists())
                folder.create(IResource.NONE, true, null);
            if (!file.exists())
                {
                byte[] bytes = "".getBytes();
                InputStream source = new ByteArrayInputStream(bytes);
                file.create(source, IResource.NONE, null);
                }
            return file;
            }
        catch (Exception e)
            {
            e.printStackTrace();
            }
        return null;
        }

  private IEditorInput createFileEditorInput()
        {
        return new FileEditorInput(createFile());
        }


but if i use a FileStoreEditorInput and a temp File, it doesn't work:
    private IEditorInput createFileStoreEditorInput()
        {
        return new FileStoreEditorInput(createFileStore());
        }

    private IFileStore createFileStore()
        {
        File file = null;
        try
            {
            file = File.createTempFile("test", ".js");
            file.deleteOnExit();
            }
        catch (IOException e1)
            {
            // TODO Auto-generated catch block
            e1.printStackTrace();
            }

        try
            {
            return EFS.getStore(file.toURI());
            }
        catch (CoreException e)
            {
            // TODO Auto-generated catch block
            e.printStackTrace();
            }
        return null;
        }


When i open the AutoCompletion (CTRL+Space), i'll get a out of bounds exception

!ENTRY org.eclipse.wst.jsdt.ui 4 10001 2012-06-11 11:33:41.854
!MESSAGE Internal Error
!STACK 1
JavaScript Model Exception: JavaScript Model Status [Index out of bounds]
	at org.eclipse.wst.jsdt.internal.core.Openable.codeComplete(Openable.java:125)
	at org.eclipse.wst.jsdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:305)
	at org.eclipse.wst.jsdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:298)
	at org.eclipse.wst.jsdt.ui.text.java.JavaContentAssistInvocationContext.computeKeywordsAndContext(JavaContentAssistInvocationContext.java:290)
	at org.eclipse.wst.jsdt.ui.text.java.JavaContentAssistInvocationContext.getKeywordProposals(JavaContentAssistInvocationContext.java:125)
	at org.eclipse.wst.jsdt.internal.ui.text.java.TemplateCompletionProposalComputer.computeCompletionProposals(TemplateCompletionProposalComputer.java:96)
	at org.eclipse.wst.jsdt.internal.ui.text.java.CompletionProposalComputerDescriptor.computeCompletionProposals(CompletionProposalComputerDescriptor.java:298)
	at org.eclipse.wst.jsdt.internal.ui.text.java.CompletionProposalCategory.computeCompletionProposals(CompletionProposalCategory.java:258)
	at org.eclipse.wst.jsdt.internal.ui.text.java.ContentAssistProcessor.collectProposals(ContentAssistProcessor.java:244)
	at org.eclipse.wst.jsdt.internal.ui.text.java.ContentAssistProcessor.computeCompletionProposals(ContentAssistProcessor.java:213)
	at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1830)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:556)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:553)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:488)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:482)
	at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1656)
	at org.eclipse.wst.jsdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:168)
	at org.eclipse.ui.texteditor.ContentAssistAction$1.run(ContentAssistAction.java:82)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.texteditor.ContentAssistAction.run(ContentAssistAction.java:80)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185)
!SUBENTRY 1 org.eclipse.wst.jsdt.core 4 980 2012-06-11 11:33:41.855
!MESSAGE Index out of bounds
Previous Topic:How to trigger the "Print" action of a Browser?
Next Topic:Use actionSets or extensions of menus, commands
Goto Forum:
  


Current Time: Tue Sep 24 17:46:02 GMT 2024

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

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

Back to the top