This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 150373 - ParserManager listeners always returns State.OK
Summary: ParserManager listeners always returns State.OK
Status: RESOLVED INCOMPLETE
Alias: None
Product: obsolete
Classification: Unclassified
Component: languages (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker with 1 vote (vote)
Assignee: issues@obsolete
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-16 13:14 UTC by scanti
Modified: 2008-12-04 13:04 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Patch (untested) should reverse the code (2.37 KB, text/plain)
2008-10-16 13:49 UTC, scanti
Details

Note You need to log in before you can comment on or make changes to this bug.
Description scanti 2008-10-16 13:14:04 UTC
My company used to use Schliemann in our RCP base on NetBeans 6.0.  I added an ParserManagerListener to the
parserManager  to prevent switching to another panel if the ParserManager was still parsing. However, when my company
switched to 6.1 I have noticed ParserManagerListener does not notify when the state becomes State.PARSING. This is
because in the fire2() method of the org.netbeans.modules.languages.ParserManagerImpl class, the firing of the listeners
is located after this check: " if (state == State.PARSING) return;". 

This is very important to me, because I have to work with the tokens generated by the parser.
Moreover, it would be wonderful, if there were methods in the ParserManager interface to know if there are any parsing
errors. 
Something like getSyntaxErrors() in ParseManagerImpl

Thanks for your help!
Comment 1 scanti 2008-10-16 13:49:24 UTC
Created attachment 71970 [details]
Patch (untested) should reverse the code
Comment 2 Jan Jancura 2008-10-16 14:24:19 UTC
Use ParserManager.hasSyntaxError () (in NetBeans 6.5), please.
Comment 3 scanti 2008-10-16 14:33:08 UTC
Thanks a lot for the quick answer, but it only answers to the first part of the question. 
How do I know when it has finished parsing?
Sorry I must use 6.1 because my company uses it.
Comment 4 Jan Jancura 2008-10-16 16:15:12 UTC
Yes, we are not firing parsing state, and we do not want to fire it. Doing such change is dangerous, because other
clients can fail in this case. I do not understand why you need to know, when parser starts. Why do you want to prevent
switching to other panel? You should not depend on such event! This use case is just not supported.
Comment 5 scanti 2008-10-16 16:56:06 UTC
The reason I need to know when the parser is parsing is this:
I was asked to use Schliemann to define our company language and then to build an Object model around it (like jaxb or
schema2Beans). By using the Object model  I can modify Schliemann tokens.
For instance:

ASTNode node = ...
MyObject obj = new MyObject(node);
obj.setVariance(6.0);
....
....
//(switch to textual view)
editorPane.setText(obj.toString);


I have a sort of MultiView application. When the user switch from the textual view to the gui view I take  the AST from
the textual view, I wrap it with my Object model and then I use the Object model in the gui panels. 
If The AST is not updated when the Object Model will contain un-updated data as well 

If you do not revert back the code we'll have to use a patched version of the module, or find some weird workaround.
if I add my patch to the module, does it break anythig?

thank you a lot and sorry for the nuisance