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 53439
Collapse All | Expand All

(-)openide/src/org/openide/text/CloneableEditor.java (+31 lines)
Lines 202-207 Link Here
202
        pane.setEditorKit (support.kit ());
208
        pane.setEditorKit (support.kit ());
203
209
204
        pane.setDocument (doc);
210
        pane.setDocument (doc);
211
// <> NB #53439 Temporary put back (to fix a bug),
212
// when is figured out another method to hack this (at least from editor module).
213
// Originally modified by Tor: install drag & drop handlers on the editor
214
        // In order to minimaze the impact on NB code (two large classes added), this service (see bottom),
215
        // was declared.
216
        DnDSupportFactory factory = (DnDSupportFactory)org.openide.util.Lookup.getDefault().lookup(DnDSupportFactory.class);
217
        if(factory != null) {
218
            pane.setTransferHandler(factory.createCloneableEditorPaneTransferHandler());
219
            java.awt.dnd.DropTarget dropTarget = pane.getDropTarget();
220
            if (dropTarget != null) {
221
                java.awt.dnd.DropTargetListener dropTargetListener = factory.createCloneableEditorPaneDropTargetListener();
222
                try {
223
                    dropTarget.addDropTargetListener(dropTargetListener);
224
                } catch(java.util.TooManyListenersException tmle) {
225
                    ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, tmle);
226
                }
227
            }
228
        }
229
// </>
205
        if (doc instanceof NbDocument.CustomEditor) {
230
        if (doc instanceof NbDocument.CustomEditor) {
206
            NbDocument.CustomEditor ce = (NbDocument.CustomEditor)doc;
231
            NbDocument.CustomEditor ce = (NbDocument.CustomEditor)doc;
207
            customComponent = ce.createEditor(pane);
232
            customComponent = ce.createEditor(pane);
Lines 640-643 Link Here
640
        requestVisible();
665
        requestVisible();
641
    }
666
    }
642
    
667
    
668
// <> NB #53439 See also above.
669
// Hacks the code, in order to minimaze the changed code, to be able to better
670
// depict the needed change.
671
    public interface DnDSupportFactory {
672
        /** Creates <code>TransferHandler</code> instance which will be used 
673
         in <code>CloneableEditor.pane</code> component. On 1 per 1 basis. */
674
        public javax.swing.TransferHandler createCloneableEditorPaneTransferHandler();
675
        /** Creates <code>DropTargetListener</code> instance which will be used
676
         in <code>CloneableEditor.Pane</code> component. On 1 per 1 basis. */
677
        public java.awt.dnd.DropTargetListener createCloneableEditorPaneDropTargetListener();
678
    }
679
// </>
643
}
680
}

Return to bug 53439