KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > jemacs > buffer > SelfInsertCommand


1 // Copyright (c) 2002 Per M.A. Bothner.
2
// This is free software; for terms and warranty disclaimer see ./COPYING.
3

4 package gnu.jemacs.buffer;
5 import gnu.math.IntNum;
6 import gnu.mapping.*;
7
8 public class SelfInsertCommand extends Procedure0or1
9 {
10   public Object JavaDoc getProperty (Object JavaDoc key, Object JavaDoc defaultValue)
11   {
12     if (key == "emacs-interactive")
13       return "*p";
14     return super.getProperty(key, defaultValue);
15   }
16
17   public Object JavaDoc apply0 ()
18   {
19     apply1 (IntNum.one());
20     return Values.empty;
21   }
22
23
24   public Object JavaDoc apply1 (Object JavaDoc arg1)
25   {
26     int count = ((Number JavaDoc) arg1).intValue();
27     EWindow window = EWindow.getSelected();
28     Buffer buffer = window.buffer;
29
30     char ch = (char) window.pendingKeys[window.pendingLength];
31     buffer.insert(ch, count);
32     return Values.empty;
33   }
34 }
35
Popular Tags