Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » creating an editor "scheme" for jVi
creating an editor "scheme" for jVi [message #296561] Sun, 25 December 2005 21:30 Go to next message
Eclipse UserFriend
Originally posted by: errspam.raelity.com

I'd like to port jVi, a vi/vim plugin, to eclipse. jVi has been
available as a JBuilder plugin for several years. I'm new to eclipse and
I haven't used java for some years, so... I'd like some pointer and some
general review/check on direction. I haven't downloaded any eclipse code
(yet).

If there is a better newsgroup/forum to work with for this project,
please let me know.

The ...ui.binding doc it suggests that scheme/keybindings is the way to
go. The jVi swing port uses Keymap so this fits ok. The jVi code is
based on the vim "C" code; jVi does its own parsing of commands, it does
not use specific keybinding to invoke different commands. Well known IDE
actions, eg Ctrl-Space, are still dispatched through keybindings. Also,
vi is modal; when in command mode, almost every key can be part of a
command and must be delivered to jVi. The swing Keymap has
setDefaultAction, is there something similar I can do here with a
binding? (The comment about "...no public API for defining..." leaves me
in doubt)

In org.eclipse.ui_3.1.1.jar's plugin.xml I found some schemes defined,
including emacsAcceleratorConfiguration. The
emacsAcceleratorConfiguration's <key ..../> uses the default context and
dialogAndWindow context My initial thought is that I'd want the context
only for text editors, at least initially. Is there such a context? I
saw textEditorScope in one file, is this the context I'm looking for? It
was in org.eclipse.ui.editors I think, though I didn't see the
definition of the context, I wonder where that is. For both context and
scheme is there a way to get a look at those instantiated and their
parent/child relationship?

jVi will also want to invoke well known commands programatically, eg
undo/redo, I assume that is possible. What's a good way to find out what
the available commands are and what they do.

One part of this project is to port jVi to SWT components, for debug I'd
like to set up a simple program using the SWT text screen. Presumably
I'd have to set up keybindings programatically. This should all be
straightforward?

-ernie
Re: creating an editor "scheme" for jVi [message #296812 is a reply to message #296561] Tue, 03 January 2006 10:12 Go to previous messageGo to next message
Eclipse UserFriend
One resource for keybindings is
http://www.magma.ca/~pollockd/despumate/bindingsHowTo.html

Later,
PW
Re: creating an editor "scheme" for jVi [message #297017 is a reply to message #296561] Fri, 06 January 2006 11:34 Go to previous message
Eclipse UserFriend
Originally posted by: douglas.pollock.magma.ca

First of all, I would love to see a vi key binding scheme for Eclipse. I
simply haven't had the time to sort out the issues. I'd be willing to
accept patches to Eclipse that will make it happen.

Ernie Rael wrote:
> The ...ui.binding doc it suggests that scheme/keybindings is the way to
> go. The jVi swing port uses Keymap so this fits ok. The jVi code is
> based on the vim "C" code; jVi does its own parsing of commands, it does
> not use specific keybinding to invoke different commands. Well known IDE
> actions, eg Ctrl-Space, are still dispatched through keybindings. Also,
> vi is modal; when in command mode, almost every key can be part of a
> command and must be delivered to jVi. The swing Keymap has
> setDefaultAction, is there something similar I can do here with a
> binding? (The comment about "...no public API for defining..." leaves me
> in doubt)

The command mode is tricky, I think. You need to reach out to the binding
service, and disable the key filter. Then attach your own filter. Your
own filter should work like WorkbenchKeyboard (perhaps WorkbenchKeyboard
should be made public so it can be subclassed?) ... but process the keys
more like vi would do in command mode.

IBindingService s = (IBindingService)
workbench.getAdapter(IBindingService.class);
s.setKeyFilterEnabled(false);
display.addFilter(...);

...

display.removeFilter(...);
s.setKeyFilterEnabled(true);


> only for text editors, at least initially. Is there such a context? I
> saw textEditorScope in one file, is this the context I'm looking for? It

Yes, that is the context you are looking for.


> definition of the context, I wonder where that is. For both context and
> scheme is there a way to get a look at those instantiated and their
> parent/child relationship?

In the Keys preference page, you can fiddle around to see the relationship.
Both the scheme and context have an "Extends ..." text that appears if it
is a child.


> jVi will also want to invoke well known commands programatically, eg
> undo/redo, I assume that is possible. What's a good way to find out what
> the available commands are and what they do.

The Keys preference page allows you to see the name. The experimental Keys
preference page in 3.2 M4 allows you to see the name and description. To
figure out the corresponding command id, you're probably best to turn on
some of the org.eclipse.ui tracing options (see
http://www.magma.ca/~pollockd/despumate/bindingsHowTo.html). Once you have
the command id, you can use the ICommandService to get the command and
execute it programmatically.


> One part of this project is to port jVi to SWT components, for debug I'd
> like to set up a simple program using the SWT text screen. Presumably
> I'd have to set up keybindings programatically. This should all be
> straightforward?

I'm not sure what you mean here.



cheers,
d.
Previous Topic:Split Text Editors ?
Next Topic:Enabling and disabling pop-up actions
Goto Forum:
  


Current Time: Fri May 09 03:05:00 EDT 2025

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

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

Back to the top