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

(-)a/openide.text/src/org/openide/text/CloneableEditorSupport.java (+10 lines)
Lines 905-910 Link Here
905
905
906
        return null;
906
        return null;
907
    }
907
    }
908
909
    @Override
910
    protected void redirectedOpen(CloneableOpenSupport redirectedTo) {
911
        super.redirectedOpen(redirectedTo);
912
        // synchronize last selected field for correct getRecentPane query
913
        if (redirectedTo instanceof CloneableEditorSupport) {
914
            CloneableEditorSupport other = ((CloneableEditorSupport)redirectedTo);
915
            this.lastSelected = other.lastSelected;
916
        }
917
    }
908
    
918
    
909
    /** Returns the lastly selected Pane or null
919
    /** Returns the lastly selected Pane or null
910
     */
920
     */
(-)a/openide.windows/src/org/openide/windows/CloneableOpenSupport.java (+24 lines)
Lines 97-102 Link Here
97
        CloneableOpenSupport redirect = CloneableOpenSupportRedirector.findRedirect(this);
97
        CloneableOpenSupport redirect = CloneableOpenSupportRedirector.findRedirect(this);
98
        if (redirect != null) {
98
        if (redirect != null) {
99
            redirect.open();
99
            redirect.open();
100
            redirectedOpenImpl(redirect);
100
            return;
101
            return;
101
        }
102
        }
102
        //Bugfix #10688 open() is now run in AWT thread
103
        //Bugfix #10688 open() is now run in AWT thread
Lines 246-251 Link Here
246
    */
247
    */
247
    protected abstract String messageOpened();
248
    protected abstract String messageOpened();
248
249
250
    private void redirectedOpenImpl(CloneableOpenSupport redirectedTo) {
251
        // there is a common patern in user code:
252
        // CloneableEditorSupport ces = ...;
253
        // ces.edit();
254
        // JEditorPane[] panes = ces.getOpenedPanes();
255
        // if (panes != null) panes[0].setPosition(offset);
256
        // in case when redirection has happened during edit() call
257
        // 'ces' instance returns null for getOpenedPanes
258
        // but we want panes to be available for 'ces' instance after redirection;
259
        // remember editors from redirected instance to have correct opened panes
260
        // for this instance as well
261
        this.allEditors = redirectedTo.allEditors;
262
//        this.env = redirect.env;
263
        redirectedOpen(redirectedTo);
264
    }
265
    
266
    /**
267
     * notify that other redirected cos was opened instead of this one.
268
     * @param redirectedTo redirected instance which was opened instead of this one
269
     */
270
    protected void redirectedOpen(CloneableOpenSupport redirectedTo) {
271
    }
272
249
    /** Abstract interface that is used by CloneableOpenSupport to
273
    /** Abstract interface that is used by CloneableOpenSupport to
250
    * talk to outside world.
274
    * talk to outside world.
251
    */
275
    */

Return to bug 241991