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 94365

Summary: Ability to remove previously created custom embedding
Product: editor Reporter: Miloslav Metelka <mmetelka>
Component: LexerAssignee: issues@editor <issues>
Status: RESOLVED FIXED    
Severity: blocker CC: mfukala
Priority: P2 Keywords: API
Version: 6.x   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description Miloslav Metelka 2007-02-05 13:01:53 UTC
There appear to be usecases that a custom embedding created by
TokenSequence.createEmbedding() will also need to be removed explicitly under
certain situations.
For example for script tags in html if a specification of the default embedded
language will change then a parser should removed the old embeddings and create
new ones.
So the API should be like
TokenSequence.removeEmbedding(LanguagePath)
Comment 1 Miloslav Metelka 2007-09-02 23:31:19 UTC
Will be implemented in 6.0.
Comment 2 Miloslav Metelka 2007-09-02 23:32:24 UTC
*** Issue 99395 has been marked as a duplicate of this issue. ***
Comment 3 Miloslav Metelka 2007-09-11 09:46:52 UTC
Marku, I'm trying to sort out things that are not strictly needed for 6.0 and this is one of the candidates. Can this be
waived for 6.0?
Comment 4 Marek Fukala 2007-09-11 10:02:05 UTC
I think we can live without this. It also depends on the behaviour of the infrastructure - when it relexes the embedded
tokens based on change of the higher level language. For example having this:

<a onclick="jupiii()"/>

I create the javascript embedding on the jupiii() part. Then if user changes the name of the attribute or somehow
invalidates the tag the embedding should be removed. This can be done either by me (I'll diff the previous and new set
of embeddings and create/remove the diff) or by the infrastructure. In the second case it can probably work just in some
simple cases.
Comment 5 Miloslav Metelka 2007-10-05 14:41:44 UTC
/cvs/lexer/api/apichanges.xml,v  <--  apichanges.xml
new revision: 1.23; previous revision: 1.22
done
Checking in src/org/netbeans/lib/lexer/EmbeddingContainer.java;
/cvs/lexer/src/org/netbeans/lib/lexer/EmbeddingContainer.java,v  <--  EmbeddingContainer.java
new revision: 1.18; previous revision: 1.17
done
Checking in src/org/netbeans/lib/lexer/TokenSequenceList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/TokenSequenceList.java,v  <--  TokenSequenceList.java
new revision: 1.6; previous revision: 1.5
done
Checking in src/org/netbeans/lib/lexer/TokenHierarchyUpdate.java;
/cvs/lexer/src/org/netbeans/lib/lexer/TokenHierarchyUpdate.java,v  <--  TokenHierarchyUpdate.java
new revision: 1.8; previous revision: 1.7
done
Checking in nbproject/project.properties;
/cvs/lexer/nbproject/project.properties,v  <--  project.properties
new revision: 1.17; previous revision: 1.16
done
Checking in src/org/netbeans/api/lexer/TokenSequence.java;
/cvs/lexer/src/org/netbeans/api/lexer/TokenSequence.java,v  <--  TokenSequence.java
new revision: 1.19; previous revision: 1.18
done
Checking in src/org/netbeans/api/lexer/TokenHierarchyEventType.java;
/cvs/lexer/src/org/netbeans/api/lexer/TokenHierarchyEventType.java,v  <--  TokenHierarchyEventType.java
new revision: 1.4; previous revision: 1.3
done
Checking in src/org/netbeans/lib/lexer/inc/MutableTokenList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/inc/MutableTokenList.java,v  <--  MutableTokenList.java
new revision: 1.7; previous revision: 1.6
done
Checking in test/unit/src/org/netbeans/lib/lexer/test/simple/CustomEmbeddingTest.java;
/cvs/lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/CustomEmbeddingTest.java,v  <--  CustomEmbeddingTest.java
new revision: 1.5; previous revision: 1.4

However I need to further improve the current token hierarchy's version increasing so that the token sequences scanning
the embedding being removed would be invalidated while the token sequence on which the removeEmbedding() is being called
would still be functional. I'll fix it and close the issue then.
Comment 6 Miloslav Metelka 2007-10-10 13:51:55 UTC
Additional fix invalidating the obsolete token seqences of removed embeddings.
Checking in src/org/netbeans/lib/lexer/EmbeddedTokenList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/EmbeddedTokenList.java,v  <--  EmbeddedTokenList.java
new revision: 1.18; previous revision: 1.17
done
Checking in src/org/netbeans/lib/lexer/EmbeddingContainer.java;
/cvs/lexer/src/org/netbeans/lib/lexer/EmbeddingContainer.java,v  <--  EmbeddingContainer.java
new revision: 1.20; previous revision: 1.19
done
Checking in test/unit/src/org/netbeans/lib/lexer/test/simple/CustomEmbeddingTest.java;
/cvs/lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/CustomEmbeddingTest.java,v  <--  CustomEmbeddingTest.java
new revision: 1.6; previous revision: 1.5
done
Checking in src/org/netbeans/api/lexer/TokenSequence.java;
/cvs/lexer/src/org/netbeans/api/lexer/TokenSequence.java,v  <--  TokenSequence.java
new revision: 1.20; previous revision: 1.19