Index: org/openide/text/CloneableEditor.java =================================================================== RCS file: /cvs/openide/src/org/openide/text/CloneableEditor.java,v retrieving revision 1.25.4.7 diff -u -r1.25.4.7 CloneableEditor.java --- org/openide/text/CloneableEditor.java 18 Jan 2002 13:39:05 -0000 1.25.4.7 +++ org/openide/text/CloneableEditor.java 3 Apr 2002 06:22:28 -0000 @@ -103,6 +103,12 @@ /** Asociated editor support */ private CloneableEditorSupport support; + + // #20647. More important custom component. + /** Custom editor component, which is used if specified by document + * which implements NbDocument.CustomEditor interface. + * @see NbDocument.CustomEditor#createEditor */ + private Component customComponent; private static final String HELP_ID = "editing.editorwindow"; // !!! NOI18N @@ -237,10 +243,15 @@ if (doc instanceof NbDocument.CustomEditor) { NbDocument.CustomEditor ce = (NbDocument.CustomEditor)doc; - add( - ce.createEditor(pane), - BorderLayout.CENTER - ); + customComponent = ce.createEditor(pane); + + if(customComponent == null) { + throw new IllegalStateException("Document:" + doc // NOI18N + + " implementing NbDocument.CustomEditor may not" // NOI18N + + " return null component"); // NOI18N + } + + add(customComponent, BorderLayout.CENTER); } else { // not custom editor add (new JScrollPane (pane), BorderLayout.CENTER); } @@ -317,7 +328,13 @@ */ public void requestFocus() { super.requestFocus (); - pane.requestFocus (); + + if(customComponent != null + && !SwingUtilities.isDescendingFrom(pane, customComponent)) { + customComponent.requestFocus(); + } else { + pane.requestFocus(); + } } /** @return Preferred size of editor top component */