custom javascript editor throws Exception

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

custom javascript editor throws Exception

difficult
I develop a web project plugin which has a javascript editor,and the editor is implemented as following:

Code:

    EditorKit kit = CloneableEditorSupport.getEditorKit("text/javascript");
    javascriptTextArea.setEditorKit(kit);



When installed in Netbeans 8.1,in the editor,when entering . ,the Netbeans throws exception:

Code:

java.lang.NullPointerException: Passed null to FileOwnerQuery.getOwner(FileObject)
        at org.netbeans.api.project.FileOwnerQuery.getOwner(FileOwnerQuery.java:107)
        at org.netbeans.modules.javascript2.nodejs.editor.NodeJsDataProvider.getDefault(NodeJsDataProvider.java:181)
        at org.netbeans.modules.javascript2.nodejs.editor.model.NodeJsModelInterceptor.getGlobalObjects(NodeJsModelInterceptor.java:70)
        at org.netbeans.modules.javascript2.nodejs.editor.model.NodeJsModelInterceptor.interceptGlobal(NodeJsModelInterceptor.java:64)
        at org.netbeans.modules.javascript2.editor.model.impl.ModelExtender.getExtendingGlobalObjects(ModelExtender.java:137)
        at org.netbeans.modules.javascript2.editor.model.impl.ModelUtils.resolveTypeFromExpression(ModelUtils.java:847)
        at org.netbeans.modules.javascript2.editor.JsCodeCompletion.getCompletionFromExpressionChain(JsCodeCompletion.java:575)
        at org.netbeans.modules.javascript2.editor.JsCodeCompletion.completeObjectProperty(JsCodeCompletion.java:550)
        at org.netbeans.modules.javascript2.editor.JsCodeCompletion.complete(JsCodeCompletion.java:231)
        at org.netbeans.modules.csl.editor.completion.GsfCompletionProvider$JavaCompletionQuery.addCodeCompletionItems(GsfCompletionProvider.java:626)
        at org.netbeans.modules.csl.editor.completion.GsfCompletionProvider$JavaCompletionQuery.resolveCompletion(GsfCompletionProvider.java:613)
        at org.netbeans.modules.csl.editor.completion.GsfCompletionProvider$JavaCompletionQuery.access$400(GsfCompletionProvider.java:250)
        at org.netbeans.modules.csl.editor.completion.GsfCompletionProvider$JavaCompletionQuery$1.run(GsfCompletionProvider.java:336)
        at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:609)
        at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:153)
        at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:137)
        at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:204)
        at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:201)
        at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:176)
        at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:360)
        at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:141)
        at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:88)
        at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:201)
Caused: org.netbeans.modules.parsing.spi.ParseException
        at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:209)
        at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:104)
[catch] at org.netbeans.modules.csl.editor.completion.GsfCompletionProvider$JavaCompletionQuery.query(GsfCompletionProvider.java:345)
        at org.netbeans.spi.editor.completion.support.AsyncCompletionTask.run(AsyncCompletionTask.java:223)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
        at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
        at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
        at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)



while I change the editor implement as following,it looks ok but the prompt message doesn't include my javascript lib!

Code:

FileObject fob = FileUtil.createMemoryFileSystem().getRoot().createData("tmp", "js");
DialogBinding.bindComponentToFile(fob, 0, 0, javascriptTextArea);          



what is the right way to implement the javascipt editor base on Netbeans 8.1 ?




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: custom javascript editor throws Exception

arsi
Hi,
Test this:

        EditorKit kit = MimeLookup.getLookup(mimeType).lookup(EditorKit.class);
        if (kit == null) {
            throw new IllegalArgumentException("No EditorKit for '" + mimeType + "' mimetype.");
        }

        JEditorPane editorPane = new JEditorPane();
        editorPane.setEditorKit(kit);
Arsi



From: Difficult
Sent: Monday, August 07, 2017 5:56PM
To: Dev
Subject: [platform-dev] custom javascript editor throws Exception


I develop a web project plugin which has a javascript editor,and the editor is implemented as following:

Code:

    EditorKit kit = CloneableEditorSupport.getEditorKit("text/javascript");
    javascriptTextArea.setEditorKit(kit);



When installed in Netbeans 8.1,in the editor,when entering . ,the Netbeans throws exception:






 

Loading...