Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » intercept and modify typed key
intercept and modify typed key [message #246372] Thu, 27 May 2004 12:49
Eclipse UserFriend
hi,
I'm currently working on the following functionality for my editor:
whenever the user presses ")" (or any other character), the closest open
structure ( "([{' ) is closed. eg: when the user presses ")" after the
text "{ xxx; ", a "}" would be inserted.
I first wrote a IVerifyKeyListener, and prepended it to my sourceviewer.
Unfortunately it's not possible to modify the event's char/text
(eventhough the Javadoc of the VerifyEvent claims so. Michael Head was
misled too (several weeks ago)).
Next try: I changed the my Listener to an IVerifyListener. This works in
most cases, but not always: When the cursor is positionned within a
LinkedPosition, no verify-events are raised.
This means, that there are two problems, if I wanted to use Java's
BracketInserter:
- the IVerifyListener is only called after the IVerifyKeyListener. So
the BracketInserter would be called before my Replacement-Inserter.
- even, if I could delay (no idea how) the BracketInserter after the
ReplacementInserter, the ReplacementInserter wouldn't receive any
events, as the LinkedPosition intercepts them all.

So my question: Is there a way of modifying a typed key as early as
possible (in particulary before the BracketInserter).

Another question (slightly related):
I'm having a scheme-like syntax, and the
CompletionProposalAutoActivationCharacters contain the "("-character.
Unfortunately the BracketInserter "eats" this character, and the
autoactivation is never triggered. If I transform the BracketInserter
into an IVerifyListener, this starts working again. Any reasons, why I
shouldn't do that?

Finally: The JavaPairMatcher and BracketInserter are not really
Java-related. It would be nice to have them available for other editors
too (currently I'm mostly copy-pasting. with slight adjustements).
The JavaPairMatcher just needs to be configured with an appropriate
Reader, and the BracketInserter is only dependent on the escape-characters.

thanks,
// florian loitsch
Previous Topic:Save state when application closes
Next Topic:eclipse 3m9: workbench->editors->textfile encoding: Cp1252
Goto Forum:
  


Current Time: Mon Jul 21 20:09:03 EDT 2025

Powered by FUDForum. Page generated in 0.02970 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top