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

(-)openide/src/org/openide/nodes/Sheet.java (-15 / +16 lines)
Lines 209-223 Link Here
209
209
210
    /********* Inner classes **********/
210
    /********* Inner classes **********/
211
211
212
    /** A set of Bean properties.
212
    /** A set of node properties.
213
     * The term "set" is somewhat misleading since it behaves as a list, i.e.
214
     * the order of insertions is significant.
213
    */
215
    */
214
    public static final class Set extends Node.PropertySet {
216
    public static final class Set extends Node.PropertySet {
215
        /** list of properties (Node.Property) */
217
        /** list of properties (Node.Property) */
216
        private ArrayList props;
218
        private final ArrayList props;
217
        /** array of properties */
219
        /** array of properties */
218
        private Node.Property[] array;
220
        private Node.Property[] array;
219
        /** change listeners listening on this set */
221
        /** change listeners listening on this set */
220
        private PropertyChangeSupport supp = new PropertyChangeSupport (this);
222
        private final PropertyChangeSupport supp = new PropertyChangeSupport (this);
221
223
222
        /** Default constructor.
224
        /** Default constructor.
223
        */
225
        */
Lines 242-248 Link Here
242
        * @param name name of the property
244
        * @param name name of the property
243
        * @return the first property in the list that has this name, <code>null</code> if not found
245
        * @return the first property in the list that has this name, <code>null</code> if not found
244
        */
246
        */
245
        public Node.Property get (String name) {
247
        public synchronized Node.Property get (String name) {
246
            int indx = findIndex (name);
248
            int indx = findIndex (name);
247
            return indx == -1 ? null : (Node.Property)props.get (indx);
249
            return indx == -1 ? null : (Node.Property)props.get (indx);
248
        }
250
        }
Lines 250-269 Link Here
250
        /** Get all properties in this set.
252
        /** Get all properties in this set.
251
        * @return the properties
253
        * @return the properties
252
        */
254
        */
253
        public Node.Property[] getProperties () {
255
        public synchronized Node.Property[] getProperties () {
254
            Node.Property[] l = array;
256
            if (array == null) {
255
            if (l != null) return l;
257
                array = new Node.Property[props.size()];
256
258
                props.toArray(array);
257
            synchronized (this) {
258
                if (array != null) return array;
259
260
                array = new Node.Property [props.size ()];
261
                props.toArray (array);
262
                return array;
263
            }
259
            }
260
            return array;
264
        }
261
        }
265
262
266
        /** Add a property to this set, replacing any old one with the same name.
263
        /** Add a property to this set, replacing any old one with the same name.
264
         * If the property is new (not a replacement), it is placed at the end of the list.
265
         * If it is a replacement, it is kept at the same position as the old property.
267
        * @param p the property to add
266
        * @param p the property to add
268
        * @return the property with the same name that was replaced, or <code>null</code> for a fresh insertion
267
        * @return the property with the same name that was replaced, or <code>null</code> for a fresh insertion
269
        */
268
        */
Lines 284-290 Link Here
284
        }
283
        }
285
284
286
        /** Add several properties to this set, replacing old ones with the same names.
285
        /** Add several properties to this set, replacing old ones with the same names.
287
        *
286
        * Any newly added properties (not replacements) are placed at the end of the list,
287
        * in the same order as they are given to this method.
288
         * Any replacements are kept at the same positions as the original properties.
288
        * @param ar properties to add
289
        * @param ar properties to add
289
        */
290
        */
290
        public synchronized void put (Node.Property[] ar) {
291
        public synchronized void put (Node.Property[] ar) {

Return to bug 29071