--- /home/cpdev/src/classpath/javax/swing/plaf/basic/BasicTextUI.java	2005-07-15 17:32:40.000000000 +0000
+++ javax/swing/plaf/basic/BasicTextUI.java	2005-06-30 05:35:19.000000000 +0000
@@ -57,9 +57,6 @@
 import javax.swing.SwingUtilities;
 import javax.swing.UIDefaults;
 import javax.swing.UIManager;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import javax.swing.plaf.ActionMapUIResource;
 import javax.swing.plaf.TextUI;
 import javax.swing.plaf.UIResource;
 import javax.swing.text.BadLocationException;
@@ -153,45 +150,6 @@
       
       return ((PlainView) view).modelToView(position, a, bias).getBounds();
     }
-
-    /**
-     * Notification about text insertions. These are forwarded to the
-     * real root view.
-     *
-     * @param ev the DocumentEvent describing the change
-     * @param shape the current allocation of the view's display
-     * @param vf the ViewFactory to use for creating new Views
-     */
-    public void insertUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
-    {
-      view.insertUpdate(ev, shape, vf);
-    }
-
-    /**
-     * Notification about text removals. These are forwarded to the
-     * real root view.
-     *
-     * @param ev the DocumentEvent describing the change
-     * @param shape the current allocation of the view's display
-     * @param vf the ViewFactory to use for creating new Views
-     */
-    public void removeUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
-    {
-      view.removeUpdate(ev, shape, vf);
-    }
-
-    /**
-     * Notification about text changes. These are forwarded to the
-     * real root view.
-     *
-     * @param ev the DocumentEvent describing the change
-     * @param shape the current allocation of the view's display
-     * @param vf the ViewFactory to use for creating new Views
-     */
-    public void changedUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
-    {
-      view.changedUpdate(ev, shape, vf);
-    }
   }
 
   class UpdateHandler implements PropertyChangeListener
@@ -205,67 +163,13 @@
 	}
     }
   }
-
-  /**
-   * Listens for changes on the underlying model and forwards notifications
-   * to the View. This also updates the caret position of the text component.
-   *
-   * TODO: Maybe this should somehow be handled through EditorKits
-   */
-  class DocumentHandler implements DocumentListener
-  {
-    /**
-     * Notification about a document change event.
-     *
-     * @param ev the DocumentEvent describing the change
-     */
-    public void changedUpdate(DocumentEvent ev)
-    {
-      Dimension size = textComponent.getSize();
-      rootView.changedUpdate(ev, new Rectangle(0, 0, size.width, size.height),
-                             BasicTextUI.this);
-    }
-    
-    /**
-     * Notification about a document insert event.
-     *
-     * @param ev the DocumentEvent describing the insertion
-     */
-    public void insertUpdate(DocumentEvent ev)
-    {
-      Dimension size = textComponent.getSize();
-      rootView.insertUpdate(ev, new Rectangle(0, 0, size.width, size.height),
-                            BasicTextUI.this);
-      int caretPos = textComponent.getCaretPosition();
-      if (caretPos >= ev.getOffset())
-        textComponent.setCaretPosition(caretPos + ev.getLength());
-    }
-
-    /**
-     * Notification about a document removal event.
-     *
-     * @param ev the DocumentEvent describing the removal
-     */
-    public void removeUpdate(DocumentEvent ev)
-    {
-      Dimension size = textComponent.getSize();
-      rootView.removeUpdate(ev, new Rectangle(0, 0, size.width, size.height),
-                            BasicTextUI.this);
-      int caretPos = textComponent.getCaretPosition();
-      if (caretPos >= ev.getOffset())
-        textComponent.setCaretPosition(ev.getOffset());
-    }
-  }
-
+  
   static EditorKit kit = new DefaultEditorKit();
 
   RootView rootView = new RootView();
   JTextComponent textComponent;
   UpdateHandler updateHandler = new UpdateHandler();
 
-  /** The DocumentEvent handler. */
-  DocumentHandler documentHandler = new DocumentHandler();
-
   public BasicTextUI()
   {
   }
@@ -345,34 +249,11 @@
   protected void installListeners()
   {
     textComponent.addFocusListener(focuslistener);
-    installDocumentListeners();
-  }
-
-  /**
-   * Installs the document listeners on the textComponent's model.
-   */
-  private void installDocumentListeners()
-  {
-    Document doc = textComponent.getDocument();
-    if (doc != null)
-      doc.addDocumentListener(documentHandler);
   }
 
-  /**
-   * Returns the name of the keymap for this type of TextUI.
-   * 
-   * This is implemented so that the classname of this TextUI
-   * without the package prefix is returned. This way subclasses
-   * don't have to override this method.
-   * 
-   * @return the name of the keymap for this TextUI
-   */
   protected String getKeymapName()
   {
-    String fullClassName = getClass().getName();
-    int index = fullClassName.lastIndexOf('.');
-    String className = fullClassName.substring(index + 1);
-    return className;
+    return "BasicTextUI";
   }
 
   protected Keymap createKeymap()
@@ -381,12 +262,6 @@
     UIDefaults defaults = UIManager.getLookAndFeelDefaults();
     JTextComponent.KeyBinding[] bindings = 
       (JTextComponent.KeyBinding[]) defaults.get(prefix + ".keyBindings");
-    if (bindings == null)
-      {
-        bindings = new JTextComponent.KeyBinding[0];
-        defaults.put(prefix + ".keyBindings", bindings);
-      }
-
     Keymap km = JTextComponent.addKeymap(getKeymapName(), 
                                          JTextComponent.getKeymap(JTextComponent.DEFAULT_KEYMAP));    
     JTextComponent.loadKeymap(km, bindings, textComponent.getActions());
@@ -441,7 +316,7 @@
   ActionMap createActionMap()
   {
     Action[] actions = textComponent.getActions();
-    ActionMap am = new ActionMapUIResource();
+    ActionMap am = new ActionMap();
     for (int i = 0; i < actions.length; ++i)
       {
         String name = (String) actions[i].getValue(Action.NAME);
@@ -491,20 +366,7 @@
 
     return new Dimension((int) w, (int) h);
   }
-
-  /**
-   * Returns the maximum size for text components that use this UI.
-   *
-   * This returns (Integer.MAX_VALUE, Integer.MAX_VALUE).
-   *
-   * @return the maximum size for text components that use this UI
-   */
-  public Dimension getMaximumSize(JComponent c)
-  {
-    // Sun's implementation returns Integer.MAX_VALUE here, so do we.
-    return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
-  }
-
+  
   public final void paint(Graphics g, JComponent c)
   {
     paintSafely(g);
@@ -626,7 +488,6 @@
     Document doc = textComponent.getDocument();
     if (doc == null)
       return;
-    installDocumentListeners();
     Element elem = doc.getDefaultRootElement();
     if (elem == null)
       return;
