Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 102435 - Not possible to refresh list of TokenIds.
Not possible to refresh list of TokenIds.
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: Lexer
6.x
All All
: P2 (vote)
: 6.x
Assigned To: issues@editor
issues@editor
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-04-25 09:04 UTC by Jan Jancura
Modified: 2007-05-16 16:15 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Jancura 2007-04-25 09:04:53 UTC
Method LanguageHierarchy.createTokenIds () is called onece only, and there is no
possibility to update list on TokenIds later.
Comment 1 Miloslav Metelka 2007-04-26 21:37:41 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.
Comment 2 Miloslav Metelka 2007-04-26 22:00:16 UTC
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.
Comment 3 Petr Hrebejk 2007-04-27 10:24:55 UTC
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.
Comment 4 Miloslav Metelka 2007-04-27 15:38:44 UTC
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
Comment 5 Miloslav Metelka 2007-04-30 08:42:50 UTC
Finally we have agreed that this is P2. It will not be fixed in branch for M9.
Comment 6 Miloslav Metelka 2007-04-30 09:10:35 UTC
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.
Comment 7 Miloslav Metelka 2007-05-16 16:15:31 UTC
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


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo