Not yet, no. I recommend you look at other examples e.g., in the NetBeans source code in GitHub.
Gj On Sat, 1 Feb 2020 at 12:27, Bilu <albi...@gmail.com> wrote: > none of this works, first example was quit similar. did you reproduce the > problem or not? > Le 01/02/2020 à 10:01, Geertjan Wielenga a écrit : > > https://github.com/search?q=SyntaxErrorHighlightingTask&type=Code > > Gj > > On Sat, Feb 1, 2020 at 12:48 AM Bilu Al <albi...@gmail.com> wrote: > >> >> https://vimsky.com/zh-tw/examples/detail/java-method-org.netbeans.spi.editor.hints.ErrorDescriptionFactory.createErrorDescription.html >> >> There must be some issue change in the API >> >> Le ven. 31 janv. 2020 à 22:43, Geertjan Wielenga <geert...@apache.org> a >> écrit : >> >>> Which other implementations did you check? Maybe you should go >>> furthermore. >>> >>> Gj >>> >>> On Fri, Jan 31, 2020 at 8:47 PM Bilu <albi...@gmail.com> wrote: >>> >>>> from my debug the issue seems to comes from the >>>> SJSyntaxErrorHighlightingTask class. i check already a little other >>>> implementations and they are quite similar but i failed to go >>>> futhermore. >>>> >>>> waiting for your feedback, thanks you very much >>>> Le 31/01/2020 à 20:25, Geertjan Wielenga a écrit : >>>> >>>> I would look for other implementations of that class on GitHub and >>>> elsewhere to see how others have done it. >>>> >>>> Gj >>>> >>>> >>>> On Fri, 31 Jan 2020 at 20:18, Bilu <albi...@gmail.com> wrote: >>>> >>>>> Sorry you right i skipped this step a bit: >>>>> >>>>> What i do is: >>>>> >>>>> 5.a- change: public static class SJParserResult extends Result { >>>>> => public static class SJParserResult extends >>>>> org.netbeans.modules.csl.spi.ParserResult { >>>>> >>>>> 5.b- org.netbeans.modules.csl.spi.ParserResult require module: >>>>> Common Scripting Language Types. Add it >>>>> >>>>> 5.c- Add: >>>>> >>>>> import java.util.List; >>>>> >>>>> import org.netbeans.modules.csl.api.Error; >>>>> >>>>> 5.d- Add abstract method : >>>>> >>>>> @Override >>>>> public List<? extends Error> getDiagnostics() { >>>>> return null; >>>>> >>>>> //throw new UnsupportedOperationException("Not supported >>>>> yet."); //To change body of generated methods, choose Tools | Templates. >>>>> } >>>>> >>>>> >>>>> The SJParser now looks like this: >>>>> >>>>> package org.simplejava.parser; >>>>> >>>>> import java.io.Reader; >>>>> import java.io.StringReader; >>>>> import java.util.List; >>>>> import java.util.logging.Level; >>>>> import java.util.logging.Logger; >>>>> import javax.swing.event.ChangeListener; >>>>> import org.netbeans.modules.csl.api.Error; >>>>> import org.netbeans.modules.parsing.api.Snapshot; >>>>> import org.netbeans.modules.parsing.api.Task; >>>>> import org.netbeans.modules.parsing.spi.Parser; >>>>> import org.netbeans.modules.parsing.spi.Parser.Result; >>>>> import org.netbeans.modules.parsing.spi.SourceModificationEvent; >>>>> import org.simplejava.jccparser.JavaParser; >>>>> >>>>> public class SJParser extends Parser { >>>>> >>>>> private Snapshot snapshot; >>>>> private JavaParser javaParser; >>>>> >>>>> @Override >>>>> public void parse(Snapshot snapshot, Task task, >>>>> SourceModificationEvent event) { >>>>> this.snapshot = snapshot; >>>>> Reader reader = new >>>>> StringReader(snapshot.getText().toString()); >>>>> javaParser = new JavaParser(reader); >>>>> try { >>>>> javaParser.CompilationUnit(); >>>>> } catch (org.simplejava.jccparser.ParseException ex) { >>>>> >>>>> Logger.getLogger(SJParser.class.getName()).log(Level.WARNING, null, ex); >>>>> } >>>>> } >>>>> >>>>> @Override >>>>> public Result getResult(Task task) { >>>>> return new SJParserResult(snapshot, javaParser); >>>>> } >>>>> >>>>> @Override >>>>> public void cancel() { >>>>> } >>>>> >>>>> @Override >>>>> public void addChangeListener(ChangeListener changeListener) { >>>>> } >>>>> >>>>> @Override >>>>> public void removeChangeListener(ChangeListener changeListener) { >>>>> } >>>>> >>>>> public static class SJParserResult extends >>>>> org.netbeans.modules.csl.spi.ParserResult { >>>>> >>>>> private JavaParser javaParser; >>>>> private boolean valid = true; >>>>> >>>>> SJParserResult(Snapshot snapshot, JavaParser javaParser) { >>>>> super(snapshot); >>>>> this.javaParser = javaParser; >>>>> } >>>>> >>>>> public JavaParser getJavaParser() throws >>>>> org.netbeans.modules.parsing.spi.ParseException { >>>>> if (!valid) { >>>>> throw new >>>>> org.netbeans.modules.parsing.spi.ParseException(); >>>>> } >>>>> return javaParser; >>>>> } >>>>> >>>>> @Override >>>>> protected void invalidate() { >>>>> valid = false; >>>>> } >>>>> >>>>> @Override >>>>> public List<? extends Error> getDiagnostics() { >>>>> return null; >>>>> >>>>> //throw new UnsupportedOperationException("Not >>>>> supported yet."); //To change body of generated methods, choose Tools | >>>>> Templates. >>>>> } >>>>> >>>>> } >>>>> >>>>> } >>>>> >>>>> >>>>> Le 31/01/2020 à 19:56, Geertjan Wielenga a écrit : >>>>> >>>>> What does this mean, exactly: >>>>> >>>>> "update SJParserResult class to extend o.n.m.csl.spi.ParserResult >>>>> instead of o.n.m.parsing.spi.Parser.Result" >>>>> >>>>> I'm not going ton try to guess, since you have done the above, would >>>>> be best if you'd explain how you made the above change -- it's not a >>>>> simple question of changing import statements. >>>>> >>>>> Gj >>>>> >>>>> On Fri, Jan 31, 2020 at 7:07 PM Bilu Al <albi...@gmail.com> wrote: >>>>> >>>>>> Complete step is available in this tutorial: >>>>>> https://platform.netbeans.org/tutorials/nbm-javacc-parser.html >>>>>> >>>>>> You can also get the complete source code of the tutorial to avoid >>>>>> all the steps: >>>>>> https://github.com/vparfonov/api-samples/tree/master/nb-api-samples~api-samples/versions/7.2/tutorials/SimpleJava2 >>>>>> >>>>>> >>>>>> 1. Open Project SimpleJava2 >>>>>> 2. You should miss File Template dependency. Add it >>>>>> 3. Run SimpleJava2 project >>>>>> 4. open a SJ file (sample.sj) containing a java like source code >>>>>> => Exception occur (java.lang.ClassCastException:) >>>>>> 5. update SJParserResult class to extend >>>>>> o.n.m.csl.spi.ParserResult instead of o.n.m.parsing.spi.Parser.Result >>>>>> like >>>>>> suggest here >>>>>> https://bz.apache.org/netbeans/show_bug.cgi?id=167064 >>>>>> 6. Rerun the Project, you should get now >>>>>> java.lang.NullPointerException >>>>>> >>>>>> >>>>>> Env is: >>>>>> Product Version: Apache NetBeans IDE 11.1 >>>>>> Updates: NetBeans IDE is updated to version NetBeans 8.2 Patch 2 >>>>>> Java: 1.8.0_181; Java HotSpot(TM) 64-Bit Server VM 25.181-b13 >>>>>> Runtime: Java(TM) SE Runtime Environment 1.8.0_181-b13 >>>>>> System: Windows 10 version 10.0 running on amd64; Cp1252; en_US (nb) >>>>>> User directory: C:\Users\xxxx\AppData\Roaming\NetBeans\11.1 >>>>>> Cache directory: C:\Users\xxxx\AppData\Local\NetBeans\Cache\11.1 >>>>>> >>>>>> Thanks >>>>>> >>>>>> >>>>>> >>>>>> Le ven. 31 janv. 2020 à 18:37, Geertjan Wielenga <geert...@apache.org> >>>>>> a écrit : >>>>>> > >>>>>> > Complete environment and precise steps to take to reproduce the >>>>>> problem. >>>>>> > >>>>>> > Gj >>>>>> > >>>>>> > On Fri, Jan 31, 2020 at 6:35 PM Bilu Al <albi...@gmail.com> wrote: >>>>>> >> >>>>>> >> Any advice hear please? >>>>>> >> >>>>>> >> >>>>>> >> Le jeu. 30 janv. 2020 à 16:53, Bilu Al <albi...@gmail.com> a >>>>>> écrit : >>>>>> >> > >>>>>> >> > Hello, >>>>>> >> > >>>>>> >> > Can somebody tell if this tutorial still up to date: >>>>>> https://platform.netbeans.org/tutorials/nbm-javacc-parser.html with >>>>>> Apache NetBeans IDE 11.1 platform? >>>>>> >> > >>>>>> >> > I am facing an issue when implementing this in my module >>>>>> >> > >>>>>> >> > I have the same issue with the complete tutorial source code : >>>>>> https://github.com/vparfonov/api-samples/tree/master/nb-api-samples~api-samples/versions/7.2/tutorials/SimpleJava2 >>>>>> >> > >>>>>> >> > i am getting this exception: >>>>>> >> > >>>>>> >> > java.lang.ClassCastException: >>>>>> org.simplejava.parser.SJParser$SJParserResult cannot be cast to >>>>>> org.netbeans.modules.csl.spi.ParserResult >>>>>> >> > at >>>>>> org.netbeans.modules.csl.hints.infrastructure.SuggestionsTask.run(SuggestionsTask.java:54) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.impl.TaskProcessor.callParserResultTask(TaskProcessor.java:561) >>>>>> >> > [catch] at >>>>>> org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:786) >>>>>> >> > at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663) >>>>>> >> > at >>>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) >>>>>> >> > at java.util.concurrent.FutureTask.run(FutureTask.java:266) >>>>>> >> > at >>>>>> org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418) >>>>>> >> > at >>>>>> org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45) >>>>>> >> > at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278) >>>>>> >> > at >>>>>> org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033) >>>>>> >> > >>>>>> >> > I follow the fix here: >>>>>> https://bz.apache.org/netbeans/show_bug.cgi?id=167064 about the >>>>>> previous exception and now i am getting this indefinitely : >>>>>> >> > >>>>>> >> > java.lang.NullPointerException >>>>>> >> > at >>>>>> org.netbeans.modules.csl.hints.GsfHintsProvider.computeErrors(GsfHintsProvider.java:114) >>>>>> >> > at >>>>>> org.netbeans.modules.csl.hints.GsfHintsProvider.processErrors(GsfHintsProvider.java:388) >>>>>> >> > at >>>>>> org.netbeans.modules.csl.hints.GsfHintsProvider.processErrorsRecursive(GsfHintsProvider.java:359) >>>>>> >> > at >>>>>> org.netbeans.modules.csl.hints.GsfHintsProvider.refreshErrors(GsfHintsProvider.java:327) >>>>>> >> > at >>>>>> org.netbeans.modules.csl.hints.GsfHintsProvider.access$200(GsfHintsProvider.java:79) >>>>>> >> > at >>>>>> org.netbeans.modules.csl.hints.GsfHintsProvider$2.run(GsfHintsProvider.java:407) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:586) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:130) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:114) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:181) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:178) >>>>>> >> > at >>>>>> org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153) >>>>>> >> > at >>>>>> org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:178) >>>>>> >> > Caused: org.netbeans.modules.parsing.spi.ParseException >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:186) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:81) >>>>>> >> > [catch] at >>>>>> org.netbeans.modules.csl.hints.GsfHintsProvider.run(GsfHintsProvider.java:405) >>>>>> >> > at >>>>>> org.netbeans.modules.csl.hints.GsfHintsProvider.run(GsfHintsProvider.java:79) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.impl.TaskProcessor.callParserResultTask(TaskProcessor.java:561) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:786) >>>>>> >> > at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702) >>>>>> >> > at >>>>>> org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663) >>>>>> >> > at >>>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) >>>>>> >> > at java.util.concurrent.FutureTask.run(FutureTask.java:266) >>>>>> >> > at >>>>>> org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418) >>>>>> >> > at >>>>>> org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45) >>>>>> >> > at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278) >>>>>> >> > at >>>>>> org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033) >>>>>> >> > >>>>>> >> > Thanks you >>>>>> >> >>>>>> >> >>>>>> --------------------------------------------------------------------- >>>>>> >> To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org >>>>>> >> For additional commands, e-mail: users-h...@netbeans.apache.org >>>>>> >> >>>>>> >> For further information about the NetBeans mailing lists, visit: >>>>>> >> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists >>>>>> >> >>>>>> >>>>>