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.
Summary: | Not possible to refresh list of TokenIds. | ||
---|---|---|---|
Product: | editor | Reporter: | Jan Jancura <jjancura> |
Component: | Lexer | Assignee: | issues@editor <issues> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | blaha |
Priority: | P2 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
Jan Jancura
2007-04-25 09:04:53 UTC
I was thinking about it and instead of modification inside Language I would rather leave the Language immutable and make a LanguageHierarchy.refreshLanguage() to recreate a fresh Language instance so the LH.createTokenIds() would be re-called and LH.language() would start to return the fresh Language instance. The classes like LanguageManager and LanguageEmbedding would store LH instead of Language and would call LH.language(). So the usecase would be to change the content returned by LH.createTokenIds() and then call LH.refreshLanguage(). If the target document should be relexed then TokenHierarchyControl.rebuild() may be called. I will also think about the opposite i.e. having Language.refresh() to recall LanguageHierarchy.createTokenIds(). This solution would also have benefits in retaining Language <-> LanguageHierarchy relationship for the whole lifetime of both. On the other hand most of the methods of Language would have to become synchronized but that's of course not a big deal. Sorry this is not a preview stopper. This might or might not impact a demo but it can not stop us from doing the demo. Impact on users is 0. Finally I have chosen Language.refresh() because the first solution could lead to obsolete Language instances which could complicate LanguagePath logic etc. Checking in src/org/netbeans/spi/lexer/LanguageHierarchy.java; /cvs/lexer/src/org/netbeans/spi/lexer/LanguageHierarchy.java,v <-- LanguageHierarchy.java new revision: 1.11; previous revision: 1.10 done RCS file: /cvs/lexer/test/unit/src/org/netbeans/lib/lexer/lang/TestChangingTokenId.java,v done Checking in test/unit/src/org/netbeans/lib/lexer/lang/TestChangingTokenId.java; /cvs/lexer/test/unit/src/org/netbeans/lib/lexer/lang/TestChangingTokenId.java,v <-- TestChangingTokenId.java initial revision: 1.1 done Checking in api/apichanges.xml; /cvs/lexer/api/apichanges.xml,v <-- apichanges.xml new revision: 1.17; previous revision: 1.16 done Checking in src/org/netbeans/api/lexer/Language.java; /cvs/lexer/src/org/netbeans/api/lexer/Language.java,v <-- Language.java new revision: 1.9; previous revision: 1.8 done Checking in nbproject/project.properties; /cvs/lexer/nbproject/project.properties,v <-- project.properties new revision: 1.11; previous revision: 1.10 done RCS file: /cvs/lexer/test/unit/src/org/netbeans/api/lexer/LanguageTest.java,v done Checking in test/unit/src/org/netbeans/api/lexer/LanguageTest.java; /cvs/lexer/test/unit/src/org/netbeans/api/lexer/LanguageTest.java,v <-- LanguageTest.java initial revision: 1.1 Finally we have agreed that this is P2. It will not be fixed in branch for M9. I will modify the fuctionality slightly - instead of Language.refresh() I will move the method into LanguageHierarchy.refreshLanguage() since this is in fact for the SPI providers only. There is an alternative way to the implemented Language.refresh() in using LanguageProvider.firePropertyChange(PROP_LANGUAGE) as pointed out by Vita. Since Hanz uses its own LanguageProvider (he did not start to use the L.refresh() yet) it should be straightforward for him to use the LP.fPC() and we can get rid of the extra added method. Rolling back the original change; please use LanguageProvider.firePropertyChange(PROP_LANGUAGE) instead. Checking in test/unit/src/org/netbeans/lib/lexer/test/simple/SimpleLanguageProvider.java; /cvs/lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/SimpleLanguageProvider.java,v <-- SimpleLanguageProvider.java new revision: 1.11; previous revision: 1.10 done Checking in src/org/netbeans/spi/lexer/LanguageHierarchy.java; /cvs/lexer/src/org/netbeans/spi/lexer/LanguageHierarchy.java,v <-- LanguageHierarchy.java new revision: 1.12; previous revision: 1.11 done Checking in test/unit/src/org/netbeans/lib/lexer/lang/TestChangingTokenId.java; /cvs/lexer/test/unit/src/org/netbeans/lib/lexer/lang/TestChangingTokenId.java,v <-- TestChangingTokenId.java new revision: 1.2; previous revision: 1.1 done Checking in nbproject/project.properties; /cvs/lexer/nbproject/project.properties,v <-- project.properties new revision: 1.12; previous revision: 1.11 done Checking in test/unit/src/org/netbeans/lib/lexer/LanguageManagerTest.java; /cvs/lexer/test/unit/src/org/netbeans/lib/lexer/LanguageManagerTest.java,v <-- LanguageManagerTest.java new revision: 1.9; previous revision: 1.8 done Checking in api/apichanges.xml; /cvs/lexer/api/apichanges.xml,v <-- apichanges.xml new revision: 1.18; previous revision: 1.17 done Checking in src/org/netbeans/api/lexer/Language.java; /cvs/lexer/src/org/netbeans/api/lexer/Language.java,v <-- Language.java new revision: 1.10; previous revision: 1.9 done Checking in test/unit/src/org/netbeans/api/lexer/LanguageTest.java; /cvs/lexer/test/unit/src/org/netbeans/api/lexer/LanguageTest.java,v <-- LanguageTest.java new revision: 1.2; previous revision: 1.1 |