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

(-)build.xml (-20 lines)
Lines 104-129 Link Here
104
                <!-- make following member public -->
104
                <!-- make following member public -->
105
                <member name="getCookieSet" />
105
                <member name="getCookieSet" />
106
            </patch>
106
            </patch>
107
	    <patch class="org/openide/loaders/MultiDataObject" > 
108
                <!-- make following members public -->
109
                <member name="getCookieSet" />
110
                <member name="setCookieSet" />
111
            </patch>
112
	    <patch class="org/openide/explorer/view/BeanTreeView" > 
107
	    <patch class="org/openide/explorer/view/BeanTreeView" > 
113
                <member name="selectionChanged" />
108
                <member name="selectionChanged" />
114
            </patch>
109
            </patch>
115
110
116
            <!-- superclass changed in order to implement MouseInputListener -->
117
            <patch class="org/openide/awt/Toolbar" super="org/openide/awt/$$Toolbar$$Patch$$">
118
                <member name="BASIC_HEIGHT" /> <!-- made non-final -->
119
            </patch>
120
            <patch class="org/openide/awt/Toolbar$$DnDEvent" >
121
                <!-- make fields public -->
122
                <member name="name" />
123
                <member name="dx" />
124
                <member name="dy" />
125
                <member name="type" />
126
            </patch>
127
111
128
            <!-- superclass needs to provide refershRoot method with different signature than the one in AbstractFileSystem -->                        
112
            <!-- superclass needs to provide refershRoot method with different signature than the one in AbstractFileSystem -->                        
129
	    <patch class="org/openide/filesystems/AbstractFileSystem" > 
113
	    <patch class="org/openide/filesystems/AbstractFileSystem" > 
Lines 176-185 Link Here
176
            
160
            
177
            <!-- no super change, just be public -->
161
            <!-- no super change, just be public -->
178
	    <patch class="org/openide/explorer/propertysheet/SetDefaultValueAction"  /> 
162
	    <patch class="org/openide/explorer/propertysheet/SetDefaultValueAction"  /> 
179
	    <patch class="org/openide/loaders/DataLoaderPool$$FolderLoader"  /> 
180
	    <patch class="org/openide/loaders/DataLoaderPool$$InstanceLoader"  /> 
181
	    <patch class="org/openide/loaders/DataLoaderPool$$DefaultLoader"  /> 
182
	    <patch class="org/openide/loaders/DataLoaderPool$$ShadowLoader"  /> 
183
163
184
    </enhanceclass>
164
    </enhanceclass>
185
  </target>
165
  </target>
Lines 376-381 Link Here
376
             	  <include name="org/openide/util/datatransfer/*"/>
356
             	  <include name="org/openide/util/datatransfer/*"/>
377
                  <include name="org/openide/util/actions/*"/>
357
                  <include name="org/openide/util/actions/*"/>
378
                  <include name="org/openide/xml/"/>
358
                  <include name="org/openide/xml/"/>
379
359
380
                  <!-- XXX review distribution of JPopupMenuPlus, JPopupMenuUtils, etc. -->
360
                  <!-- XXX review distribution of JPopupMenuPlus, JPopupMenuUtils, etc. -->
381
                  <include name="org/openide/awt/JPopupMenu*class" />
361
                  <include name="org/openide/awt/JPopupMenu*class" />
(-)src/org/openide/actions/SaveAction.java (-1 / +4 lines)
Lines 19-25 Link Here
19
import org.openide.ErrorManager;
19
import org.openide.ErrorManager;
20
import org.openide.util.HelpCtx;
20
import org.openide.util.HelpCtx;
21
import org.openide.util.actions.CookieAction;
21
import org.openide.util.actions.CookieAction;
22
import org.openide.loaders.DataObject;
23
import org.openide.nodes.Node;
22
import org.openide.nodes.Node;
24
import org.openide.cookies.SaveCookie;
23
import org.openide.cookies.SaveCookie;
25
import org.openide.util.NbBundle;
24
import org.openide.util.NbBundle;
Lines 73-78 Link Here
73
     * @return name that should be printed to the user.
72
     * @return name that should be printed to the user.
74
     */
73
     */
75
    private String getSaveMessage(Node n) {
74
    private String getSaveMessage(Node n) {
75
        /* PENDING-JST: Do we really need this to get the message?
76
         *
76
        DataObject d = (DataObject)n.getCookie(DataObject.class);
77
        DataObject d = (DataObject)n.getCookie(DataObject.class);
77
        if (d != null) {
78
        if (d != null) {
78
            Node n2 = d.getNodeDelegate();
79
            Node n2 = d.getNodeDelegate();
Lines 80-85 Link Here
80
                return n2.getDisplayName();
81
                return n2.getDisplayName();
81
            }
82
            }
82
        }
83
        }
84
         */
85
        
83
        return n.getDisplayName();
86
        return n.getDisplayName();
84
    }
87
    }
85
88
(-)src/org/openide/explorer/ExplorerActions.java (-4 / +8 lines)
Lines 38-45 Link Here
38
import org.openide.filesystems.FileStateInvalidException;
38
import org.openide.filesystems.FileStateInvalidException;
39
import org.openide.filesystems.FileSystem;
39
import org.openide.filesystems.FileSystem;
40
import org.openide.filesystems.Repository;
40
import org.openide.filesystems.Repository;
41
import org.openide.loaders.DataObject;
42
import org.openide.loaders.DataShadow;
43
41
44
import org.openide.util.actions.ActionPerformer;
42
import org.openide.util.actions.ActionPerformer;
45
import org.openide.nodes.Node;
43
import org.openide.nodes.Node;
Lines 624-629 Link Here
624
        private boolean doConfirm(Node[] sel) {
622
        private boolean doConfirm(Node[] sel) {
625
            String message, title;
623
            String message, title;
626
            if (sel.length == 1) {
624
            if (sel.length == 1) {
625
                /* PENDING-JST: What to do with these special cases!?
626
                 *
627
                if (sel[0].getCookie(DataShadow.class) != null) {
627
                if (sel[0].getCookie(DataShadow.class) != null) {
628
                    title = NbBundle.getMessage(ExplorerActions.class, "MSG_ConfirmDeleteShadowTitle");
628
                    title = NbBundle.getMessage(ExplorerActions.class, "MSG_ConfirmDeleteShadowTitle");
629
                    DataShadow obj = (DataShadow)sel[0].getCookie(DataShadow.class);
629
                    DataShadow obj = (DataShadow)sel[0].getCookie(DataShadow.class);
Lines 638-644 Link Here
638
                    message = NbBundle.getMessage(ExplorerActions.class, "MSG_ConfirmDeleteFolder",
638
                    message = NbBundle.getMessage(ExplorerActions.class, "MSG_ConfirmDeleteFolder",
639
                    sel[0].getDisplayName());
639
                    sel[0].getDisplayName());
640
                    title = NbBundle.getMessage(ExplorerActions.class, "MSG_ConfirmDeleteFolderTitle");
640
                    title = NbBundle.getMessage(ExplorerActions.class, "MSG_ConfirmDeleteFolderTitle");
641
                } else {
641
                } else
642
                 */
643
                {
642
                    message = NbBundle.getMessage(ExplorerActions.class, "MSG_ConfirmDeleteObject",
644
                    message = NbBundle.getMessage(ExplorerActions.class, "MSG_ConfirmDeleteObject",
643
                    sel[0].getDisplayName());
645
                    sel[0].getDisplayName());
644
                    title = NbBundle.getMessage(ExplorerActions.class, "MSG_ConfirmDeleteObjectTitle");
646
                    title = NbBundle.getMessage(ExplorerActions.class, "MSG_ConfirmDeleteObjectTitle");
Lines 652-658 Link Here
652
            NotifyDescriptor desc = new NotifyDescriptor.Confirmation(message, title, NotifyDescriptor.YES_NO_OPTION);
654
            NotifyDescriptor desc = new NotifyDescriptor.Confirmation(message, title, NotifyDescriptor.YES_NO_OPTION);
653
            return NotifyDescriptor.YES_OPTION.equals(DialogDisplayer.getDefault().notify(desc));
655
            return NotifyDescriptor.YES_OPTION.equals(DialogDisplayer.getDefault().notify(desc));
654
        }
656
        }
655
        private String fullName(DataObject obj) {
657
        /* 
658
        private String fullName(org.openide.loaders.DataObject obj) {
656
            FileObject f = obj.getPrimaryFile();
659
            FileObject f = obj.getPrimaryFile();
657
            if (f.isRoot()) {
660
            if (f.isRoot()) {
658
                try {
661
                try {
Lines 664-669 Link Here
664
                return f.toString();
667
                return f.toString();
665
            }
668
            }
666
        }
669
        }
670
        */
667
        
671
        
668
        private void doDestroy(final Node[] sel) {
672
        private void doDestroy(final Node[] sel) {
669
            try {
673
            try {
(-)src/org/openide/filesystems/AbstractFileSystem.java (-2 / +4 lines)
Lines 191-198 Link Here
191
        } else {
191
        } else {
192
            if (SYSTEM_ACTIONS == null) {
192
            if (SYSTEM_ACTIONS == null) {
193
                try {
193
                try {
194
                    Class c = Class.forName ("org.openide.filesystems.RefreshAction"); // NOI18N
194
                    ClassLoader l = (ClassLoader)org.openide.util.Lookup.getDefault().lookup (ClassLoader.class);
195
                    RefreshAction ra = (RefreshAction) SharedClassObject.findObject (c, true);
195
                    if (l == null) l = getClass ().getClassLoader();
196
                    Class c = Class.forName ("org.openide.actions.FileSystemRefreshAction", true, l); // NOI18N
197
                    SystemAction ra = (SystemAction) SharedClassObject.findObject (c, true);
196
                    // initialize the SYSTEM_ACTIONS
198
                    // initialize the SYSTEM_ACTIONS
197
                    SYSTEM_ACTIONS = new SystemAction[] { ra };
199
                    SYSTEM_ACTIONS = new SystemAction[] { ra };
198
                } catch (Exception ex) {
200
                } catch (Exception ex) {
(-)src/org/openide/nodes/TMUtil.java (-4 / +11 lines)
Lines 224-234 Link Here
224
    static final class Help implements Runnable {
224
    static final class Help implements Runnable {
225
        public void run () {
225
        public void run () {
226
            BeanNode node = (BeanNode)TALK.get ();
226
            BeanNode node = (BeanNode)TALK.get ();
227
            HelpCtx h = org.openide.loaders.InstanceSupport.findHelp (
227
            org.openide.cookies.InstanceCookie ic = (org.openide.cookies.InstanceCookie) node.getCookie (
228
                (org.openide.cookies.InstanceCookie) node.getCookie (
228
                org.openide.cookies.InstanceCookie.class
229
                    org.openide.cookies.InstanceCookie.class
230
                )
231
            );
229
            );
230
            HelpCtx h = null;
231
            try {
232
                Object inst = ic.instanceCreate();
233
                h = HelpCtx.findHelp (inst);
234
            } catch (java.io.IOException ex) {
235
                // ignore
236
            } catch (ClassNotFoundException ex) {
237
                // ignore
238
            }
232
            TALK.set (h);
239
            TALK.set (h);
233
        }
240
        }
234
    }
241
    }
(-)src/org/openide/text/CloneableEditor.java (-8 / +25 lines)
Lines 27-36 Link Here
27
import javax.swing.text.*;
27
import javax.swing.text.*;
28
28
29
import org.openide.awt.UndoRedo;
29
import org.openide.awt.UndoRedo;
30
import org.openide.actions.FileSystemAction;
31
import org.openide.ErrorManager;
30
import org.openide.ErrorManager;
32
import org.openide.cookies.EditorCookie;
31
import org.openide.cookies.EditorCookie;
33
import org.openide.loaders.*;
34
import org.openide.windows.*;
32
import org.openide.windows.*;
35
import org.openide.util.Task;
33
import org.openide.util.Task;
36
import org.openide.util.TaskListener;
34
import org.openide.util.TaskListener;
Lines 102-108 Link Here
102
     * @return context help
100
     * @return context help
103
     */
101
     */
104
    public HelpCtx getHelpCtx() {
102
    public HelpCtx getHelpCtx() {
105
        HelpCtx fromKit = InstanceSupport.findHelp (new InstanceSupport.Instance (support.kit ()));
103
        HelpCtx fromKit = HelpCtx.findHelp (support.kit ());
106
        if (fromKit != null)
104
        if (fromKit != null)
107
            return fromKit;
105
            return fromKit;
108
        else
106
        else
Lines 304-313 Link Here
304
302
305
    public SystemAction[] getSystemActions() {
303
    public SystemAction[] getSystemActions() {
306
        SystemAction[] sa = super.getSystemActions ();
304
        SystemAction[] sa = super.getSystemActions ();
305
        
306
        try {
307
            ClassLoader l = (ClassLoader)org.openide.util.Lookup.getDefault().lookup (ClassLoader.class);
308
            if (l == null) l = getClass ().getClassLoader();
309
            Class c = Class.forName ("org.openide.actions.FileSystemAction", true, l); // NOI18N
310
            SystemAction ra = (SystemAction) SystemAction.findObject (c, true);
311
            // initialize the SYSTEM_ACTIONS
312
            
313
            sa = SystemAction.linkActions (sa, new SystemAction[] { null, ra });
314
        } catch (Exception ex) {
315
            // ok, we no action like this I guess
316
        }
307
317
308
        return SystemAction.linkActions (sa, 
318
        return sa;
309
            new SystemAction[] { null, SystemAction.get(FileSystemAction.class) }
310
        );
311
    }
319
    }
312
320
313
    /** Transfer the focus to the editor pane.
321
    /** Transfer the focus to the editor pane.
Lines 445-451 Link Here
445
        int offset;
453
        int offset;
446
454
447
        Object firstObject = in.readObject ();
455
        Object firstObject = in.readObject ();
456
448
        
457
        
458
        /* Getting rid of backward compatibility - this style of serialization 
459
           was used in 3.3, so it is simpler to not support it anymore, especially
460
           when we do not have access to EditorSupport and DataObject
461
         
449
        if (firstObject instanceof DataObject) {
462
        if (firstObject instanceof DataObject) {
450
            // backward compatibility
463
            // backward compatibility
451
464
Lines 465-479 Link Here
465
			support = supp.del;
478
			support = supp.del;
466
		}
479
		}
467
	    }
480
	    }
468
        } else {
481
        } else */
482
        {
469
            // New deserialization that uses Env environment,
483
            // New deserialization that uses Env environment,
470
            // and which could be null(!) see writeExternal.
484
            // and which could be null(!) see writeExternal.
471
            if(firstObject instanceof CloneableOpenSupport.Env) {
485
            if(firstObject instanceof CloneableOpenSupport.Env) {
472
                CloneableOpenSupport.Env env = (CloneableOpenSupport.Env)firstObject;
486
                CloneableOpenSupport.Env env = (CloneableOpenSupport.Env)firstObject;
473
                CloneableOpenSupport os = env.findCloneableOpenSupport ();
487
                CloneableOpenSupport os = env.findCloneableOpenSupport ();
488
                
489
                /* PENDING-JST: What to do with EditorSupport? Maybe EditorSupport.getLookup (),lookup (CloneableEditorSupport.class)?
490
                 * 
474
                if (os instanceof EditorSupport) {
491
                if (os instanceof EditorSupport) {
475
                    support = ((EditorSupport)os).del;
492
                    support = ((EditorSupport)os).del;
476
                } else {
493
                } else */{
477
                    support = (CloneableEditorSupport)os;
494
                    support = (CloneableEditorSupport)os;
478
                }
495
                }
479
            }
496
            }
(-)src/org/openide/text/CloneableEditorSupport.java (-4 / +3 lines)
Lines 48-54 Link Here
48
import org.openide.awt.StatusDisplayer;
48
import org.openide.awt.StatusDisplayer;
49
import org.openide.cookies.EditorCookie;
49
import org.openide.cookies.EditorCookie;
50
import org.openide.filesystems.*;
50
import org.openide.filesystems.*;
51
import org.openide.loaders.*;
52
import org.openide.windows.*;
51
import org.openide.windows.*;
53
import org.openide.util.Task;
52
import org.openide.util.Task;
54
import org.openide.util.TaskListener;
53
import org.openide.util.TaskListener;
Lines 1059-1069 Link Here
1059
    }
1058
    }
1060
    
1059
    
1061
1060
1062
    /** Getter for data object associated with this 
1061
    /** Getter for context associated with this 
1063
    * data object.
1062
    * data object.
1064
    */
1063
    */
1065
    DataObject getDataObjectHack () {
1064
    org.openide.util.Lookup getDataObjectHack () {
1066
        return null;
1065
        return org.openide.util.Lookup.EMPTY;
1067
    }
1066
    }
1068
1067
1069
1068
(-)src/org/openide/text/DocumentLine.java (-3 / +4 lines)
Lines 20-26 Link Here
20
import javax.swing.SwingUtilities;
20
import javax.swing.SwingUtilities;
21
21
22
import org.openide.ErrorManager;
22
import org.openide.ErrorManager;
23
import org.openide.loaders.DataObject;
24
import org.openide.util.WeakListener;
23
import org.openide.util.WeakListener;
25
import org.openide.text.EnhancedChangeEvent;
24
import org.openide.text.EnhancedChangeEvent;
26
25
Lines 64-73 Link Here
64
    
63
    
65
    static final long serialVersionUID =3213776466939427487L;
64
    static final long serialVersionUID =3213776466939427487L;
66
    /** Constructor.
65
    /** Constructor.
67
    * @param obj data object we belong to
66
    * @param obj context we belong to
68
    * @param pos position on the line
67
    * @param pos position on the line
68
     *
69
     * PENDING-JST: Incompatible change of argument (maybe duplicated constructor to accept java.lang.Object as well?)
69
    */
70
    */
70
    public DocumentLine (DataObject obj, PositionRef pos) {
71
    public DocumentLine (org.openide.util.Lookup obj, PositionRef pos) {
71
        super (obj);
72
        super (obj);
72
        this.pos = pos;
73
        this.pos = pos;
73
    }
74
    }
(-)src/org/openide/text/EditorSupportLineSet.java (-3 / +3 lines)
Lines 19-25 Link Here
19
import javax.swing.text.StyledDocument;
19
import javax.swing.text.StyledDocument;
20
import javax.swing.text.Position;
20
import javax.swing.text.Position;
21
21
22
import org.openide.loaders.*;
23
import org.openide.util.WeakListener;
22
import org.openide.util.WeakListener;
24
23
25
/** Line set for an EditorSupport.
24
/** Line set for an EditorSupport.
Lines 52-57 Link Here
52
        PositionRef ref = new PositionRef(
51
        PositionRef ref = new PositionRef(
53
                              support.getPositionManager (), offset, Position.Bias.Forward
52
                              support.getPositionManager (), offset, Position.Bias.Forward
54
                          );
53
                          );
54
        // PENDING-JST: Support shall provide some kind of context
55
        return new SupportLine (support.getDataObjectHack (), ref, support);
55
        return new SupportLine (support.getDataObjectHack (), ref, support);
56
    }
56
    }
57
57
Lines 62-68 Link Here
62
        static final long serialVersionUID =7282223299866986051L;
62
        static final long serialVersionUID =7282223299866986051L;
63
        /** Position reference to a place in document
63
        /** Position reference to a place in document
64
        */
64
        */
65
        public SupportLine (DataObject obj, PositionRef ref, CloneableEditorSupport support) {
65
        public SupportLine (org.openide.util.Lookup obj, PositionRef ref, CloneableEditorSupport support) {
66
            super (obj, ref);
66
            super (obj, ref);
67
        }
67
        }
68
68
Lines 155-161 Link Here
155
            PositionRef ref = new PositionRef (support.getPositionManager (), line, 0, Position.Bias.Forward);
155
            PositionRef ref = new PositionRef (support.getPositionManager (), line, 0, Position.Bias.Forward);
156
156
157
            // obj can be null, sorry...
157
            // obj can be null, sorry...
158
            DataObject obj = support.getDataObjectHack ();
158
            org.openide.util.Lookup obj = support.getDataObjectHack ();
159
            
159
            
160
            return this.registerLine(new SupportLine(obj, ref, support));
160
            return this.registerLine(new SupportLine(obj, ref, support));
161
        }
161
        }
(-)src/org/openide/text/Line.java (-9 / +24 lines)
Lines 19-25 Link Here
19
import java.util.Date;
19
import java.util.Date;
20
import java.util.WeakHashMap;
20
import java.util.WeakHashMap;
21
21
22
import org.openide.loaders.DataObject;
23
import org.openide.util.NbBundle;
22
import org.openide.util.NbBundle;
24
23
25
/** Represents one line in a text document.
24
/** Represents one line in a text document.
Lines 36-53 Link Here
36
    /** Property name of the line number */
35
    /** Property name of the line number */
37
    public static final String PROP_LINE_NUMBER = "lineNumber"; // NOI18N
36
    public static final String PROP_LINE_NUMBER = "lineNumber"; // NOI18N
38
37
39
    /** DataObject that is parent of the line */
38
    /** context of this line */
40
    private DataObject dataObject;
39
    private org.openide.util.Lookup dataObject;
41
40
42
    /**
41
    /*
43
     * Create a new line object based on a given data object.
42
     * Create a new line object based on a given data object.
44
     * This implementation is abstract, so the specific line number is not used here. Subclasses should somehow specify the position.
43
     * This implementation is abstract, so the specific line number is not used here. Subclasses should somehow specify the position.
45
     * @param obj the data object this line is a part of
44
     * @param obj the data object this line is a part of
46
     */
45
     *
47
    public Line(DataObject obj) {
46
     * PENDING-JST: Incompatible change - replaced with Object constructor
47
    public Line(org.openide.loaders.DataObject obj) {
48
        super();
48
        super();
49
        dataObject = obj;
49
        dataObject = obj;
50
    }
50
    }
51
     */
52
    /**
53
     * Create a new line object based on a given data object.
54
     * This implementation is abstract, so the specific line number is not used here. Subclasses should somehow specify the position.
55
     * @param context the context for this line
56
     */
57
    public Line(org.openide.util.Lookup obj) {
58
        dataObject = obj;
59
    }
51
60
52
    /** Shows the line only if the editor is open.
61
    /** Shows the line only if the editor is open.
53
     * @see #show(int) <code>show</code>
62
     * @see #show(int) <code>show</code>
Lines 74-95 Link Here
74
    * @return human presentable name that should identify the line
83
    * @return human presentable name that should identify the line
75
    */
84
    */
76
    public String getDisplayName () {
85
    public String getDisplayName () {
77
    	if (getDataObject() == null)
86
        // PENDING-JST: Do not know how to compute this one
87
        
88
//    	if (getDataObject() == null)
78
    	    return getClass().getName() + ":" + getLineNumber(); // NOI18N
89
    	    return getClass().getName() + ":" + getLineNumber(); // NOI18N
90
/*            
79
        return NbBundle.getMessage(Line.class, "FMT_LineDisplayName",
91
        return NbBundle.getMessage(Line.class, "FMT_LineDisplayName",
80
    		getDataObject ().getName (),
92
    		getDataObject ().getName (),
81
                getDataObject ().getPrimaryFile ().getPath(),
93
                getDataObject ().getPrimaryFile ().getPath(),
82
                new Integer (getLineNumber () + 1) );
94
                new Integer (getLineNumber () + 1) );
95
*/
83
    }
96
    }
84
97
85
98
86
    /**
99
    /**
87
     * Get the data object this line is a part of.
100
     * Get the data object this line is a part of.
88
    * @return data object. May be null.
101
    * @return data object. May be null.
89
    */
102
    *
90
    public final DataObject getDataObject () {
103
     * PENDING-JST: Incompatible change
104
    public final org.openide.loaders.DataObject getDataObject () {
91
        return dataObject;
105
        return dataObject;
92
    }
106
    }
107
     */
93
108
94
109
95
    /** Get the line number. The last condition in following should
110
    /** Get the line number. The last condition in following should
(-)src/org/openide/text/PositionRef.java (-4 / +11 lines)
Lines 21-27 Link Here
21
import javax.swing.text.StyledDocument;
21
import javax.swing.text.StyledDocument;
22
import javax.swing.text.BadLocationException;
22
import javax.swing.text.BadLocationException;
23
23
24
import org.openide.loaders.DataObject;
25
import org.openide.util.RequestProcessor;
24
import org.openide.util.RequestProcessor;
26
25
27
26
Lines 111-121 Link Here
111
    * @exception ClassCastException if the position is attached to CloneableEditorSupport
110
    * @exception ClassCastException if the position is attached to CloneableEditorSupport
112
    *    that is not subclass of EditorSupport
111
    *    that is not subclass of EditorSupport
113
    * @deprecated Please use {@link #getCloneableEditorSupport} instead.
112
    * @deprecated Please use {@link #getCloneableEditorSupport} instead.
114
    */
113
    *
114
     *
115
     * // PENDING-JST: Incompatible change
116
     *
115
    public EditorSupport getEditorSupport () {
117
    public EditorSupport getEditorSupport () {
116
        return EditorSupport.extract (getCloneableEditorSupport ());
118
        return EditorSupport.extract (getCloneableEditorSupport ());
117
    }
119
    }
118
120
    */
121
    
119
    /** @return the bias of the position
122
    /** @return the bias of the position
120
    */
123
    */
121
    public Position.Bias getPositionBias() {
124
    public Position.Bias getPositionBias() {
Lines 209-218 Link Here
209
        private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException {
212
        private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException {
210
            Object firstObject = in.readObject();
213
            Object firstObject = in.readObject();
211
214
215
            /* Get rid of backward compatibility
216
             
212
            if (firstObject instanceof DataObject) {
217
            if (firstObject instanceof DataObject) {
213
                DataObject obj = (DataObject)firstObject;
218
                DataObject obj = (DataObject)firstObject;
214
                support = (CloneableEditorSupport) obj.getCookie(CloneableEditorSupport.class);
219
                support = (CloneableEditorSupport) obj.getCookie(CloneableEditorSupport.class);
215
            } else {
220
            } else */
221
            
222
            {
216
                // first object is environment
223
                // first object is environment
217
                CloneableEditorSupport.Env env = (CloneableEditorSupport.Env)firstObject;
224
                CloneableEditorSupport.Env env = (CloneableEditorSupport.Env)firstObject;
218
                support = (CloneableEditorSupport)env.findCloneableOpenSupport ();
225
                support = (CloneableEditorSupport)env.findCloneableOpenSupport ();
(-)src/org/openide/util/HelpCtx.java (+105 lines)
Lines 164-170 Link Here
164
        }
164
        }
165
        if (err != null) err.log("nothing found");
165
        if (err != null) err.log("nothing found");
166
        return DEFAULT_HELP;
166
        return DEFAULT_HELP;
167
        
168
        /* PENDING-JST: This is a code from InstanceSupport that I do not understand 
169
         * why it is there and not here:
170
         *
171
        
172
            // If a component, look for attached help.
173
            if (JComponent.class.isAssignableFrom (clazz)) {
174
                JComponent comp = (JComponent) instance.instanceCreate ();
175
                if (comp != null) {
176
                    String hid = (String) comp.getClientProperty ("HelpID"); // NOI18N
177
                    if (hid != null)
178
                        return new HelpCtx (hid);
179
                }
180
            }
181
182
            // [a.n] I have moved the code here as those components's BeanInfo do not contain helpID
183
            // - it is faster
184
            // Help on some standard components. Note that borders/layout managers do not really work here.
185
            if (java.awt.Component.class.isAssignableFrom (clazz) || java.awt.MenuComponent.class.isAssignableFrom (clazz)) {
186
                String name = clazz.getName ();
187
                String[] pkgs = new String[] { "java.awt.", "javax.swing.", "javax.swing.border." }; // NOI18N
188
                for (int i = 0; i < pkgs.length; i++) {
189
                    if (name.startsWith (pkgs[i]) && name.substring (pkgs[i].length ()).indexOf ('.') == -1)
190
                        return new HelpCtx (name);
191
                }
192
            }
193
        */            
194
        
167
    }
195
    }
196
197
    /** Finds help context for a generic object. Does a lot of tricks
198
     * 
199
     *
200
     * @param instance to search help for
201
     * @return the help for the object or <code>null</code> if HelpCtx cannot be found
202
     *
203
     * PENDING-JST: mark as addition
204
     */
205
    public static HelpCtx findHelp (Object instance) {
206
        if (instance instanceof java.awt.Component) {
207
            return findHelp ((java.awt.Component)instance);
208
        }
209
        
210
211
// WDP: WizardDescriptor.Panel is handled bellow by reflection
212
        if (
213
          instance instanceof HelpCtx.Provider ||
214
// WDP:     instance instanceof WizardDescriptor.Panel ||
215
          instance instanceof HelpCtx
216
        ) {
217
            HelpCtx test;
218
            Object obj = instance;
219
            if (obj instanceof HelpCtx.Provider)
220
                test = ((HelpCtx.Provider)obj).getHelpCtx();
221
//  WDP:      else if (obj instanceof WizardDescriptor.Panel)
222
//  WDP:          test = ((WizardDescriptor.Panel) obj).getHelp ();
223
            /*
224
            else if (obj instanceof ManifestSection.FileSystemSection)
225
                test = ((ManifestSection.FileSystemSection) obj).getHelpCtx ();
226
            */
227
            else if (obj instanceof HelpCtx)
228
                test = (HelpCtx) obj;
229
            else
230
                test = null;          // obj==null or bad cookie
231
            if (test != null && ! test.equals (HelpCtx.DEFAULT_HELP))
232
                return test;
233
        }
234
        
235
        
236
        
237
        
238
        try {
239
            // Look for Bean help. Also works on components not found above.
240
            Class c = instance instanceof Class ? (Class)instance : instance.getClass ();
241
            java.beans.BeanDescriptor desc = Utilities.getBeanInfo (c).getBeanDescriptor ();
242
            if (desc != null) {
243
                // [PENDING] ideally would also look for a help set and add that to the system
244
                // set if found, but there is no API for this at the moment
245
                String val = (String) desc.getValue ("helpID"); // NOI18N
246
                if (val != null) return new HelpCtx (val);
247
            }
248
        } catch (Exception e) {
249
            ErrorManager.getDefault().notify(e);
250
            return null;
251
        }
252
        
253
        //
254
        // In order to handle WizardDescriptor.Panel.getHelp we use 
255
        // reflection
256
        //
257
        
258
        try {
259
            java.lang.reflect.Method m = instance.getClass ().getMethod("getHelp", new Class[0] );
260
            if (m.getReturnType() == HelpCtx.class) {
261
                return (HelpCtx)m.invoke (instance, new Object[0]);
262
            }
263
        } catch (NoSuchMethodException ex) {
264
            // ok, go on
265
        } catch (Exception e) {
266
            ErrorManager.getDefault().notify(e);
267
        }
268
        
269
        // all failed
270
        return null;
271
    }
272
    
168
273
169
    /**
274
    /**
170
     * An object implementing this interface is willing to answer
275
     * An object implementing this interface is willing to answer
(-)src/org/openide/util/WeakListener.java (-80 / +6 lines)
Lines 25-32 Link Here
25
25
26
import org.openide.ErrorManager;
26
import org.openide.ErrorManager;
27
import org.openide.filesystems.*;
27
import org.openide.filesystems.*;
28
import org.openide.loaders.OperationListener;
29
import org.openide.loaders.OperationEvent;
30
import org.openide.nodes.*;
28
import org.openide.nodes.*;
31
29
32
/**
30
/**
Lines 431-442 Link Here
431
     * @param source the source that the listener should detach from when
429
     * @param source the source that the listener should detach from when
432
     *     listener <CODE>l</CODE> is freed, can be <CODE>null</CODE>
430
     *     listener <CODE>l</CODE> is freed, can be <CODE>null</CODE>
433
     * @return a OperationListener delegating to <CODE>l</CODE>.
431
     * @return a OperationListener delegating to <CODE>l</CODE>.
434
     */
432
     *
435
    public static OperationListener operation (OperationListener l, Object source) {
433
     * //PENDING-JST: Replaced with org.openide.loaders.createWeakOperationListener
434
     *
435
     *
436
    public static org.openide.loaders.OperationListener operation (org.openide.loaders.OperationListener l, Object source) {
436
        WeakListener.Operation wl = new WeakListener.Operation (l);
437
        WeakListener.Operation wl = new WeakListener.Operation (l);
437
        wl.setSource (source);
438
        wl.setSource (source);
438
        return wl;
439
        return wl;
439
    }
440
    }
441
     */
440
442
441
    /** A generic WeakListener factory.
443
    /** A generic WeakListener factory.
442
     * Creates a weak implementation of a listener of type <CODE>lType</CODE>.
444
     * Creates a weak implementation of a listener of type <CODE>lType</CODE>.
Lines 855-936 Link Here
855
            return "removeFocusListener"; // NOI18N
857
            return "removeFocusListener"; // NOI18N
856
        }
858
        }
857
859
858
    }
859
860
    /** Weak property change listener
861
    */
862
    final static class Operation extends WeakListener
863
        implements OperationListener {
864
        /** Constructor.
865
        * @param l listener to delegate to
866
        */
867
        public Operation (OperationListener l) {
868
            super (OperationListener.class, l);
869
        }
870
871
872
        /** Method name to use for removing the listener.
873
        * @return name of method of the source object that should be used
874
        *   to remove the listener from listening on source of events
875
        */
876
        protected String removeMethodName () {
877
            return "removeOperationListener"; // NOI18N
878
        }
879
880
        /** Object has been recognized by
881
         * {@link DataLoaderPool#findDataObject}.
882
         * This allows listeners
883
         * to attach additional cookies, etc.
884
         *
885
         * @param ev event describing the action
886
         */
887
        public void operationPostCreate(OperationEvent ev) {
888
            OperationListener l = (OperationListener)super.get (ev);
889
            if (l != null) l.operationPostCreate (ev);
890
        }
891
        /** Object has been successfully copied.
892
         * @param ev event describing the action
893
         */
894
        public void operationCopy(OperationEvent.Copy ev) {
895
            OperationListener l = (OperationListener)super.get (ev);
896
            if (l != null) l.operationCopy (ev);
897
        }
898
        /** Object has been successfully moved.
899
         * @param ev event describing the action
900
         */
901
        public void operationMove(OperationEvent.Move ev) {
902
            OperationListener l = (OperationListener)super.get (ev);
903
            if (l != null) l.operationMove (ev);
904
        }
905
        /** Object has been successfully deleted.
906
         * @param ev event describing the action
907
         */
908
        public void operationDelete(OperationEvent ev) {
909
            OperationListener l = (OperationListener)super.get (ev);
910
            if (l != null) l.operationDelete (ev);
911
        }
912
        /** Object has been successfully renamed.
913
         * @param ev event describing the action
914
         */
915
        public void operationRename(OperationEvent.Rename ev) {
916
            OperationListener l = (OperationListener)super.get (ev);
917
            if (l != null) l.operationRename (ev);
918
        }
919
920
        /** A shadow of a data object has been created.
921
         * @param ev event describing the action
922
         */
923
        public void operationCreateShadow (OperationEvent.Copy ev) {
924
            OperationListener l = (OperationListener)super.get (ev);
925
            if (l != null) l.operationCreateShadow (ev);
926
        }
927
        /** New instance of an object has been created.
928
         * @param ev event describing the action
929
         */
930
        public void operationCreateFromTemplate(OperationEvent.Copy ev) {
931
            OperationListener l = (OperationListener)super.get (ev);
932
            if (l != null) l.operationCreateFromTemplate (ev);
933
        }
934
    }
860
    }
935
861
936
    
862
    
(-)src/org/openide/windows/CloneableOpenSupport.java (-2 / +2 lines)
Lines 207-217 Link Here
207
        /** that is fired when the objects wants to mark itself as
207
        /** that is fired when the objects wants to mark itself as
208
        * invalid, so all components should be closed.
208
        * invalid, so all components should be closed.
209
        */
209
        */
210
        public static final String PROP_VALID = org.openide.loaders.DataObject.PROP_VALID;
210
        public static final String PROP_VALID = "valid"; // NOI18N
211
        /** that is fired when the objects wants to mark itself modified
211
        /** that is fired when the objects wants to mark itself modified
212
        * or not modified.
212
        * or not modified.
213
        */
213
        */
214
        public static final String PROP_MODIFIED = org.openide.loaders.DataObject.PROP_MODIFIED;
214
        public static final String PROP_MODIFIED = "modified"; // NOI18N
215
215
216
        /** Adds property listener.
216
        /** Adds property listener.
217
        */
217
        */
(-)src/org/openide/windows/CloneableTopComponent.java (-4 / +7 lines)
Lines 16-22 Link Here
16
import java.io.IOException;
16
import java.io.IOException;
17
import java.util.*;
17
import java.util.*;
18
18
19
import org.openide.loaders.DataObject;
20
import org.openide.util.io.NbMarshalledObject;
19
import org.openide.util.io.NbMarshalledObject;
21
import org.openide.util.NbBundle;
20
import org.openide.util.NbBundle;
22
21
Lines 44-54 Link Here
44
    /** Create a cloneable top component associated with a data object.
43
    /** Create a cloneable top component associated with a data object.
45
    * @param obj the data object
44
    * @param obj the data object
46
    * @see TopComponent#TopComponent(DataObject)
45
    * @see TopComponent#TopComponent(DataObject)
47
    */
46
    *
48
    public CloneableTopComponent (DataObject obj) {
47
    *
48
    * PENDING-JST: Incompatible change
49
    *
50
    public CloneableTopComponent (org.openide.loaders.DataObject obj) {
49
        super (obj);
51
        super (obj);
50
    }
52
    }
51
53
    */
54
    
52
    /** Clone the top component and register the clone.
55
    /** Clone the top component and register the clone.
53
    * @return the new component
56
    * @return the new component
54
    */
57
    */
(-)src/org/openide/windows/DefaultTopComponentLookup.java (-1 lines)
Lines 17-23 Link Here
17
import java.util.*;
17
import java.util.*;
18
18
19
import org.openide.actions.*;
19
import org.openide.actions.*;
20
import org.openide.loaders.*;
21
import org.openide.nodes.*;
20
import org.openide.nodes.*;
22
import org.openide.util.Lookup;
21
import org.openide.util.Lookup;
23
import org.openide.util.LookupListener;
22
import org.openide.util.LookupListener;
(-)src/org/openide/windows/TopComponent.java (-4 / +13 lines)
Lines 42-48 Link Here
42
42
43
import org.openide.ErrorManager;
43
import org.openide.ErrorManager;
44
import org.openide.awt.UndoRedo;
44
import org.openide.awt.UndoRedo;
45
import org.openide.loaders.*;
46
import org.openide.actions.*;
45
import org.openide.actions.*;
47
import org.openide.util.actions.SystemAction;
46
import org.openide.util.actions.SystemAction;
48
import org.openide.nodes.*;
47
import org.openide.nodes.*;
Lines 149-156 Link Here
149
    * installing NodeName inner class and attaching it to the node delegate.
148
    * installing NodeName inner class and attaching it to the node delegate.
150
    * 
149
    * 
151
    * @param obj the data object
150
    * @param obj the data object
152
    */
151
     *
153
    public TopComponent (DataObject obj) {
152
     *
153
     * // PENDING-JST: Incompatible change
154
    public TopComponent (org.openide.loaders.DataObject obj) {
154
        this ();
155
        this ();
155
        Node n = obj.getNodeDelegate ();
156
        Node n = obj.getNodeDelegate ();
156
157
Lines 159-164 Link Here
159
160
160
        getAccessibleContext().setAccessibleDescription(n.getDisplayName());
161
        getAccessibleContext().setAccessibleDescription(n.getDisplayName());
161
    }
162
    }
163
    */
162
164
163
    /** Getter for class that allows obtaining of information about components.
165
    /** Getter for class that allows obtaining of information about components.
164
    * It allows to find out which component is selected, which nodes are 
166
    * It allows to find out which component is selected, which nodes are 
Lines 620-635 Link Here
620
            serialVersion = 0;
622
            serialVersion = 0;
621
623
622
            closeOperation = ((Integer)firstObject).intValue();
624
            closeOperation = ((Integer)firstObject).intValue();
623
            DataObject obj = (DataObject)in.readObject();
625
            
626
            
627
// BCR: this is backward compatibility read and is likely not needed
628
// BCR: anymore. So let's just ignore the read of the data object
629
// BCR:     DataObject obj = (DataObject)in.readObject();
630
            in.readObject ();
624
631
625
            super.setName((String)in.readObject());
632
            super.setName((String)in.readObject());
626
            setToolTipText((String)in.readObject());
633
            setToolTipText((String)in.readObject());
627
634
628
            // initialize the connection to a data object
635
            // initialize the connection to a data object
636
/* BCR: Remove this as we ignore the DataObject            
629
            if (obj != null) {
637
            if (obj != null) {
630
                nodeName = new NodeName (this);
638
                nodeName = new NodeName (this);
631
                nodeName.attach (obj.getNodeDelegate ());
639
                nodeName.attach (obj.getNodeDelegate ());
632
            }
640
            }
641
*/
633
        } else {
642
        } else {
634
            // new serialization
643
            // new serialization
635
            serialVersion = ((Short)firstObject).shortValue ();
644
            serialVersion = ((Short)firstObject).shortValue ();

Return to bug 32143