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

(-)openide/loaders/src/org/openide/text/EditorSupport.java (-1 / +24 lines)
Lines 47-53 Link Here
47
* @deprecated Use DataEditorSupport instead
47
* @deprecated Use DataEditorSupport instead
48
*/
48
*/
49
public class EditorSupport extends OpenSupport
49
public class EditorSupport extends OpenSupport
50
implements EditorCookie.Observable, OpenCookie, CloseCookie, PrintCookie {
50
implements EditorCookie.Observable, OpenCookie, CloseCookie, PrintCookie
51
// <>
52
// So that we can obtain the undoredo for the Java editor top components
53
           , org.openide.cookies.UndoRedoCookie
54
// </>
55
 {
51
    /** Common name for editor mode.
56
    /** Common name for editor mode.
52
     * @deprecated Use {@link org.openide.text.CloneableEditorSupport#EDITOR_MODE} instead.
57
     * @deprecated Use {@link org.openide.text.CloneableEditorSupport#EDITOR_MODE} instead.
53
     */
58
     */
Lines 436-441 Link Here
436
        del.superNotifyClosed ();
441
        del.superNotifyClosed ();
437
    }
442
    }
438
443
444
    // <>
445
    // Useful for test suite 
446
    // XXX #5055050 and now also in project exit dialog. 
447
    public void closeDocumentPublic() {
448
        del.closeDocumentPublic();
449
    }
450
    // </>
451
439
    
452
    
440
    /** Utility method to extract EditorSupport from Del instance.
453
    /** Utility method to extract EditorSupport from Del instance.
441
     * @param ces cloneable editor support
454
     * @param ces cloneable editor support
Lines 940-943 Link Here
940
            return o;
953
            return o;
941
        }
954
        }
942
    }
955
    }
956
957
958
// <>
959
// So that we can obtain the undoredo for the Java editor top components
960
     // ------- implements UndoRedoCookie
961
     public UndoRedo getUndoRedoI() {
962
         return del.getUndoRedoI();
963
     }
964
// </>
965
943
}
966
}
(-)openide/src/org/openide/cookies/UndoRedoCookie.java (+34 lines)
Line 0 Link Here
1
/*
2
 *                 Sun Public License Notice
3
 * 
4
 * The contents of this file are subject to the Sun Public License
5
 * Version 1.0 (the "License"). You may not use this file except in
6
 * compliance with the License. A copy of the License is available at
7
 * http://www.sun.com/
8
 * 
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
13
14
package org.openide.cookies;
15
16
import org.openide.awt.UndoRedo;
17
import org.openide.nodes.Node;
18
19
/** Cookie for obtaining the UndoRedo
20
*
21
* @author Tor Norbye
22
* @since 
23
*/
24
public interface UndoRedoCookie extends Node.Cookie {
25
26
    /** Return the undo redo object */
27
    public UndoRedo getUndoRedoI();
28
    // This was named getUndoRedoI instead of the preferrable
29
    // getUndoRedo because some objects that needed to implement
30
    // this interface, notably ClonableEditorSupport, already had
31
    // a conflicting method named getUndoRedo. I then tried calling
32
    // it getUndoRedoManager, and ran into another conflict in the
33
    // properties module. So hopefully this new name will be unique enough.
34
}
(-)openide/src/org/openide/text/CloneableEditorSupport.java (-1 / +13 lines)
Lines 76-82 Link Here
76
*
76
*
77
* @author Jaroslav Tulach
77
* @author Jaroslav Tulach
78
*/
78
*/
79
public abstract class CloneableEditorSupport extends CloneableOpenSupport {
79
public abstract class CloneableEditorSupport extends CloneableOpenSupport 
80
// <>
81
// So that we can obtain the undoredo for the editor top components
82
      implements org.openide.cookies.UndoRedoCookie
83
// </>
84
{
80
    
85
    
81
    /** Common name for editor mode. */
86
    /** Common name for editor mode. */
82
    public static final String EDITOR_MODE = "editor"; // NOI18N
87
    public static final String EDITOR_MODE = "editor"; // NOI18N
Lines 266-271 Link Here
266
        return kit;
271
        return kit;
267
    }
272
    }
268
273
274
// <>
275
// So that we can obtain the undoredo for the Java editor top components
276
     // ------- implements UndoRedoCookie
277
     public UndoRedo getUndoRedoI() {
278
        return getUndoRedo();
279
     }
280
// </>
269
281
270
    /**
282
    /**
271
     * Gets the undo redo manager.
283
     * Gets the undo redo manager.
(-)core/src/org/netbeans/core/NbSheet.java (+28 lines)
Lines 552-555 Link Here
552
595
553
    } // End of SheetNodesListener.
596
    } // End of SheetNodesListener.
554
597
598
// <>
599
// Need to get UndoRedo also from Property sheet.
600
// Trying to find UndoRedo from the nodes lookup.
601
    public org.openide.awt.UndoRedo getUndoRedo() {
602
        Node[] ns = nodes;
603
        
604
        if(ns != null) {
605
            for(int i = 0; i < ns.length; i++) {
606
                Node n = ns[i];
607
                if(n == null) {
608
                    continue;
609
                }
610
                org.openide.cookies.UndoRedoCookie urc =
611
                    (org.openide.cookies.UndoRedoCookie)n.getLookup().
612
                    lookup(org.openide.cookies.UndoRedoCookie.class);
613
                org.openide.awt.UndoRedo undoRedo = null;
614
                if (urc != null) {
615
                    undoRedo = urc.getUndoRedoI();
616
                    if(undoRedo != null) {
617
                        return undoRedo;
618
                    }
619
                }
620
            }
621
        }
622
        
623
        return super.getUndoRedo();
624
    }
625
// </>
555
}
626
}

Return to bug 53452