This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 20647
Collapse All | Expand All

(-)org/openide/text/CloneableEditor.java (-5 / +22 lines)
Lines 103-108 Link Here
103
103
104
    /** Asociated editor support  */
104
    /** Asociated editor support  */
105
    private CloneableEditorSupport support;
105
    private CloneableEditorSupport support;
106
    
107
    // #20647. More important custom component.
108
    /** Custom editor component, which is used if specified by document
109
     * which implements <code>NbDocument.CustomEditor</code> interface.
110
     * @see NbDocument.CustomEditor#createEditor */
111
    private Component customComponent;
106
112
107
113
108
    private static final String HELP_ID = "editing.editorwindow"; // !!! NOI18N
114
    private static final String HELP_ID = "editing.editorwindow"; // !!! NOI18N
Lines 237-246 Link Here
237
        
243
        
238
        if (doc instanceof NbDocument.CustomEditor) {
244
        if (doc instanceof NbDocument.CustomEditor) {
239
            NbDocument.CustomEditor ce = (NbDocument.CustomEditor)doc;
245
            NbDocument.CustomEditor ce = (NbDocument.CustomEditor)doc;
240
            add(
246
            customComponent = ce.createEditor(pane);
241
                ce.createEditor(pane),
247
            
242
                BorderLayout.CENTER
248
            if(customComponent == null) {
243
            );
249
                throw new IllegalStateException("Document:" + doc // NOI18N
250
                    + " implementing NbDocument.CustomEditor may not" // NOI18N
251
                    + " return null component"); // NOI18N
252
            }
253
            
254
            add(customComponent, BorderLayout.CENTER);
244
        } else { // not custom editor
255
        } else { // not custom editor
245
            add (new JScrollPane (pane), BorderLayout.CENTER);
256
            add (new JScrollPane (pane), BorderLayout.CENTER);
246
        }
257
        }
Lines 317-323 Link Here
317
     */
328
     */
318
    public void requestFocus() {
329
    public void requestFocus() {
319
        super.requestFocus ();
330
        super.requestFocus ();
320
        pane.requestFocus ();
331
332
        if(customComponent != null
333
        && !SwingUtilities.isDescendingFrom(pane, customComponent)) {
334
            customComponent.requestFocus();
335
        } else {
336
            pane.requestFocus();
337
        }
321
    }
338
    }
322
339
323
    /** @return Preferred size of editor top component  */
340
    /** @return Preferred size of editor top component  */

Return to bug 20647