Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4453818

The JTextComponent.cut() copy() paste() stop working in the NetBeans IDE on Merl

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.4.0
    • client-libs
    • beta2
    • x86
    • linux

      The clipboard operations cut, copy and paste work fine in NetBeans IDE on 1.3
      However they stop working when using Merlin JDK 1.4. It seems to be the problem on all platforms.

      First I thought that the JTextComponent.cut() copy() paste() methods change for 1.4 was the problem.

      I thought that either map == null || a == null in the current copy() code:
       
      ActionMap map = getActionMap();
      if (map != null) {
      Action a = map.get("copy");
      if (a != null) {
      a.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "copy"));
      }

      However the actionMap is valid and the three "cut", "copy", "paste" actions appear in it.
      I have checked whether the problem is either in copy() or in paste().
      It seems to be a problem in copy() because the selected text does not appear
      in the system clipboard.
      I have checked the TransferHandler.canAccessSystemClipboard() and it returns true. The result of TransferHandler.getClipboard() seems to be the system clipboard. So the problem must be somewhere in the exportToClipboard() or somewhere else.
      I will further investigate the problem.


      ---------------------------------------------------
      Well as the TransferHandler was introduced in 1.4 I would have to make an extra version of the NetBeans BaseTextUI class for 1.4 where I will create the TransferHandler and install it into JTextComponent.
      Or to have just one version I need to check Class.forName("javax.swing.TransferHandler") and use reflection to install it into JTextComponent in case I'm on 1.4.
      On the other hand the TextUI is a public class and as there is no warning in its javadoc about extending it so I guess there can be few applications using their own UIs (the same way the NB do). If 1.4 should fully support existing applications I think there should be at least some info in javadoc in the respective classes or some kind of workaround for this problem.

      BTW the non-public ClipboardObserver class is still present in the JTextComponent source but with the current solution it's no more used I guess.

      ###@###.### 2001-05-09

            shickeysunw Shannon Hickey (Inactive)
            mmetelka Miloslav Metelka (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: